The Dink Network

Help Needed With D-MOd!!!

November 14th 2009, 07:22 PM
duckdie.gif
legendg
Peasant He/Him Australia
Why Do I Need A Tagline? 
i was wondering if someone could write me some script(s) for my D-mod. Here Is What I Want to do...

run a script (were dink is talking) once all the pillbugs in a certain area are dead.

thats all, im not very good with c scripting and have very little experience.
all help would be much appreciated
November 14th 2009, 08:28 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
Do you want Dink to talk as soon as the pillbugs are all dead?

I can help with your script.
November 14th 2009, 09:02 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
Thats not difficult; Run a screenlocking script and add
freeze(1);
say_stop("That's the last of them, lets say something witty!", 1);
unfreeze(1);


Just add that to a screenlock'd enemy script so that it happens as soon as the screen unlocks and he'll say it when they're all dead. Oh, and edit the speech in the " " marks.
November 14th 2009, 09:34 PM
duckdie.gif
legendg
Peasant He/Him Australia
Why Do I Need A Tagline? 
but if you do that:

1.freeze(1);
2.say_stop("That's the last of them, lets say something witty!", 1);
3.unfreeze(1);

The Script Would Have To Be On The LAST Pillbug You Kill, And it's going to be different everytime depending on which way they go. :\ and it would be good if i could have it that dink looks around after killing the last one then comes to the conclusion that they are dead. but either way would still work. thanks
November 14th 2009, 09:39 PM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
You'd need to count the number of pillbugs that have died. So keep a variable and increment it each time a pillbug dies. When the number of dead pillbugs equals the number of pillbugs at the beginning, you can let Dink say something.
November 14th 2009, 10:08 PM
duckdie.gif
legendg
Peasant He/Him Australia
Why Do I Need A Tagline? 
Simeon - "You'd need to count the number of pillbugs that have died. So keep a variable and increment it each time a pillbug dies. When the number of dead pillbugs equals the number of pillbugs at the beginning, you can let Dink say something."

I Tried That, It Didn't Seem To Work. Could this be because im moving from screen to screen. if it is i'll need another way to do it :\
November 14th 2009, 10:10 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
Hang on, this would be easier.

void main(void)
{
 //lock the screen straight up when the player enters
 screenlock(1);

 //set the brain and speed of the pillbug
 sp_brain(&current_sprite, 9);
 sp_speed(&current_sprite, 1);

 //set the exp the player will receive when they kill it
 sp_exp(&current_sprite, 5);

 //set the base walk and base death
 sp_base_walk(&current_sprite, 130);
 sp_base_death(&current_sprite, 140);

 //set the touch damage of the pillbug
 sp_touch_damage(&current_sprite, 1);

 //set the hitpoints of the pillbug
 sp_hitpoints(&current_sprite, 8);

 //preload the pillbugs graphics
 preload_seq(131);
 preload_seq(133);
 preload_seq(141);
 preload_seq(143);

 //give a random chance of the pillbug locking onto the player straight up
 if (random(2,1) == 1)
 {
 sp_target(&current_sprite, 1);
 }
}

void hit(void)
{
 //This is the hit sequence, it is run when something hits me
 //Lock onto the dink that just hit the pillbug
 sp_target(&current_sprite, &enemy_sprite);

 //and play the pillbug sound
 playsound(30, 21050, 4000, &current_sprite, 0);
}

void die(void)
{
 //This is the die procedure, it is run when I die
 //let's check if there is any other brain 9 monsters left on the screen
 if (get_sprite_with_this_brain(9, &current_sprite) == 0)
 {
  //there isn't, so let's unlock the screen
  screenlock(0);

  //and play the unlock screen sound
  playsound(43, 22050,0,0,0);

  //Now if you want Dink to say something when the screen is unlocked, add it here
freeze(1);
say_stop("MAKE ME SAY SOMETHING!!", 1);
unfreeze(1);
 }

 //This make me appear back after 5 minutes, yay
 int &hold = sp_editor_num(&current_sprite);
 if (&hold != 0)
 editor_type(&hold, 6); 

 //this will randomly choose a small reward to appear, like a small heart
 &save_x = sp_x(&current_sprite, -1);
 &save_y = sp_y(&current_sprite, -1);
 external("emake","small");
}


