Prowler Productions
  Dink Smallwood Forum
  Monitor Scripts

Post New Topic  
profile | register | faq

Author Topic:   Monitor Scripts
Darius Wolfe posted 09-19- 06:33 AM CT (US)   Click Here to See the Profile for Darius Wolfe   Click Here to Email Darius Wolfe  
I've looked through all of the messages for the past year, several tutorials, and the FAQ and I have not found anything which answers my question.

What I need is a Base Script which will monitor what dink does. Say.. If he talks to anyone or anything, or hits anyone or thing on the screen, the Base script will detect it, and perform a certain function.

What I'm hoping for is a way to do this with one base script attached to the screen, without having to attach one to each sprite in the room.

In case I was not clear enough, I'll explain it a bit more exactly...
If Dink hits ANY object on the screen, I want the Base Script to detect this, and put the guards on alert.

Thanks.

Drakeman posted 09-19- 08:56 AM CT (US)     Click Here to See the Profile for Drakeman  Click Here to Email Drakeman     
hmmm...

To detect if an object is hit is usually done in the void hit(void) procedure of the script attached to the particular object.

You could use a global variable in this procedure and change it's status from 0 to 1 in the object's script. Then in the screen script (which is looped in the main procedure, or uses callback function - can't remember which is best) you check for change in global variable with an if statement. If Change then fire off next script.

But considering that you want guards to enter if Dink starts breaking things up (I hope I'm right here) won't where they come from be influenced by what's one the screen?

I did something similar for SOB in the first story in which if Dink starts talking to people without singing, guards appear. But I worked a basic procedure out and then copied it to the script for each character or object that was central to that particular screen.

Hope this rambling helps...

Darius Wolfe posted 09-19- 02:14 PM CT (US)     Click Here to See the Profile for Darius Wolfe  Click Here to Email Darius Wolfe     
I'd already figured that part out, I was just hoping there was an alternate way than to put a script into every item on the affected screens. I've already got the callguard script started, I'm just hoping there's a way to detect if Dink hits an object without actually having a script on that object.
Also, another problem I've come across... Is there a way to check if Dink is carrying a weapon? And if so, what would be the command to disarm the weapon, but not to drop it from his inventory?
Thanks again.
FF4LIFE posted 09-19- 10:42 PM CT (US)     Click Here to See the Profile for FF4LIFE  Click Here to Email FF4LIFE     
If you want something to detect if its been hit, it needs to be in the void(hit) of that sprites script. Its not so bad, just attach the same script to every sprite, on that says if hit, spawn this script. If you did not know of spawning...basicaly, put this on everything you'll be hitting:

void hit(void)
{
spawn("GAURDSCRIPT");
}

Then make a script where the gaurds come, its that easy.

About checking if he has a weapon out...do you want that to not include fist? Because the fist is usualy the first box, so you can check if he's got it equiped with the &cur_weapon command. Basicaly to see if he's got the fists attached:

if (&cur_weapon == 1)
{
fists attached
}
if (&cur_weapon != 1)
{
something else
}

if you want him to equip the fists if he hasn't, just add this:
&cur_weapon = 1;
arm_weapon();
&update_status = 1;
draw_status();

i think you need the draw_status and update_status....oh well, thats basicaly it. Another way to check exactly what he's got equiped is checking the script of it, not the number. This is useful to see if he's got a sword out or a bow or maybe just a potion. Use the compare weapon command like so:


int &check = compare_weapon("item-fst");
if (&check == 1)
{
using fist
}
if (&check == 0)
{
not
}

and if thats not good enough, you can just do a check of every item he could have up to the game, and maybe do something different for each one.

the second meathod is better for checking what he's using, and the first allows you to equip something spacific. there's also a command to count your items of a certain kind, can't remember right now, ask if you need to know, its in most shop scripts too. Combined these meathods really allow you to do a lot.


Hope that really long rant helps!
FF4LIFE
BobHog
Will M!
OkalyDDude

PS, now that i'm back into the groove of school a bit, i plan on taking my dmod back up soon, so look for the re-release of Okaly-D Dink Demo soon with a lot of cool spiffy stuff that you can steal!

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.