The Dink Network

Screenlocking/Story

July 28th 2010, 03:58 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
I need a script that does this:

I need screenlocks for two different screens that dissapear after all the pills on one screen are dead. After all the pillbugs in the farm (two different screens) are dead, Dink says "That's all of them!" and then the next part of the story can progress, making it so a certain sprite says something different. How do I do this?
July 28th 2010, 04:15 PM
custom_iplaydink.gif
Iplaydink
Peasant He/Him Sweden
Hmm.. 
You need to use a global variable, add it when the pillbug dies and when it's equal to the number of pillbugs you make dink say something.
July 28th 2010, 04:16 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Alright. Lemme place the pillbugs. I need the scripts.

EDIT: Placed some invisible boxes that need the scripts.
July 28th 2010, 04:22 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Here's the script so far.
void main ( void )
{
screenlock()
say("Die!!" ,1);

July 28th 2010, 05:16 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
That is a waste of a global, there are commands for fnding out if there are any more monsters on the screens without variables. You can check if there are any sprites with a certain brain on screen and if there arn't, then you can unlock the screen.
July 28th 2010, 05:21 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Here's the script I attached to an invisible box in the corner of the map:
void main(void)
{
// Make this sprite invisible
sp_nodraw(&current_sprite,1);
// Screenlock the screen
screenlock(1);
say("dang pillbugs!" ,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);


The screenlock doesn't work.

EDIT: I'll attach this script to the pills. Maybe that'll work.
EDIT: Screenlocking pillbug script -
//screenlocking pill
//pillbug brain

void main( void )
{
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 1);
sp_exp(&current_sprite, 5);
sp_base_walk(&current_sprite, 130);
sp_base_death(&current_sprite, 140);
sp_touch_damage(&current_sprite, 1);
sp_hitpoints(&current_sprite, 8);
preload_seq(131);
preload_seq(133);
preload_seq(141);
preload_seq(143);
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);

if (random(2,1) == 1)
 {
 sp_target(&current_sprite, 1);
 }
}

void hit( void )
{
sp_target(&current_sprite, &enemy_sprite);
playsound(30, 21050, 4000, &current_sprite, 0);
//lock on to the guy who just hit us
//playsound
}
void die( void )
{
  int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 1); 

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);

 external("emake","small");

}



That doesn't work either.

EDIT: I was stupid again. I removed the obviously placed second "void main ( void ), and the invisible thingy. Now it screenlocks, but when all the pills die, it's still locked. \
EDIT: The invisi-boxes are gone now too. XD

July 28th 2010, 06:35 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
It's not working.
July 28th 2010, 06:46 PM
spike.gif
Put the screenlock check thingy into void death. Using a loop in the monster script isn't a really good way, the loop gets interrupted when the monster is hit/killed. Plus it doesn't work anyway because there is no goto loop; anywhere.

void die( void )
{
  int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 1); 

if (get_sprite_with_this_brain(9,&current_sprite) == 0)
{
if (get_sprite_with_this_brain(10,&current_sprite) == 0)
{
// Remove the screenlock
screenlock(0);
playsound(43, 22050,0,0,0);
}
}

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);

 external("emake","small");

}

July 28th 2010, 06:50 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Ok, that works, but it unlocks only after one dies. I need it to unlock after they ALL die.
July 28th 2010, 07:08 PM
spike.gif
A typo or a number at the beginning of the line perhaps?

The example I posted should work, and only unlock the screen after every brain 9 and every brain 10 monster is dead.
July 28th 2010, 07:09 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
This is what I have.
//screenlocking pill
//pillbug brain

void main( void )
{
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 1);
sp_exp(&current_sprite, 5);
sp_base_walk(&current_sprite, 130);
sp_base_death(&current_sprite, 140);
sp_touch_damage(&current_sprite, 1);
sp_hitpoints(&current_sprite, 8);
preload_seq(131);
preload_seq(133);
preload_seq(141);
preload_seq(143);
// 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)
{
if (random(2,1) == 1)
 {
 sp_target(&current_sprite, 1);
 }
}

void hit( void )
{
sp_target(&current_sprite, &enemy_sprite);
playsound(30, 21050, 4000, &current_sprite, 0);
//lock on to the guy who just hit us
//playsound
}
void die( void )
{
// Remove the screenlock
screenlock(0);
playsound(43, 22050,0,0,0);
int &hold = sp_editor_num(&current_sprite);
if (&hold != 0)
  editor_type(&hold, 1); 

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);

 external("emake","small");

}



Also, go to IRC so we can make this easier.

EDIT: Aha! got it. Now for the most important part of all - I need to do a story thingy. After both screens of pillies are dead, Dink needs to gain 50 attack and 20 def. Then two sprites need to say something different. How do I do this?
July 28th 2010, 07:14 PM
spike.gif
That's utterly ducked up. You should see that by yourself!

