whenever my main character is attacked by the villain i want a 50% chance that the character will live or die. i have been able to do this but there is a problem. the random function gives me 5 possibilites instead of 2. i am not sure what i am doing wrong. The first view is the death animation and the second is the hurt. my script is this:
int i;
i = random(1);
if (i == 0) player.lockview(13);
player.animate(0, 7, eonce,enoblock, eforwards);
wait(50);
display("Lily is dead");
resetroom(1);
if (i == 1) player.lockview(15);
please respond, and thanks for reading
What are the five possibilities ??
Does this piece of code run more than once, unintentionally?
Use brackets like:
int i = random(1);
if (i == 0)
{
player.lockview(13);
player.animate(0, 7, eonce,enoblock, eforwards);
wait(50);
display("Lily is dead");
resetroom(1);
}
else
player.lockview(15);
Ah, right. I must be tired.
*drinks some more coffee*