The Dink Network

Re: Brain stuff

February 23rd 2008, 12:20 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
How do I use that get_sprite_with_this_brain properly. I've got this script attached to a sprite, and I do a script_attach(1000); and sp_active(&current_sprite, 0); but when I do that if...get_sprite... = 0... it doesn't work. As in, the script doesn't continue.
February 23rd 2008, 01:02 AM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
The problem is likely that you've killed the sprite with sp_active(&current_sprite, 0), and therefore, there is no sprite to be found with get_sprite_with_this_brain(). The script exists, but it's attached now to sprite 1000, which is fake.
February 23rd 2008, 01:16 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Okay, let me change the question:

I've got a sprite, it talks to Dink, Dink fights some other guys, while the sprite stays hidden on the screen. But, how do I tell when all the enemies are dead so I can continue with the script.
February 23rd 2008, 01:47 AM
spike.gif
Propably simplest to do a loop, or add a braincheck in each monster's die() procedure (like what's done to remove screenlocks).

Eg.

loop:
wait(100);
if (get_sprite_with_this_brain(9,&current_sprite) != 0)
goto loop;
say("Thar script continuas!",1);
February 23rd 2008, 01:50 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
But I think what's wrong, is that the sprite the script is attached to, is still there, and it's seeing that as well.

How do I do that braincheck thing?
February 23rd 2008, 02:51 PM
dinkdead.gif
Look in en-pill1 for the braincheck, which is this:
if (get_sprite_with_this_brain(9, &current_sprite) == 0)
{
//no more brain 9 monsters here, lets unlock the screen
screenlock(0);
playsound(43, 22050,0,0,0);
}
in the die procedure.

It isn't seeing the sprite it's attached to because the second bit tells it a sprite to ignore - get_sprite_with_this_brain(9, <ignore this one> );

Edit: Your enemies are brain 9, right?
If the sprite with the script is out of the way somewhere, try sp_nodraw() instead of sp_active().
February 23rd 2008, 03:12 PM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
Personally, I'd completely kill off the old inactive sprite and put the braincheck procedure in each enemy before it dies. When no more are found, just recreate the sprite inside that braincheck and attach a new script with everything you wanted to do with him after the battle is over. Believe it or not, this is a less messy way to do things in Dink.
February 23rd 2008, 08:10 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Right. I'll try it and get back to you all.
February 25th 2008, 01:40 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
I got it working! Finally! This is what I did:

I had my script attached to a sprite, the first part of the cutscene runs, then, a couple of enemy scripts get attached to nearby sprites. I put a braincheck it each of their die() procedures, and killed off the original sprite with an sp_active(&current_sprite, 0);. Then, when there were no monsters left on the screen, it spawned a script which spawns a new sprite, exactly like the first one, then another part of the cutscene runs and Dink fights him.

Thanks guys!