The monster only targets Dink if there are no monsters on the screen. (and coincidently there's no brain check in the die() procedure)
July 28th 2010, 07:15 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Aha! got it. Now for the most important part of all - I need to do a story thingy. After both screens of pillies are dead, Dink needs to gain 50 attack and 20 def. Then two sprites need to say something different. How do I do this?

EDIT: Oops, I just double posted this.
July 29th 2010, 12:24 AM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
Why suggest people go to the IRC chat to discuss it when you're banned from there too? AND cannot bypass that ban?
July 29th 2010, 01:06 AM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Because the people I tell to go to IRC I add to my friends list so I know there on. Then I can open a query with them. FreeNode doesn't just have #dinksmallwood ya know?
July 29th 2010, 02:39 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
Actually it has over 7000 channels Lots of yapping going on in there
July 29th 2010, 02:45 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Here's my next script:
void main ( void )
{
if (&story == 2)
&strength = 55
&defense = 25
say("Woah! I feel beefed up!" ,1);
&story = 3;
}

It's giving me those stats the moment I enter the screen instead of it only doing it when &story is "2". That kinda screws things up.
July 29th 2010, 02:47 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
void main ( void )
{
if (&story == 2)
{
&strength = 55;
&defense = 25;
say("Woah! I feel beefed up!" ,1);
&story = 3;
}
}


You have to use those { } to mark what's inside the "if" if it's longer then one line.
og and it still runs only when you enter the screen, put it with the other stuff that should happen when the pillbugs are dead. Or use an loop as bellow.
void main ( void )
{
loop:
if (&story == 2)
{
&strength = 55;
&defense = 25;
say("Woah! I feel beefed up!" ,1);
&story = 3;
}
wait(1000);
goto loop;
}



Maybe you should read a tutorial and learn something instead of making us script for you?
July 29th 2010, 03:18 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Heh, yeah. I do read a lot of tutorials, but they don't seem to help very much. I did learn a lot about talk, hit, push, and die procedures though. So I still do a lot of scripting. I'm still learning stuff you know? That's why we have a development thread choice.
July 29th 2010, 03:50 PM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Technically, it does work without the brackets in some cases. Don't know, sometimes it seems it does and sometimes not.
July 29th 2010, 04:09 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
This script will make dink say Goodbye the first time and both hello and goodbye the second time he interacts with the sprite:
void main(void)
{
int &blah = 0;
}

void talk(void)
{
freeze(1);
if(&blah == 1)
say_stop("Hello", 1);
say_stop("Goodbye ", 1);
&blah = 1;
unfreeze(1);
}

This however will say nothing the first time and both the second
void main(void)
{
int &blah = 0;
}
void talk(void)
{
freeze(1);
if(&blah == 1)
{
say_stop("Hello", 1);
say_stop("Goodbye ", 1);
}
&blah = 1;
unfreeze(1);
}


So, as I said, the bracklets are needed if you want to include more then one line in the 'if'.

@Skorn: We are all still learning stuff, but sometimes it's better to learn yourself, the problem with asking for help is that you might just copy the new script and paste it in your own without bothering to figure out what you did wrong. That way you learn nothing.
July 29th 2010, 05:30 PM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
Yeh, before posting help thingies I usually experiment quite a bit. I'm working on the next area now!

But I have another issue. Yeah, I ask for too much. Here's my problem.
&player_map = 304;
sp_x(1, 383);
sp_y(1, 318);


This is putting me on map 337 instead of 304. It also puts me in another spot. It's really messed up. I'm using this script as a teleport from Dink's resort to the mainland, but it won't work.

EDIT: Ok! That's weird. It puts me on 337 but if I move to another screen NOW I'm on 304 but on water!
July 29th 2010, 05:39 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
For scripted teleports, you need to load and draw the screen manually. And to avoid killing the script when changing screens, you need to script_attach(1000);

script_attach(1000);

&player_map = 304;
sp_x(1,383);
sp_y(1,318);

load_screen(304);
draw_screen();

// This is to actually stop the script, otherwise it stays loaded, and it'll eat resources.
kill_this_task();

July 30th 2010, 06:51 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
@IPlayDink

As I said, it seems to work sometimes and sometimes not. I copied this script from my old D-Mod, where I was too lazy to do crap like that:

void main( void )
{
if (&mrman > 1)
&story = 1;
freeze(1);
wait(400);
say_stop("Wait, what's going on here?", 1);
say("`4Dead to all!", &temp1hold);
unfreeze(1);
else
}


However, I recall, it backfired as I had to use the brackets in some cases, cause it suddenly wouldn't work.
July 30th 2010, 07:34 AM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
I don't think so. That scrip would set the story to 1 if &mrman is more then one then do the other stuff. If &mrman is not more then one it will do everything else but not set the story to two.

EDIT:
And if it did work it might be because you used an else.
July 30th 2010, 08:42 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Say what you say, it worked for me in that script. Not in another.
July 31st 2010, 02:03 AM
anon.gif
Absolution
Peasant They/Them
The Dark Lord of the DN. 
So I'm thinking about having an evil/good system. The ending you get depends on what your rating is. So, I already have some killabels sprites and everything's working perfectly.

Just one minor problems. I don't think you can add to a variable, can you? I tried, &evil = +1 or something like that. You should get what I mean. Like if I killed something, my evil ranking would go up one. I need to find out, is the Dink Engine work for that?

I'll check Bane of the Magi to see what they did.
July 31st 2010, 03:38 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Uh, yes you can. If you have a global called &evil you can just use &evil += 1; to count the amount of evil deeds the player did. I used a similar system in the past for both good and bad deeds.