Help Needed With D-MOd!!!
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
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
![](/images/emoticons/smiley.gif)
Do you want Dink to talk as soon as the pillbugs are all dead?
I can help with your script.
I can help with your script.
Thats not difficult; Run a screenlocking script and add
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.
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.
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
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
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.
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 :\
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 :\
Hang on, this would be easier.
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.
void main(void) { //lock the screen straight up when the player enters screenlock(1); //set the brain and speed of the pillbug sp_brain(¤t_sprite, 9); sp_speed(¤t_sprite, 1); //set the exp the player will receive when they kill it sp_exp(¤t_sprite, 5); //set the base walk and base death sp_base_walk(¤t_sprite, 130); sp_base_death(¤t_sprite, 140); //set the touch damage of the pillbug sp_touch_damage(¤t_sprite, 1); //set the hitpoints of the pillbug sp_hitpoints(¤t_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(¤t_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(¤t_sprite, &enemy_sprite); //and play the pillbug sound playsound(30, 21050, 4000, ¤t_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, ¤t_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(¤t_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(¤t_sprite, -1); &save_y = sp_y(¤t_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.
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 :\
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 :\
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.
I see j00 tried to double post, 'cept I got in the way.
There is no need to count the pillbugs - just use a screenlock script, dangit!
"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:
Then in the pillbug's script, you would add this to the die procedure:
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.
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.
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!!
I am going to try your idea... thanks...
Edit: It Works Perfectly, Except For the Unfreeze. :\ But i think i can fix that. Thanks!!
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(); }
"Yeah, if you use a say_stop() command in a void die() procedure you kill the procedure"
Oh yeh, I forgot about that lol.
Oh yeh, I forgot about that lol.
![](/images/emoticons/cheeky.gif)
"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.
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.
if dink would only be saying one line, wouldn't it just be easier to not use freeze(1); and unfreeze(1);?
"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
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
![](/images/emoticons/smiley.gif)