move_to_new_town

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: move_to_new_town
Infiltrator
Member # 3441
Profile Homepage #0
After using move_to_new_town, what is the easiest way to immediately call a state in the new town being moved to?

--------------------
"As our circle of knowledge expands, so does the circumference of darkness surrounding it." --Albert Einstein
--------------------
Posts: 536 | Registered: Sunday, September 7 2003 07:00
Shaper
Member # 7472
Profile Homepage #1
INIT_STATE does the job pretty well. In fact, it's required for a town script to run. Thus, you put whatever you want in it, and it'll run the instant you enter the town. It works so well, in fact, that it runs before the screen is redrawn, so you may want to use the force_instant_terrain_redraw() call to make it redraw before doing whatever you want to do.

EDIT: Or, if you want to call a state other than INIT_STATE, simply put either set_state(#) or set_state_continue(#) into the INIT_STATE. (# being the number of the state.)

[ Monday, May 07, 2007 18:19: Message edited by: Nyghtfyre ]

--------------------
I tried to think of something witty to put here.

Needless to say, I failed.
Posts: 2686 | Registered: Friday, September 8 2006 07:00
Infiltrator
Member # 5576
Profile Homepage #2
In a town script, you want to use set_state_continue. In creature scripts you use set_state because the game remembers which state it is running in that script and goes back to that state the next time it runs the script. The game always just calls the START_STATE, so to get another state to run from, say, the INIT_STATE, you have to tell the game to do it immediately.

--------------------
Überraschung des Dosenöffners!
"On guard, you musty sofa!"
Posts: 627 | Registered: Monday, March 7 2005 08:00