The Dink Network

Screenlocks

August 26th 2006, 03:31 PM
duck.gif
maacks
Peasant He/Him
 
How would you lock the screen until all monsters are cleared?
August 26th 2006, 06:44 PM
death.gif
void main(void)

{
// Make this sprite invisible
sp_nodraw(&current_sprite,1);

// Screenlock the screen
screenlock(1);

// Loop forever, until there aren't any sprites with brains 9 and 10 on the screen

loop:
wait(250);
if (get_sprite_with_this_brain(9, 0) == 0)
{
if (get_sprite_with_this_brain(10, 0) == 0)
{

// Remove the screenlock
screenlock(0);
playsound(43, 22050,0,0,0);

// Kill this sprite forever, so there aren't any more screenlocks! int &editor_sprite = sp_editor_num(&current_sprite);
if (&editor_sprite != 0)
{
editor_type(&editor_sprite, 1);
}
kill_this_task();
}
}
goto loop;

}

Try this; and attach it to a sprite that you do not want to be in the actual game... I use the giant duck statue...

The kill this sprite forever line is optional, and can be removed if you always want that screen to be screenlocked when there are enemies.
August 27th 2006, 08:46 AM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
Yes, the script is ok, but I think it's useless, because you can check for other monsters on the screen in a monster's die procedure. When a monster dies, if there aren't any other monsters, unlock the screen(check some monsters scripts from the source).
Anyway, if for some reasons you'll use this script, add
sp_nohit(&current_sprite,1);
after
sp_nodraw(&current_sprite,1);
or dink will be able to punch an invisible thing.
August 27th 2006, 03:15 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
But, then you have to have two copies of monster scripts when you want to have a screenlock. That's rather absurd.
August 27th 2006, 04:21 PM
sob_scorpy.gif
Tyrsis
Peasant She/Her Russia
 
Or you may change the "emake" script (the one that creates goodies when a monster dies) and always check if there are creatures with brain 9 or 10, screenlock or no screenlock.
Create a small (size1) unhittable sprite and give it brain 2 (not quite useful in a dmod) and attach a script that only does screenlock(1).
And if you want to lock the screen only once you check if the brain2 sprite exists on the screen and remove it in the same "emake" script when you do screenlock(0).
This way you don't need en extra script with a loop and no extra copies of monster scripts.