You'd just need to have a second version of this script without the speech part in there if you wanted to use this to screenlock any other pillbug screens.
November 14th 2009, 10:13 PM
duckdie.gif
legendg
Peasant He/Him Australia
Why Do I Need A Tagline? 
Simeon - "You'd need to count the number of pillbugs that have died. So keep a variable and increment it each time a pillbug dies. When the number of dead pillbugs equals the number of pillbugs at the beginning, you can let Dink say something."

I Tried That, It Didn't Seem To Work. Could this be because im moving from screen to screen? if it is i'll need another way to do it :\
November 14th 2009, 10:14 PM
fish.gif
Simeon
Peasant He/Him Netherlands
Any fool can use a computer. Many do. 
Then you'd need to use a global variable for the counting. Or you could store it as a property of some sprite but that's a hack really.
November 14th 2009, 10:23 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
I see j00 tried to double post, 'cept I got in the way.
November 14th 2009, 11:47 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
There is no need to count the pillbugs - just use a screenlock script, dangit!
November 15th 2009, 01:03 AM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
"There is no need to count the pillbugs - just use a screenlock script, dangit!"
Reading over what legendg posted, it appears that he does not mean the pillbugs are just in one screen, but in an area that take up multiple screens. If this is the case, then yes, you do need to count the pillbugs.
Is this right, legendg?

If so, the easiest way is to make a global variable by adding it in main.c. For example:
make_global_int("&pillcount", 0);


Then in the pillbug's script, you would add this to the die procedure:
&pillcount += 1;

if (&pillcount == Numberofpills) 
{
 freeze(1);
 say_stop("Blah, blah, blah", 1);
 unfreeze(1);
}


Change 'Numberofpills' to the amount of pills at the beginning. And change the 'Blah, blah, blah', to whatever you actually want Dink to say and you're all set.
There is another way of doing it, but this is probably the easiest for a beginner to understand, I'd say.

If this isn't what you meant, then yeh, just use a screenlock and ignore this.

November 15th 2009, 05:15 AM
duckdie.gif
legendg
Peasant He/Him Australia
Why Do I Need A Tagline? 
Yes Robj you are correct, its on about 13 screens.
I am going to try your idea... thanks...

Edit: It Works Perfectly, Except For the Unfreeze. :\ But i think i can fix that. Thanks!!
November 15th 2009, 05:50 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Yeah, if you use a say_stop() command in a void die() procedure you kill the procedure, so the unfreeze command won't be executed. Easiest way to fix this is to change the die procedure into this:

&pillcount += 1;

if (&pillcount == Numberofpills) 
{
script_attach(0);
 freeze(1);
 say_stop("Blah, blah, blah", 1);
 unfreeze(1);
kill_this_task();
}

November 15th 2009, 05:58 AM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
"Yeah, if you use a say_stop() command in a void die() procedure you kill the procedure"

Oh yeh, I forgot about that lol.
November 15th 2009, 10:04 AM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
"Reading over what legendg posted, it appears that he does not mean the pillbugs are just in one screen, but in an area that take up multiple screens. If this is the case, then yes, you do need to count the pillbugs."

In this case, counting all screen unlocks is probably a bit more reliable as you can then add or remove pillbugs on the screen without still having to worry about the total number of pillbugs.
November 15th 2009, 12:43 PM
knights.gif
DinkKiller
Peasant He/Him United States
The world could always use more heroes 
if dink would only be saying one line, wouldn't it just be easier to not use freeze(1); and unfreeze(1);?
November 15th 2009, 03:05 PM
duckdie.gif
legendg
Peasant He/Him Australia
Why Do I Need A Tagline? 
"if dink would only be saying one line, wouldn't it just be easier to not use freeze(1); and unfreeze(1);?" -DinkKiller

Good idea, all im doing is saying one line and adding to +1 another global variable.
DaVince had a good idea with doing screens at a time, but this seems to be working fine for now