The Dink Network

Script help (Deleting Sprites)

June 21st 2007, 06:48 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
I need help. How do you delete/kill a sprite so it doesn't come back. I want the person to run a sequence then dissapear.
June 21st 2007, 08:18 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
I'd say position him off-screen, then kill him. Or kill him, then redraw the screen. (I forgot what the functions were, sorry, but these are two ways to do it.)

EDIT: woops, it shouldn't come back? Well, there was a special function to set the kill properties of someone... I don't remember what that was either, though.
June 21st 2007, 09:34 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Let me redefine the question. I had to type it quick cause school was about to start.

You may have seen my thread about the graphics thing where I wanted a skeleton? Well, I got that (PQ enemy pack). And I want to know how to get rid of sprites. I was planning to have the spell so you use it, and about 5 skeletons raise from the ground. I've got all that, then after they attack about 3 times, they go back into the ground. I've made some graphics of the ground opening up and closing, and I modified the skeleton graphics to go down into the ground, and I just need to know, how to delete the sprite after running another sequence.

So, I want to run a sequence, then destroy the sprite. I couldn't find anything in the dinkc.chm. Any help you be greatly appreciated!
June 21st 2007, 10:02 PM
goblinm.gif
sp_active(&sprite, 0);
June 21st 2007, 10:40 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
So that will just destroy the sprite, make it dissapear? If so, thanks!
June 22nd 2007, 02:20 AM
boncag.gif
Znex
Peasant He/Him Australia
Oh hey. 
Use this as well:

sp_nodraw(&current_sprite, 1);

So it actually disappears. The previous one just renders the sprite useless. It doesn't actually make the sprite disappear.
June 22nd 2007, 03:03 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
It does make it invisible actually. You don't need the sp_nodraw() command at all for this...
June 22nd 2007, 04:24 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Thanks guys. Real help!
June 22nd 2007, 07:36 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
sp_active() destroys the sprite completely. It removes it from the sprite list, deletes it from screen and clears its sp() number for use by other sprites (such as those created by create_sprite() ).
June 22nd 2007, 06:19 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
That's exactly what I want. I want the skeleton to dissapear forever until you use the spell again, but then it just creates another one.

So, I've got another question, I only want the skeletons to rise from their grave if there are enemies on the screen. What script command can you use to see if there's any enemies on a screen. If there aren't any I'll just have Dink say "There's no monsters around now.". Anyone? I know this function was used with a few of the spells in Pilgrim's Quest.
June 22nd 2007, 06:56 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Well, you can check whether there are any sprites with either brain 9 or 10 on the screen. Those are usually the enemy brains, so I would recommend something like this:

int &present = get_sprite_with_this_brain(10,1);
if (&present != 0)
goto present;
&present = get_sprite_with_this_brain(9,1);
if (&present != 0)
goto present;
say_stop("No monsters on this screen...",1);
return;
present:
//execute spell here.

(Maybe this isn't the cleanest way... But it's 0:56 here, so that might just impale my ability to think clearly.)
June 22nd 2007, 07:00 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Oh yeah. Brain 9 or 10. Forgot about that. Anyway, thanks! Is there an easier way? If so, anyone?