The Dink Network

How to completley kill a sprite and script?

September 25th 2011, 05:25 AM
peasantmg.gif
raven
Peasant He/Him Sweden
 
How to completley kill a sprite and script?

If I have placed a sprite with the editor,

int &s = sp(1);

the sprite has a script attached

w1-stg

Is it just to call its die() procedure, or must I do something more?
September 25th 2011, 05:26 AM
duckdie.gif
sp_kill(¤t_sprite, 1);
kill_this_task;

Use global variables if you want to make the script DIE DIE DIEEE completely.
September 25th 2011, 05:28 AM
milder.gif
duckhater
Peasant He/Him India
From The Depths Of Tartarus Itself 
Good luck with your dmod,dude!
September 25th 2011, 05:29 AM
duckdie.gif
Oh, and put &current_sprite there, it changes to the symbol.
September 25th 2011, 05:49 AM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
You can use sp_script to replace a sprite's script with another script:
int &s = sp(1);
script_attach(0);
sp_script(&s, "newscript");
kill_this_task();

Newcript could include:
sp_active(&current_sprite, 0);
kill_this_task();


Or you could have sp_active in the die procedure or in the script somewhere as sp_active will destroy anything and it's not possible to resurrect anything crushed by sp_active(~~, 0);
September 25th 2011, 05:50 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
isnt it something like
sp_active(&current_sprite,0);
and
kill_this_task();

dang quiz...
September 25th 2011, 05:52 AM
duckdie.gif
I've found that sp_kill works just as well. Oh, and yes, you put those brackets in kill_this_task.
so
sp_kill(¤t_sprite, 1); if you like me   
sp_active(¤t_sprite, 0); if you don't   
kill_this_task();

Also, if you call on the die(); procedure you can kill the script. And add sp_kill to make the sprite disappear.
September 25th 2011, 05:55 AM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
soz MsDink.

sp_kill will also work, but you have a wait time of 1 before it's killed, so I's not quite that good if you compare to sp_active. 1 MILLISECOND, HUGE DIFFERENCE!
September 25th 2011, 05:56 AM
duckdie.gif
You're RIGHT!
But a time of 1 is almost like.... a millisecond. It works in my DMOD.
Edit: Lol Quiztis.
September 25th 2011, 06:16 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
pff your answer was better and more informed anyways quiz
September 26th 2011, 07:31 AM
peasantmg.gif
raven
Peasant He/Him Sweden
 
Thanks all for the help!