The Dink Network

End of Sprites

December 5th 2009, 11:43 AM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
Any way of disabling and removing all sprites (except Dink) on screen instantly? (in the scriptly way)
December 5th 2009, 02:03 PM
dinkdead.gif
Probably this would work:

disable_all_sprites();
sp_disabled(1, 0);

and to undo use enable_all_sprites();

DinkC Ref: "When disabled is 1, the sprite is not visible, cannot move, and its brain does not function. Any script that is attached to the sprite will still run, though, and the sprite can still be interacted with (default procedures like hit and talk will work fine)."

To remove them completely you'd have to get rid of each one seperately I suppose by using sp_active or something.

Edit: Some kind of loop? This might work, off the top of my head:

int &sp_num = 2;
loop:
sp_active(&sp_num, 0);
&sp_num += 1;
if (&sp_num < 250)
  goto loop;
December 5th 2009, 02:14 PM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
Hm, I'm using your timer in a bonus level. If you don't reach the goal in time, Dink will get teleported away and fail. Thing is if the timer goes to zero when he's near an enemy or a thorn he'll get a hp loss while teleporting to another screen. That's why I want all scripted sprites on the screen to go away.
December 5th 2009, 02:29 PM
dinkdead.gif
All scripted sprites? That loop will kill every sprite, scenery, houses etc. If you want just enemies to go then you can kill every sprite with brain 9 (or 10).

int &kill;
loop:
& kill = get_next_sprite_with_this_brain(9, 0, &kill);
if (&kill)
{
  sp_active(&kill, 0);
  &kill += 1;
  goto loop;
}


Or instead of killing them you could just make them unable to hurt Dink, turn touch damage and attacking off maybe.
December 5th 2009, 03:36 PM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
I want everything on the screen to get disabled/removed to keep Dink from harm while he teleports (he'll never visit the place again anyway). The loop kills enemies slowly, they won't hurt Dink while he's being teleported to another screen cuz they're gone. But if he stands near a darkland thorn and the timer drops to zero, he'll lose hp while being teleported. I could assign all thorns a brain of 9 but it still goes kinda slow to kill em all with the loop.
December 5th 2009, 04:25 PM
spike.gif
TGA
Peasant He/Him United States
"I Didn't do it!" - TGA 
Why dont you just use a vision change? in one vision have what you want turned on, and the next vision make them not there.... its simple if you do it that way, and use the same scean.
December 5th 2009, 04:45 PM
fairy.gif
GlennGlenn
Peasant He/Him Norway
GlennGlenn doesn't want a custom title. 
TGA, I don't think you can force a vision anymore with Dink 1.08, so that means Dink must leave the screen and come back.
December 5th 2009, 05:13 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
If Dink has to leave, then use a simple script to instantly warp him yo another screen (It doesn't matter, you player will never see it) then teleport back and use draw_screen() or whatever the command is, with a changed vision.
December 6th 2009, 08:22 AM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
'k, I solved it all, but what's the best way of disabling the timer when Dink has reached his goal, which is, another screen?
December 6th 2009, 11:10 AM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
Put something like this in the timer's loop.

if (&goal == 1)
kill_this_task();
December 6th 2009, 11:21 AM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
Great, now the timer disappears when Dink walks into the room.