WinDinkEdit Plus: How to make a thing die? With a conditon.
void hit(void)
If the &story == is, say, 0, the pig should live.
If the &story == is, say, 1, the pig should die.
The problem is, the pig dies even with &story == 0.
By the way I have done Rudiments of Scripting many times.
If the &story == is, say, 0, the pig should live.
If the &story == is, say, 1, the pig should die.
The problem is, the pig dies even with &story == 0.
By the way I have done Rudiments of Scripting many times.
...then again, let's do this the 2006 way.
void hit(void)
{
if (&story == 0);
{
freeze(1);
say_stop("`8H", ¤t_sprite);
unfreeze(1);
}
}
{
if (&story == 1);
{
freeze(1);
say_stop("`8H", ¤t_sprite);
sp_kill(¤t_sprite);
wait(200);
say_stop("H", 1);
&story = 2;
unfreeze(1);
}
}
The pig now runs both scripts - it seems to ignore the &story command.
Also, it won't die.
void hit(void)
{
if (&story == 0);
{
freeze(1);
say_stop("`8H", ¤t_sprite);
unfreeze(1);
}
}
{
if (&story == 1);
{
freeze(1);
say_stop("`8H", ¤t_sprite);
sp_kill(¤t_sprite);
wait(200);
say_stop("H", 1);
&story = 2;
unfreeze(1);
}
}
The pig now runs both scripts - it seems to ignore the &story command.
Also, it won't die.
Three things:
a)
if (&story == 0);
Remove semicolons, that's why the game ignores the value of the &story variable.
b)
sp_kill(¤t_sprite);
Use sp_active(¤t_sprite,0); instead. Though sp_kill(); should work if you would give it the right variables, it's just less direct.
c)
always put unfreeze(1); and &story = 2; before the sp_active(); command. When ¤t_sprite dies, so does the script and the last part will not be executed.
a)
if (&story == 0);
Remove semicolons, that's why the game ignores the value of the &story variable.
b)
sp_kill(¤t_sprite);
Use sp_active(¤t_sprite,0); instead. Though sp_kill(); should work if you would give it the right variables, it's just less direct.
c)
always put unfreeze(1); and &story = 2; before the sp_active(); command. When ¤t_sprite dies, so does the script and the last part will not be executed.
d) Why are you messing around with so many braces? You only need one to open the function, one to open a condition, one to close the function and one to close a condition... Right now you coded things in such a way that you close the function before the next condition gets a chance to be executed.
Where should I put the braces? Oh wait, I figured it out... I don't even know why I posted this part, but...
The pig just disappears, not really dies. I know how to make a blood explosion, but however I set the coordinates it spawns the blood in the very upper left corner?
The pig just disappears, not really dies. I know how to make a blood explosion, but however I set the coordinates it spawns the blood in the very upper left corner?
Instead of using sp_kill or sp_active try hurt(¤t_sprite, #); where # is the amount of hitpoints the sprite has. It will kill it properly, as if it was hit.
Edit: Btw what Metatarasal pointed out in c) still applies here.
Edit: Btw what Metatarasal pointed out in c) still applies here.
Rudiments of Scripting totally sucks! I tried once to make ONE script by copying it straight from the text, and still, it didn't work.
Which script? Some of them are incorrect / misspelled on purpose.














