End of Sprites
Any way of disabling and removing all sprites (except Dink) on screen instantly? (in the scriptly way)
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:
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;
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.
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).
Or instead of killing them you could just make them unable to hurt Dink, turn touch damage and attacking off maybe.
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.
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.
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.
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.
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.
'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?
Put something like this in the timer's loop.
if (&goal == 1) kill_this_task();