Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Baddy Bug (https://forums.graalonline.com/forums/showthread.php?t=48942)

Idrox0 11-02-2003 03:55 AM

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;
}
}
}


Dach 11-02-2003 04:05 AM

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

Idrox0 11-02-2003 04:09 AM

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...

Idrox0 11-02-2003 04:14 AM

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;
}
}
}


-Ramirez- 11-02-2003 04:39 AM

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.

Idrox0 11-02-2003 04:50 AM

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?

-Ramirez- 11-02-2003 05:19 AM

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.

Dach 11-02-2003 06:06 AM

you can get around that multiple drop situation when checking for 5 quite simply

Idrox0 11-02-2003 07:35 AM

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.

Idrox0 11-02-2003 07:59 AM

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:D. Can anyone guess what it does? (It's pretty easy)

Dach 11-02-2003 11:34 AM

I wouldn't call it a guess, but it makes the baddies into zombies (their hearts still go down, but they never die)


All times are GMT +2. The time now is 11:13 PM.

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