Reply to A script problem
If you don't have an account, just leave the password field blank.
Here is a script that is attached to a gaurd sprite. The purpose of the gaurd is to follow you and when he touches you prompt a message from there he takes you to jail or he begin to hurt you with touch damage. At first I use the editor_seq trick to get the variable for the touch but that was not working so I changed it to a global variable and that did not work either. I relized after some testing checking with the variables that anything after the choice_end() doesn't execute. No matter what choice I pick he doesn't say anything. He does not prompt the choice again so I guess the variable is working. I have tried many things but nothing seems to work.
void main(void)
{
//int &ed = sp_editor_num(¤t_sprite);
//int &gaurdtouch = editor_seq(&ed, -1);
//&gaurdtouch = 0;
//editor_seq(&ed, &gaurdtouch);
&crimex = 1;
sp_brain(¤t_sprite, 9);
sp_speed(¤t_sprite, 1);
sp_frame_delay(¤t_sprite, 50);
sp_timing(¤t_sprite, 0);
sp_exp(¤t_sprite, 1500);
sp_base_walk(¤t_sprite, 290);
sp_defense(¤t_sprite, 10);
sp_strength(¤t_sprite, 40);
sp_hitpoints(¤t_sprite, 300);
sp_base_death(¤t_sprite, 295);
sp_touch_damage(¤t_sprite, -1);
sp_target(¤t_sprite, 1);
}
void touch(void)
{
if(&crimex == 1)
{
&crimex += 1;
//editor_seq(&ed, &gaurdtouch);
choice_start()
title_start();
You have been charged with a crime, time to go to jail
title_end();
"Ok I will go &crimex"
"You will never take me alive"
choice_end()
if(&result != 1)
{
say_stop("`5 OK then follow me to jail &result", ¤t_sprite);
}
if(&result == 2)
{
say("`5Fine you will DIE!!", ¤t_sprite);
wait(100);
sp_touch_damage(¤t_sprite, 50);
}
}
}
void main(void)
{
//int &ed = sp_editor_num(¤t_sprite);
//int &gaurdtouch = editor_seq(&ed, -1);
//&gaurdtouch = 0;
//editor_seq(&ed, &gaurdtouch);
&crimex = 1;
sp_brain(¤t_sprite, 9);
sp_speed(¤t_sprite, 1);
sp_frame_delay(¤t_sprite, 50);
sp_timing(¤t_sprite, 0);
sp_exp(¤t_sprite, 1500);
sp_base_walk(¤t_sprite, 290);
sp_defense(¤t_sprite, 10);
sp_strength(¤t_sprite, 40);
sp_hitpoints(¤t_sprite, 300);
sp_base_death(¤t_sprite, 295);
sp_touch_damage(¤t_sprite, -1);
sp_target(¤t_sprite, 1);
}
void touch(void)
{
if(&crimex == 1)
{
&crimex += 1;
//editor_seq(&ed, &gaurdtouch);
choice_start()
title_start();
You have been charged with a crime, time to go to jail
title_end();
"Ok I will go &crimex"
"You will never take me alive"
choice_end()
if(&result != 1)
{
say_stop("`5 OK then follow me to jail &result", ¤t_sprite);
}
if(&result == 2)
{
say("`5Fine you will DIE!!", ¤t_sprite);
wait(100);
sp_touch_damage(¤t_sprite, 50);
}
}
}