Jump to content

how is this not working?


Recommended Posts

How is this not killing my final character in a party of four? pchar = 0, and, if I'm correct, a while statement runs until the phrase is false.

Code:
 	while (pchar < (party_size() + 1)){		if((char_on_loc(26,10) == -1) && (char_on_loc(26,11) == -1) && (char_on_loc(26,14) == -1) && etc...){			put_boom_on_char(pchar,0,0);			run_animation_sound(51);			kill_char(pchar,3,0);			clear_buffer();			append_char_name(pchar);			append_string(" is ");			append_string("obliterated!");			get_buffer_text(teststring);			print_str_color(teststring,3);			}		pchar = pchar + 1;		} 
Link to comment
Share on other sites

The script is trying to say that unless a character is in one of those spaces he's going to die. Though you brought up a different problem that I hadn't noticed, this does not answer my original question.

 

EDIT:

Why didn't Jeff include a single call that checked to see if a SPECIFIC character was in a spot? Now I'm going to have to manipulate this script more than I wanted to. My head hurts.

Link to comment
Share on other sites

Here's another problem. Though it gave me a bad head ache, I finally got this section of script to work. Essentially, what this script is supposed to do is: if this creature spots your party, he runs away to a new hiding spot (with a failsafe for making sure it isn't the same spot as last time.) Unfortunately, the failsafe isn't working, and the creature reappears the next turn (over and over and over and over.) If someone could get back to me on this question and the one above, I would appreciate it.

 

EDIT: It isn't shown here but I've assigned all my variables.

 

Town Script:

Code:
 	(startstate, yadda yadda yadda)if(myself == 49){		activate_hidden_group(2);		}	if(myself == 50){		activate_hidden_group(3);		}	if(myself == 51){		activate_hidden_group(4);		}	if(myself == 52){		activate_hidden_group(5);		}	if(myself == 53){		activate_hidden_group(6);		}	if(myself == 54){		activate_hidden_group(7);		}	if(myself == 55){		activate_hidden_group(8);		}	if(myself == 56){		activate_hidden_group(9);		}	if(myself == 57){		activate_hidden_group(10);		}	if(myself == 58){		activate_hidden_group(11);		}	if ((get_flag(2,15) < 4) && (get_flag(2,14) == 1)){		print_str_color("This script is working.",2);		myself = get_ran(1,49,58);		if(myself == myselfold){			myself = myself + 1;			}		myselfold = myself;		t = t + 1;		if(t == 1){			message_dialog("			}		if(t == 2){			message_dialog("","");			}		if(t == 3){			message_dialog("","");			}		set_flag(2,14,0);		} 
Creature Script:

Code:
 beginstate START_STATE;	if (t < 4){		if(can_see_char(1000)){			force_view_center(char_loc_x(my_number()),char_loc_y(my_number()));			text_bubble_on_char(my_number(),"!");			force_instant_terrain_redraw();			pause(20);			text_bubble_on_char(my_number(),"");			force_instant_terrain_redraw();			play_sound(-121);			erase_char(my_number());			t = t + 1;			set_flag(2,15,t);			set_flag(2,14,1);			}		}
Link to comment
Share on other sites

I can't help with the problem you're currently experiencing, but I can tell you that creating the message after killing the character is not a good idea. I've found that BoA gets rather unreliable when it tries to retrieve data on a character that's either dead or doesn't exist.

 

EDIT: It appears that, if get_ran turns out 58, and the creature's last hiding spot was 58, it'll change it to 59, which isn't supported. I'm not sure if that's what's causing the glitch you're experiencing, but it's still worth correcting.

Link to comment
Share on other sites

Thanks for the catch, I fixed that up. Script is doing some weird things now after tweaking.

 

First, the failsafe works only on occasion. Second, after a certain point when I kill the creature, he keeps reviving over and over and over and over. I used no create creature calls so this seems pretty strange to me.

Link to comment
Share on other sites

I think that maybe one problem is with the creature script-terrain script interaction; the way that the creature script sends information to the town script is by setting flags 2,15 and 2,14. It appears that you are trying to make flag 2,15 be set 1 higher each time; but this won't work because the3 first time, t is 0, gets incremented to 1, and the flag is set to the value, but because the creature erases itself, the new one is back to having t=0, so the exact same result will be given each time. So, maybe the solution is to avoid using the local variable t, and instead to use only an SDF to store the count. I don't see a way that this would cause the creature always appear in the same place, though.

Link to comment
Share on other sites

I think this is what you were going for with the first script:

Code:
	while (pchar < (party_size() + 1)){		if((char_on_loc(26,10) != pchar) && (char_on_loc(26,11) != pchar) && (char_on_loc(26,14) != pchar) && etc...){			put_boom_on_char(pchar,0,0);			run_animation_sound(51);			kill_char(pchar,3,0);			clear_buffer();			append_char_name(pchar);			append_string(" is ");			append_string("obliterated!");			get_buffer_text(teststring);			print_str_color(teststring,3);			}		pchar = pchar + 1;		}
Checks for each PC whether or not he's on one of the safe spots, and kills him if he isn't.

 

As for the creature script, I'm not patient enough to debug that. But at first glance I'd say the problem is, as Niemand said, with the variable. Remember that whenever you erase the creature and activate a new group the value T is lost. Use a flag.

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...