STEP_INTO_SPOT_STATE

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: STEP_INTO_SPOT_STATE
Agent
Member # 27
Profile #0
This state is called when your party member walks to space, not when they physically land on a space. I'm trying to inflict a status effect on the specific party member who lands on the space, but the char_on_loc call wont work because the state is called BEFORE the character is actually on the space the terrain script is placed. How annoying.

Here's the script, can anyone think of something I am doing wrong?

beginstate STEP_INTO_SPOT_STATE;
guy = char_on_loc(my_loc_x,my_loc_y);
play_sound(-17);
if(is_combat == TRUE)
set_char_status(guy,6,1,0,1);
else
set_char_status(1000,6,1,0,1);
break;


--------------------
Enraged Slith's Blades of Avernum Website
Posts: 1233 | Registered: Wednesday, October 3 2001 07:00
Shaper
Member # 7472
Profile Homepage #1
I actually have a similar script. If you want the person to be on the space when it occurs, use the START_STATE. Of course, you have to reset the script so it runs every turn the party is near. Use my script as an example.

// thermalvent.txt
// by Nioca

// This terrain script will cause major fire damage to anyone who steps on it.

// Memory Cells -
// 0 - Severity. Defaults to 10.
// 1,2 - SDF to deactivate. If the value for both cells is 0, ignored. Otherwise, once this cell
// is set to anything other than 0, the vent deactivates.


beginterrainscript;

variables;

short severity = 10;
short turn; // This timer makes sure the effects only run once every turn.

body;

beginstate INIT_STATE;

if ((get_flag(get_memory_cell(1),get_memory_cell(2)) > 0) && (get_memory_cell(1) + get_memory_cell(2) > 0))
end();

if (get_memory_cell(0) > 0)
severity = get_memory_cell(0);

turn = get_current_tick(); // Set the timer.

set_script_mode(2); // Run every turn unless the party is far away.

break;

beginstate START_STATE;

if (turn == get_current_tick())
end();

if ((get_flag(get_memory_cell(1),get_memory_cell(2)) > 0) && (get_memory_cell(1) + get_memory_cell(2) > 0))
end();

if (char_on_me() != -1) {
put_effect_on_space(my_loc_x(),my_loc_y(),1,5,1);
run_animation_sound(167);
damage_char(char_on_me(),get_ran(severity,5,30),1); }
turn = get_current_tick();

break;

beginstate STEP_INTO_SPOT_STATE;

if ((get_flag(get_memory_cell(1),get_memory_cell(2)) > 0) && (get_memory_cell(1) + get_memory_cell(2) > 0))
end();

put_effect_on_space(my_loc_x(),my_loc_y(),1,5,1);
run_animation_sound(167);
damage_char(char_who_activated_script(),get_ran(severity,5,30),1);
turn = get_current_tick();

break;
Note the STEP_INTO_SPOT_STATE is still present. This catches the party if they're in combat mode every time they step on it. Otherwise, it'd only run once even if it was stepped on several times in combat.

--------------------
Scenarios need reviews! Please rate these scenarios at the CSR after playing them!
AmnesiaWitch HuntWhere the Rivers MeetFoul Hordes
Posts: 2686 | Registered: Friday, September 8 2006 07:00