Jump to content

State of Chaos


Nioca

Recommended Posts

I'm having a small problem with one of my town scripts, and I can't figure out why. Here is what's going on. The party walks up to a lever and gets ambushed. Once the ambushers are defeated, the party can pull the lever.

 

The thing is, once the hidden group appears, the whole town script shuts down. Any error message I recieve is lost because the monsters act instantly after the state is called. Here is the state. Any ideas?

 

Code:
 beginstate 53;	if ((get_flag(4,9) == 250) && (is_combat() == 0)) {		reset_dialog();		add_dialog_str(0,"Yet again, you attempt to approach this lever. It appears that...",0);		add_dialog_str(1,"What do you want to do?",0);		add_dialog_choice(0,"Pull the lever.");		add_dialog_choice(1,"Back away slowly.");		choice = run_dialog(0);		if (choice == 1) {			if (get_flag(4,5) < 5) {				set_terrain(37,46,392);				set_terrain(41,46,392);				set_terrain(37,42,392);				set_terrain(41,42,392);				set_flag(4,5,1);				flip_terrain(29,42);				play_sound(94);				pause(2);				flip_terrain(29,42);				play_sound(94);				message_dialog("When you pull this lever, you hear...");				}			if (get_flag(4,5) == 125) {				set_flag(4,5,250);				flip_terrain(29,42);				play_sound(94);				pause(2);				flip_terrain(29,42);				play_sound(94);				pause(3);				play_sound(162);				message_dialog("When you pull this lever, you hear...");				}			if (get_flag(4,5) == 250) {				flip_terrain(29,42);				play_sound(94);				pause(2);				flip_terrain(29,42);				play_sound(94);				print_str_color("Nothing seems to happen.",3); }				}			}	if (get_flag(4,9) == 0) {		message_dialog("As you approach the lever, you hear a rustling noise from...");		set_terrain(26,42,0);		set_terrain(27,43,0);		set_terrain(26,44,0);		set_terrain(26,45,0);		set_terrain(28,46,0);		set_terrain(30,46,0);		set_terrain(29,45,0);		set_terrain(29,44,0);		set_terrain(30,44,0);		set_terrain(31,43,0);		set_terrain(32,45,0);		activate_hidden_group(3);		set_flag(4,9,250); } 
Link to comment
Share on other sites

Code:
 beginstate 53;

if ((get_flag(4,9) == 250) && (is_combat() == 0)) {
reset_dialog();
add_dialog_str(0,"Yet again, you attempt to approach this lever. It appears that...",0);
add_dialog_str(1,"What do you want to do?",0);
add_dialog_choice(0,"Pull the lever.");
add_dialog_choice(1,"Back away slowly.");
choice = run_dialog(0);
if (choice == 1) {
if (get_flag(4,5) < 5) {
set_terrain(37,46,392);
set_terrain(41,46,392);
set_terrain(37,42,392);
set_terrain(41,42,392);
set_flag(4,5,1);
flip_terrain(29,42);
play_sound(94);
pause(2);
flip_terrain(29,42);
play_sound(94);
********************message_dialog("When you pull this lever, you hear...");
}
if (get_flag(4,5) == 125) {
set_flag(4,5,250);
flip_terrain(29,42);
play_sound(94);
pause(2);
flip_terrain(29,42);
play_sound(94);
pause(3);
play_sound(162);
************************message_dialog("When you pull this lever, you hear...");
}
if (get_flag(4,5) == 250) {
flip_terrain(29,42);
play_sound(94);
pause(2);
flip_terrain(29,42);
play_sound(94);
print_str_color("Nothing seems to happen.",3); }
}
}

if (get_flag(4,9) == 0) {
************************message_dialog("As you approach the lever, you hear a rustling noise from...");[/b]
set_terrain(26,42,0);
set_terrain(27,43,0);
set_terrain(26,44,0);
set_terrain(26,45,0);
set_terrain(28,46,0);
set_terrain(30,46,0);
set_terrain(29,45,0);
set_terrain(29,44,0);
set_terrain(30,44,0);
set_terrain(31,43,0);
set_terrain(32,45,0);
activate_hidden_group(3);
set_flag(4,9,250); }
Link to comment
Share on other sites

Two thing I've learned today. First, the message pane has a scroll bar! Secondly, it's much harder to pin down an error if you don't see the message, even if it's something common. Like in this case, where the problem was a missing 'break;' at the end of the state.

 

By the way, Kel, those were truncated message_dialog calls. That's not how they actually appear in the script. wink

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...