Prowler Productions
  Dink Smallwood Forum
  Scripting Help about things happening

Post New Topic  
profile | register | faq

Author Topic:   Scripting Help about things happening
Gerben posted 08-02- 06:38 AM CT (US)   Click Here to See the Profile for Gerben   Click Here to Email Gerben  
I was wondering.

Say I have a goblin in my screen. And A NPC sprite. Now I want the NPC to say something when I have killed the goblin. I know how to do it. But is there some other way to do it then making the goblin create the NPC sprite and adding the say command to the die script of the goblin? And I do not want to use different vision settings.

I am just wondering if it can be done, thanks.

Also is there a list available with all the different playsound sounds? I could just try them all, but that would take a while.

dark wolf shadow hunter posted 08-02- 11:33 AM CT (US)     Click Here to See the Profile for dark wolf shadow hunter  Click Here to Email dark wolf shadow hunter     
ok im not that great with scripting but im sure it can be done... im sure it's simular to screen lock becuase it removes it when everything's dead... so the only thing I can tell you is to study the screenlock and see how it's done.....
Ibis posted 08-02- 08:09 PM CT (US)     Click Here to See the Profile for Ibis  Click Here to Email Ibis     
Couldn,t you use make_global_int or something? I donīt know if I can help you but thatīs the only thing I could come up with, or maybe
void main( void )
{
int &talker;
&talker = 0;
}
check "s4-st3p.c" and/or "s4-st1p.c"
joshriot posted 08-02- 08:34 PM CT (US)     Click Here to See the Profile for joshriot  Click Here to Email joshriot     
you could give the sprite that you want to talk somthing like if &goblindead==1 then say"blah blah" and then put &goblindead=1 in the goblins void die crap. you could even make the sprite say somthing different before and after the goblin is dead like if &g=0 say"i love this goblin" then you kill the goblin and &g=1 the sprite says "go to hell you little bastard!"
Gerben posted 08-03- 01:52 AM CT (US)     Click Here to See the Profile for Gerben  Click Here to Email Gerben     
Ah yes, all very well. But the basic problem is that I need some way of making some sort of loop that keeps checking a certain variable. Die (void) is run when the sprite is killed, so that is how you do things.

So I don't want to trigger an effect because a new scripting part is being run. I want to trigger an effect because an already running script notices a change and acts accordingly. Is this possible ?

This is what I mean, but this does not work, because the game stops all other scripts until this script is finished!

Loop:
If (&goblin == 1)
{
Say("You have killed the goblin!", &NPC);
}
goto loop;

joshriot posted 08-03- 08:39 AM CT (US)     Click Here to See the Profile for joshriot  Click Here to Email joshriot     
i dont really get what you want to do, you want the npc to keep repeating what he says or you want the same thing to happen if you walk off the screen and come back to do it again. if you want to be able to do it again put &goblin == 0 after the guy says "you killed the goblin" if thats not what you are trying to do i dont know what to say.
joshriot posted 08-03- 08:40 AM CT (US)     Click Here to See the Profile for joshriot  Click Here to Email joshriot     
oh and they playsond sounds, start.c contains all of the sounds and theyr numbers
Gerben posted 08-04- 02:20 AM CT (US)     Click Here to See the Profile for Gerben  Click Here to Email Gerben     
Thanks :-)

I guess it can't be done. Since you guys couldn't come up with anything....

Nexis posted 08-04- 03:16 AM CT (US)     Click Here to See the Profile for Nexis  Click Here to Email Nexis     
Well you have the right idea, you just need a little hint to make the game not lock up in the loop you created. Basically the problem is that you have no wait anywhere in the infinite loop and this causes dink to freeze.

So just do something like this instead:

Loop:
if (&goblin == 1)
{
Say("You have killed the goblin!", &NPC);
}
wait(200);
goto Loop;

redink1 posted 08-04- 08:39 AM CT (US)     Click Here to See the Profile for redink1  Click Here to Email redink1     
Better way (so the NPC doesn't say the thing forever):

loop:
if (&goblin == 1)
{
Say("U smash goblin goood!", &NPC);
goto endloop;
}
wait(200);
goto loop;
endloop:

Nexis posted 08-05- 02:33 AM CT (US)     Click Here to See the Profile for Nexis  Click Here to Email Nexis     
lol...what's wrong with repeating the same thing forever. :)

Actually, though, I'd use an else or an if statement instead of another goto statement (they're considered bad programming in almost all languages) to exit the loop.

Funny thing is though, I don't think I used a single else statement in my dmod. I didn't trust much in the dink language and I usually ended up testing most functions before using them. Never got around to testing the else statement.

loop:
wait(200);
if (&goblin == 1)
{
Say("U smash goblin goood!", &NPC);
}
else
goto loop;

Gerben posted 08-07- 04:22 AM CT (US)     Click Here to See the Profile for Gerben  Click Here to Email Gerben     
Ah thanks guys! That thing about putting a wait inside the loop really helped me out. I was able to do everything I wanted before I heard about it, but sometimes my scripting got to become so extensive that I started suspecting that Seth added another way do do it, which you guys pointed out to me.

By the way. I have used the else option very often in my scripting and it works really well. So don't hesitate on using it.

golasido posted 08-11- 03:31 PM CT (US)     Click Here to See the Profile for golasido  Click Here to Email golasido     
Someone click on the "Someone HELP ME!" topic!
FF4LIFE posted 08-12- 09:59 PM CT (US)     Click Here to See the Profile for FF4LIFE  Click Here to Email FF4LIFE     
Wow.

I just read that and you guys are brilliant.
An easy way you could have done that that i use is under the void die just know what sprite number the NPC is, such as:

void die(void)
{
int &NPC = sp(17);
say("Wow, you killed it!", NPC);
}

thats all you needed to do....
and what is this else and whatever you said? I would like to know....

Gerben posted 08-13- 05:01 AM CT (US)     Click Here to See the Profile for Gerben  Click Here to Email Gerben     
That works as well, but now you tell me how to find out what the sprite number is.

An else statement is combined with a if statement.

I can do this:

If (&goblin == 0)
{
say("You killed the Goblin!", &sprite);
return;
}
say("You did not kill the Goblin", &sprite);

This makes th sprite tell you if you have killed the goblin or not. But it is more elegant to use the If... else... statement.

Like this:

If (&goblin == 0)
{
say("You killed the Goblin!", &sprite);
}
else
{
say("You did not kill the Goblin", &sprite);
}

This just works better in a lot of cases.

FF4LIFE posted 08-13- 09:06 PM CT (US)     Click Here to See the Profile for FF4LIFE  Click Here to Email FF4LIFE     
Its quite easy to find out what number a sprite is. In edit, pick it up and put it down. In the text it will say what sprite number it is. If there is no text I think you hit Z to make it appear.
Gerben posted 08-14- 04:03 AM CT (US)     Click Here to See the Profile for Gerben  Click Here to Email Gerben     
Mmmm, I think that it isnīt always the same number. That is the problem..... It might be an error or something.
FF4LIFE posted 08-14- 11:13 PM CT (US)     Click Here to See the Profile for FF4LIFE  Click Here to Email FF4LIFE     
Yeah, it does that to me sometimes too. Just drop it, remember the number and use it. If you don't mess with it it helps =)

Post New Topic  Post Reply
Hop to:


Contact Us | Prowler Productions

Powered by: Ultimate Bulletin Board, Freeware Version 5.10a
Purchase our Licensed Version- which adds many more features!
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.