PDA

View Full Version : Help with NPC script.



Archangel
04-16-2009, 11:07 PM
ffc script Gibdo2{
void run(){
npc Shadow = Screen->LoadNPC(1);
npc Gibdo = Screen->LoadNPC(2);
while(????){
Shadow->X = Gibdo->X + 32;
Shadow->Y = Gibdo->Y;
Waitframe();
}
}
}

Basically it compiles find if I put true in it. But I want it to loop only if the Gibdo is still alive.
The problem is that when I use Bool isValid method, I can't get it to work. This is what I'm using.

While(bool Gibdo->isValid){

Note: If you have ever played Land Stalker, this gibdo is suppose to function as an exact duplicate of the mummy from the crypt with the 8 puzzles.

EDIT: Okay, so I compiled it, and it works find. The only problem is that the Gibdo warps to combo 2 on the grid meaning the script is continuing. When all is said and done slaying the shadow kills the Gibdo using the ring leader function.

pkmnfrk
04-17-2009, 02:35 AM
Though you seem to have solved the compilation problem, a quick note of reference:

The bool or int or whatever in front of a ZScript function in the manual is there to indicate its type. You don't include it in the script!

As for the second problem, I'm not sure what you mean by "The Gibdo warps to combo 2 on the grid".

Do you mean that the FFC (or, rather, the shadow?) is moving to the upper-left corner of the screen when the gibdo dies?

I think this is what you need:


ffc script Gibdo2{
void run(){
npc Shadow = Screen->LoadNPC(1);
npc Gibdo = Screen->LoadNPC(2);
while(Shadow->isValid() && Gibdo->isValid()){
Shadow->X = Gibdo->X + 32;
Shadow->Y = Gibdo->Y;
Waitframe();
}
//if we get here, one of the monsters have died
//so, let's kill the one that didn't!
if(Gibdo->isValid()) Gibdo->HP = 0;
if(Shadow->isValid()) Shadow->HP = 0;
}
}

Archangel
04-17-2009, 09:15 AM
Actually, the gibdo is invincible. The shadow is it's weak spot.
Therefore, when you kill the shadow the gibdo moves to combo 2 on the grid or rather position (32,0)

pkmnfrk
04-17-2009, 09:34 AM
Oh, I see what's going on... Hmm, I think this might be a bug.

I bet that when the shadow dies, the gibdo moves up in the enemy list to take spot #1. The "Shadow" pointer, which was pointing at spot #1 now points at the gibdo in that spot.

Although, that said, my version of the script *should* kill both if either one dies...

Archangel
04-17-2009, 09:41 AM
Which would be awesome because that would mean I could add bubbles or something.

Also, a modified version of this script might just work to allow me to further manipulate bosses won't it. Oh god, now we can have some fun. Patras on Crack? :scared:

Archangel
04-17-2009, 09:58 AM
Damn it, now it doesn't follow the Gibdo, let's try your script then.

EDIT: Sorry for the double post, Tried you script, same behavior. It just sits there doing nothing anyways. I'm going to set it to true and just use ring leader and it can run if it's dead