Can this be done?
I have a boss guy, and when I hit him, there will randomly spawn guards that will attack me.
Now to the problem
When the boss guy dies, I don't want the others to live! Is there anyway to kill them all once the boss is dead?
Now to the problem
Yeah, just add this in it's die procedure(Assuming that the guards have a brain of 9).
int &guards;
deathloop:
&guards = get_sprite_with_this_brain(9,0);
if(&guards > 0)
{
sp_active(&guards,0);
goto deathloop;
}
If this won't work, it's probably because the boss die too quick. If so, put that in the main procedure of a script(let's name it "clear.c"), then in the boss' die proc, use
spawn("clear");
int &guards;
deathloop:
&guards = get_sprite_with_this_brain(9,0);
if(&guards > 0)
{
sp_active(&guards,0);
goto deathloop;
}
If this won't work, it's probably because the boss die too quick. If so, put that in the main procedure of a script(let's name it "clear.c"), then in the boss' die proc, use
spawn("clear");
Hmm... I believe that should work in the die procedure. The die procedure stops working when it gets to any kind of wait command (like wait, say_stop, move_stop, etc).
When I hit him randomly he will spawn guards, I use this to spawn them:
int &guard = create_sprite(&303, &387, 9, 297, 1);
sp_script(&guard, "EN-QGUARD");
They doesnt spawn there I want they spawn in the left corner!!
So does the boss when he dies, like teleported to the left corner! Why does this happen?
int &guard = create_sprite(&303, &387, 9, 297, 1);
sp_script(&guard, "EN-QGUARD");
They doesnt spawn there I want they spawn in the left corner!!
Don't use the & before numbers.
int &guard = create_sprite(303, 387, 9, 297, 1);
sp_script(&guard, "EN-QGUARD");
int &guard = create_sprite(303, 387, 9, 297, 1);
sp_script(&guard, "EN-QGUARD");
Do'h! How could I miss a thing like that!?! Anyway... When the boss dies he'steleported to the left upper corner... Why?
We can only tell you if you show us the script. You might consider checking it with DinkC Editor before, still. He would have told you about the ampersand in front of the numbers.
cypry i did that exact same thing in a script i wrote except i put a wait command in there. that way if something like appears at the same time as the guy dies IE you hit the guy and he dies but hitting him creates another monster a lag between the monster creating and the die script running wont keep another monster alive and also if it messes up into an infinite loop it wont crash
but here is mine it gives a little fancier visual effect
int &ass;
int &ass1;
int &ass2;
int &blow;
redo:
int &ass = get_sprite_with_this_brain(9,0);
if (&ass != 0)
{
&ass1 = sp_x(&ass,-1);
&ass2 = sp_y(&ass,-1);
sp_active(&ass,0);
&blow = create_sprite(&ass1,&ass2,7,167,1);
sp_seq(&blow,167);
wait(30);
goto redo;
}
but here is mine it gives a little fancier visual effect
int &ass;
int &ass1;
int &ass2;
int &blow;
redo:
int &ass = get_sprite_with_this_brain(9,0);
if (&ass != 0)
{
&ass1 = sp_x(&ass,-1);
&ass2 = sp_y(&ass,-1);
sp_active(&ass,0);
&blow = create_sprite(&ass1,&ass2,7,167,1);
sp_seq(&blow,167);
wait(30);
goto redo;
}
Left upper corner? Maybe your coordinates are messed up? I was working with something that was supposed to create a sprite at a certain location, but due to an error in my scripting, it wasn't given the coordinates at all and it ended up in the left upper corner. Maybe check where you give the coordinates for an error?












