Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-02-2003, 03:55 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Baddy Bug

Hey, I was just making a script for having baddies drop random stuff, but it doesn't seem to work. I have tried killing the baddies multiple times to get out of the random situation, but it will not drop anything! Can anyone shed any light on this? Oh, and here's the script:
NPC Code:

if (playerenters) timeout = 0.05;
if (timeout) {
deadcheck();
timeout = 0.05;
}
function deadcheck() {
for (i=0;i<compuscount;i++) {
if (compus[i].mode==9) {
pi = random(0,100);
if (pi<10) lay2 greenrupee,compus[i].x,compus[i].y;
else if (pi<20) lay2 bluerupee,compus[i].x,compus[i].y;
else if (pi<30) lay2 heart,compus[i].x,compus[i].y;
}
}
}

__________________
Reply With Quote
  #2  
Old 11-02-2003, 04:05 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
first thing; pi is a built-in variable so don't try to assign a value to it
second; baddymode 9 is really hard to check, dunno why though
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #3  
Old 11-02-2003, 04:09 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Quote:
Originally posted by Dach
first thing; pi is a built-in variable so don't try to assign a value to it.
LOL. I forgot XD. You know, that's the exact reason why it wasn't working I think...(hehe... yoda talk...) I'll test it...
__________________
Reply With Quote
  #4  
Old 11-02-2003, 04:14 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
I don't beleive it... it still doesn't work! Hey, if Kai or someone could help me out here, that would be great. Here is the revised script:
NPC Code:

if (playerenters) timeout = 0.05;
if (timeout) {
deadcheck();
timeout = 0.05;
}
function deadcheck() {
for (i=0;i<compuscount;i++) {
if (compus[i].mode==9) {
it = random(0,100);
if (it<100) lay2 greenrupee,compus[i].x,compus[i].y;
else if (it<20) lay2 bluerupee,compus[i].x,compus[i].y;
else if (it<30) lay2 heart,compus[i].x,compus[i].y;
}
}
}

__________________
Reply With Quote
  #5  
Old 11-02-2003, 04:39 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
You're checking for mode 9...? Um... have you ever tried putting a timeout to display the baddy's mode? 5 is dying, not 9.
__________________
Kat
Reply With Quote
  #6  
Old 11-02-2003, 04:50 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Quote:
Originally posted by -Ramirez-
You're checking for mode 9...? 5 is dying, not 9.
Yes, I know, but 9 is dead, which is what I want because I want the item when or just before the baddy dies, and i mean JUST before. 5 is dying. I tried 5, but because of the timeout, it puts about 20 rupees/hearts out. The only reason why I did timeout was because I wanted it to check if a baddy had died repeatedy. If I didn't, it would check once, when you start playing, and that would be impossible. Oh, and a side question... are baddy modes read-only?
__________________
Reply With Quote
  #7  
Old 11-02-2003, 05:19 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by Idrox0

Yes, I know, but 9 is dead, which is what I want because I want the item when or just before the baddy dies, and i mean JUST before. 5 is dying. I tried 5, but because of the timeout, it puts about 20 rupees/hearts out. The only reason why I did timeout was because I wanted it to check if a baddy had died repeatedy. If I didn't, it would check once, when you start playing, and that would be impossible. Oh, and a side question... are baddy modes read-only?
Have you done what I mentioned? A timeout constantly displaying a baddy's mode reveals there IS no 9. And from my experiments with compus[].mode, it appears to be able to be modified, but it usually has weird effects, or simply stops the baddy's movement altogether.
__________________
Kat
Reply With Quote
  #8  
Old 11-02-2003, 06:06 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
you can get around that multiple drop situation when checking for 5 quite simply
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #9  
Old 11-02-2003, 07:35 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Quote:
Originally posted by -Ramirez-

Have you done what I mentioned? A timeout constantly displaying a baddy's mode reveals there IS no 9. And from my experiments with compus[].mode, it appears to be able to be modified, but it usually has weird effects, or simply stops the baddy's movement altogether.
Yes, I did try what you mentioned... and it stayed at 0 for some wierd reason... I'll try it again tonight.
__________________
Reply With Quote
  #10  
Old 11-02-2003, 07:59 AM
Idrox0 Idrox0 is offline
Registered User
Join Date: Oct 2003
Posts: 66
Idrox0 is on a distinguished road
Ah, I made a mistake in my script. Instead of putting 'message Baddy mode is #v(compus[0].mode).;' I put 'message Baddy mode is #v(compus[0].0).;' by accident. And you're right, there doesn't seem to be a 9 in there. Oh, and while expirementing, I did this script:
NPC Code:

function reborn() for (i=0;i<compuscount;i++) if (compus[i].mode==5) compus[i].mode = 0;


Just one long line of code. Can anyone guess what it does? (It's pretty easy)
__________________
Reply With Quote
  #11  
Old 11-02-2003, 11:34 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
I wouldn't call it a guess, but it makes the baddies into zombies (their hearts still go down, but they never die)
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.