Exit a moving room?

Hi, it's me. Again.

Ok, I'm totally lost today, I've completely rebuilt my game from the ground up, due to the fact that the libraries I put in my game didn't have the things that I thought they have and messed up the things I had coded myself. Haha.

Anyway. I'm lost because I can't figure out if it's possible to exit to parent. As in, I made a spaceship, which obviously moves about and stuff. The problem is, the exit from that spaceship should lead to different places depending on where that spaceship happens to be.

Is there a way to 'exit to parent' or do I have to code some kind of a 'move player to room x if spaceship is in room y' thing instead of using the traditional exits?

Thanks.


Set the exit to run a script, and have the script set the player's parent attribute to the parent of the parent:

player.parent = player.parent.parent

Why am I so stupid... Thanks :D That makes so much more sense than the way I've been trying to do it.


So, I got it working, only when I exit my ship at Earth Spaceport it gives me the following...

Error running script: Error evaluating expression 'DictionaryItem(coordinates, coordinate)': The given key was not present in the dictionary.
Error running script: Error evaluating expression 'DictionaryItem(coordinates, coordinate)': The given key was not present in the dictionary.
Error running script: Error evaluating expression 'DictionaryItem(coordinates, coordinate)': The given key was not present in the dictionary.

EDIT: Figured it out...
Ok, so its the dynamically generated map thing, which I guess I can live with out. I'll just not use it for now. I'm not willing to try and make my rooms make sense to the map thing.


yes that map generator has a fit if you jump/teleport from one location to another, I think map drawing is part of the fun as a player anyway


Couldn't agree more ND. Call it nostalgia.


the map/grid is based upon the Exits, so if you're using scripting to move, then you got to turn off the map, move, then turn on (and thus regenerate/build/initialize) the map.


I'm thinking of making a map system of my own anyway. Since there will be various types of maps.

Like galaxy map, star system maps, planetary maps and building maps for instance. Just have to figure out a good way to do it. Was thinking of making the graphics in photoshop... But could end up with a ridiculous number of pictures...

(I know the scale is ambitious, but I'm not satisfied with short/small scale games or stories.)


Here is one option... (with the multiple exits)
Create all the exits to all the "landing sites", but hide all the exits but the one for the planet you are at.


also... take a look in the 'libraries and code samples' forum board here, and look for Jay's (jaynabonne) threads on map/grid generation/random map/grid creation / etc etc etc, he's got some really cool code work on this stuff:

http://textadventures.co.uk/forum/samples/topic/3546/map-generation-demo
http://textadventures.co.uk/forum/samples/topic/4280/move-to-an-undiscovered-room
http://textadventures.co.uk/forum/samples/topic/3886/grid-map-fun (I think this is on customizing/editing the map/grid and/or its code)
http://textadventures.co.uk/forum/samples/topic/3214/path-library (pathfinding: moving a character/npc/monster towards a destination Object/room)

http://textadventures.co.uk/forum/samples/topic/5529/infinite-world-generation-alpha (someone else's, but based upon Jay's work)


Have you got this figured out yet?
If not, I may have an idea...


Here is something that works...
And your exit is called Airlock:
if(player.loc=0){ Airlock.to=Space }
if(player.loc=1){ Airlock.to=Mercury }
if(player.loc=2){ Airlock.to=Venus }
if(player.loc=3){ Airlock.to=Earth
if(player.loc=4){ Airlock.to=Mars }
or, if you want to hide the exit while you are in space:
Airlock.visible=false

or "switch" should work out a little easer...


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

Support

Forums