Use of Globals to store X,Y coords...

One of my maps is an ocean map. When the player is in this map, I have set a keydown event which takes the PC to another map of the deck of the ship, but I would like to have my game remember the position (X coord, Y coord, and Ocean set) of the boat on the map and when they hit they keydown to sail again, it teleports back to the ocean at the x and y coords they were at. any idea how to accomplish this?

------------------

Quote

Originally posted by the48thronin:
One of my maps is an ocean map. When the player is in this map, I have set a keydown event which takes the PC to another map of the deck of the ship, but I would like to have my game remember the position (X coord, Y coord, and Ocean set) of the boat on the map and when they hit they keydown to sail again, it teleports back to the ocean at the x and y coords they were at. any idea how to accomplish this?

In your teleportation event, before you move the player, insert 2 change global event objects to capture the player's X and Y coordinate(PlayerX/PlayerY). Then proceed to move the character.

When you wish to return him simply use the Map Position event object and supply the globals as tag values.

As for the "ocean set," you can also do this as a global but it is more intensive. Basically you use a global change event object to store the value of "&&LocationName;" into your ocean global. This saves the map name. To return the player to this map requires a big search event; its size is determined by how many possibilities there are. You will create a list of conditionals checking the value of your ocean global to see if they are the same name as the maps the player should be returned to. If they match then have the conditional call a teleport event object to send the player to that map. You only need to create conditionals to maps that are possible(ie, if you have an underground map which the player won't get to via this method, then you don't need to list it as a possibility).

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)

Why not number the maps: 1 = pacific, 2 = mediterenean, 3 = north sea, etc

------------------

Quote

Originally posted by jeroen goulooze:
Why not number the maps: 1 = pacific, 2 = mediterenean, 3 = north sea, etc

Because &&LocationName; is stored automatically whenever a map is loaded. You can't alter this value, but you can check its value.

If you wished to create an external naming scheme, then you would have to have every map load this value into a new global whenever it was loaded, so you could keep track of it. Then, since teleport event objects do not allow tag values, you would still need to create a large event of conditionals checking the value of your new global, and having it call the appropriate teleport event object to the map that is needed.

In short, it is more work.

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)

Quote

Originally posted by the48thronin:
One of my maps is an ocean map. When the player is in this map, I have set a keydown event which takes the PC to another map of the deck of the ship, but I would like to have my game remember the position (X coord, Y coord, and Ocean set) of the boat on the map and when they hit they keydown to sail again, it teleports back to the ocean at the x and y coords they were at. any idea how to accomplish this?

If it's as simple as that: (player on ocean -> player on ship), (time passes and player wanders the ship), (player on ship -> player on ocean), you might want to look into the "Save Location" and "Restore Location" event actions.

------------------
I don't know what I'm talking about.
Oh no, here comes another learning experience.
Oderint dum metuant?

Quote

Originally posted by Glenn:
**If it's as simple as that: (player on ocean - > player on ship), (time passes and player wanders the ship), (player on ship -> player on ocean), you might want to look into the "Save Location" and "Restore Location" event actions.

**

I knew there must be a more straightforward way... thank you!

------------------

Quote

Originally posted by Glenn:
**If it's as simple as that: (player on ocean - > player on ship), (time passes and player wanders the ship), (player on ship -> player on ocean), you might want to look into the "Save Location" and "Restore Location" event actions. **

I never have been able to get the save/restore location event actions to work correctly, hence I don't promote them.

Of course, I'm 95% certain that this is due to user error, as I haven't taken the time to figure out why I can't get them to work correctly. 🙂

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)