Screenlocking/Story
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?
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?
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.
Alright. Lemme place the pillbugs. I need the scripts.
EDIT: Placed some invisible boxes that need the scripts.
EDIT: Placed some invisible boxes that need the scripts.
Here's the script so far.
void main ( void ) { screenlock() say("Die!!" ,1);
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.
Here's the script I attached to an invisible box in the corner of the map:
The screenlock doesn't work.
EDIT: I'll attach this script to the pills. Maybe that'll work.
EDIT: Screenlocking pillbug script -
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
void main(void) { // Make this sprite invisible sp_nodraw(¤t_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(¤t_sprite, 9); sp_speed(¤t_sprite, 1); sp_exp(¤t_sprite, 5); sp_base_walk(¤t_sprite, 130); sp_base_death(¤t_sprite, 140); sp_touch_damage(¤t_sprite, 1); sp_hitpoints(¤t_sprite, 8); preload_seq(131); preload_seq(133); preload_seq(141); preload_seq(143); void main(void) { // Make this sprite invisible sp_nodraw(¤t_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(¤t_sprite, 1); } } void hit( void ) { sp_target(¤t_sprite, &enemy_sprite); playsound(30, 21050, 4000, ¤t_sprite, 0); //lock on to the guy who just hit us //playsound } void die( void ) { int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 1); &save_x = sp_x(¤t_sprite, -1); &save_y = sp_y(¤t_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
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(¤t_sprite); if (&hold != 0) editor_type(&hold, 1); if (get_sprite_with_this_brain(9,¤t_sprite) == 0) { if (get_sprite_with_this_brain(10,¤t_sprite) == 0) { // Remove the screenlock screenlock(0); playsound(43, 22050,0,0,0); } } &save_x = sp_x(¤t_sprite, -1); &save_y = sp_y(¤t_sprite, -1); external("emake","small"); }
Ok, that works, but it unlocks only after one dies. I need it to unlock after they ALL die.
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.
The example I posted should work, and only unlock the screen after every brain 9 and every brain 10 monster is dead.
This is what I have.
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?
//screenlocking pill //pillbug brain void main( void ) { sp_brain(¤t_sprite, 9); sp_speed(¤t_sprite, 1); sp_exp(¤t_sprite, 5); sp_base_walk(¤t_sprite, 130); sp_base_death(¤t_sprite, 140); sp_touch_damage(¤t_sprite, 1); sp_hitpoints(¤t_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(¤t_sprite, 1); } } void hit( void ) { sp_target(¤t_sprite, &enemy_sprite); playsound(30, 21050, 4000, ¤t_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(¤t_sprite); if (&hold != 0) editor_type(&hold, 1); &save_x = sp_x(¤t_sprite, -1); &save_y = sp_y(¤t_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?
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)
The monster only targets Dink if there are no monsters on the screen. (and coincidently there's no brain check in the die() procedure)
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.
EDIT: Oops, I just double posted this.
Why suggest people go to the IRC chat to discuss it when you're banned from there too? AND cannot bypass that ban?
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?
Actually it has over 7000 channels Lots of yapping going on in there
Here's my next script:
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.
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.
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?
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.
Technically, it does work without the brackets in some cases. Don't know, sometimes it seems it does and sometimes not.
This script will make dink say Goodbye the first time and both hello and goodbye the second time he interacts with the sprite:
This however will say nothing the first time and both the second
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.
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.
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.
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!
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!
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();
@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:
However, I recall, it backfired as I had to use the brackets in some cases, cause it suddenly wouldn't work.
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.
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.
EDIT:
And if it did work it might be because you used an else.
Say what you say, it worked for me in that script. Not in another.
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.
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.
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.