X and Y coordinates from Lunastone REQUEST

cdutton184
Sophia1,

The first thing I did was to ADD the integer variables in the game.attributes TAB section:

sectorX = 0, sectorY = 0

Plus ADDing the variables for the x and y coords. for each island:

neosx = 0, neosy = 0, chanrax = 0, chanray = 0, etc.

Then in the Script tab of game a Call Function called randoms was made to randomly create all the islands x and y coords.

This is the Call Function contents for randoms (in part):

Return type: None

Parameters: <LEAVE BLANK>

game.neosx = GetRandomInt(100,199)
game.neosy = GetRandomInt(100,199)
game.chanrax = GetRandomInt(200,299)
game.chanray = GetRandomInt(200,299)

Etc, plus many more random x and y variables…

Then in the USE (on its own) section of the flying craft object it asks for the X and Y coords:

msg ("Enter the Sector X co-ordinate?")
get input {
if (IsInt (result)) {
sectorX = ToInt (result)
wait {
msg ("Enter the Sector Y co-ordinate?")
get input {
if (IsInt (result)) {
sectorY = ToInt (result)
sectorchecks (sectorX, sectorY)
}
else {
msg ("You need to enter a number. Try USE CRAFT again.")
}
}
}
}
else {
msg ("You need to enter a number. Try USE CRAFT again.")
}
}


This checks your input to the Call Function named sectorchecks which has two parameters you need to ADD:

sectorX
sectorY

Call Function sectorchecks contains:

Return type: Integer

Parameters:
sectorX
sectorY

if (sectorX = game.neosx) {
if (sectorY = game.neosy) {
if (not game.pov.parent = landing platform 1) {
msg ("<br/>You fly off to your destination.")
MoveObject (flying craft, landing platform 1)
MoveObject (player, landing platform 1)
}
else {
msg ("You are already at these co-ordinates.")
}
}
else {
msg ("They are not valid co-ordinates. You're going nowhere.")
}
}
else if (sectorX = game.chanrax) {
if (sectorY = game.chanray) {
if (not game.pov.parent = landing platform2) {
msg ("<br/>You fly off to your destination.")
MoveObject (flying craft, landing platform2)
MoveObject (player, landing platform2)
}
else {
msg ("You are already at these co-ordinates.")
}
}
else {
if (sectorY = game.chanray1) {
if (not game.pov.parent = landing platform3) {
msg ("<br/>You fly off to your destination.")
MoveObject (flying craft, landing platform3)
MoveObject (player, landing platform3)
}
else {
msg ("You are already at these co-ordinates.")
}
}
else {
msg ("They are not valid co-ordinates. You're going nowhere.")
}
}
}
else if (sectorX = game.scythonx) {
if (sectorY = game.scythony) {
if (not game.pov.parent = landing platform4) {
msg ("<br/>You fly off to your destination.")
MoveObject (flying craft, landing platform4)
MoveObject (player, landing platform4)
}
else {
msg ("You are already at these co-ordinates.")
}
}
else {
msg ("They are not valid co-ordinates. You're going nowhere.")
}
}
else if (sectorX = game.palamorex) {
if (sectorY = game.palamorey) {
if (not game.pov.parent = landing platform5) {
msg ("<br/>You fly off to your destination.")
MoveObject (flying craft, landing platform5)
MoveObject (player, landing platform5)
}
else {
msg ("You are already at these co-ordinates.")
}
}
else {
msg ("They are not valid co-ordinates. You're going nowhere.")
}
}
else if (sectorX = game.qrelx) {
if (sectorY = game.qrely) {
if (not game.pov.parent = landing platform6) {
msg ("<br/>You fly off to your destination.")
MoveObject (flying craft, landing platform6)
MoveObject (player, landing platform6)
}
else {
msg ("You are already at these co-ordinates.")
}
}
else {
msg ("They are not valid co-ordinates. You're going nowhere.")
}
}
else if (sectorX = game.envahrx) {
if (sectorY = game.envahry) {
if (not game.pov.parent = landing platform7) {
msg ("<br/>You fly off to your destination.")
MoveObject (flying craft, landing platform7)
MoveObject (player, landing platform7)
}
else {
msg ("You are already at these co-ordinates.")
}
}
else {
msg ("They are not valid co-ordinates. You're going nowhere.")
}
}
else {
msg ("They are not valid co-ordinates. You're going nowhere.")
}


Basically, each 'check' compares your x and y inputs with the x and y coordinates of each island. First it checks you're not already at those coordinates and if not sends you (player) and the flying craft to your destination and giving default responses to anything else.

I’m not saying any of this is neat or efficient programming but I’m not advanced like others and if anyone could simplify or make this a bit more prettier than go ahead.

I hope this is OK, Sophia? Any more questions, just ask.

icfspectre
THIS is exactly what I was looking for with mine!! Firstly, Lunascape is awesome, still not finished it yet, I wanted to yoink your travelling system to use on a Jeep in my game. However, the idea is to repair the jeep first, so even if they type in the correct location, it won't take them there if they havn't used an object on the Jeep first.

For example, if they USE the BATTERY on the JEEP and they have the TOOLBOX in their inventory, then it removes the BATTERY and also enables the ability to USE the JEEP. then they can USE the JEEP, to move location. If they don't USE the BATTERY on the JEEP, then when they try to USE the JEEP it will just say something like, "the jeep is out of action, seems to need a new battery". Or something similar.

I hope this is obvious for how I've written it, I want me game to be really indepth and powerful, and any help you can give me would be amazing! This is my first game and I have no clue how most of Quest works at all, so you'll have to pretend I'm a moron! :)

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums