O Ilusionista
Captain 100K
Guys, I am having a strange issue with globalvar and I need help.
As far as I remember, globalvars ARE persistent, right?
But I am facing a stranger behaviour: the globalvar get nullified out of the blue and I don't know WHY.
Let me explain how it works:
Emma Frost uses a "attack8" box, to trigger PAIN8.
At PAIN8 animation (triggers the MindControl)
Works fine. It will only trigger the MindControl if there is no other enemy being controlled (or I could control the entire game).
At IDLE animation (checks if MindControl is still active, if not, change to Follow 10)
The code above checks if the the globalvar was nullified and it the enemy is now an NPC.
It woks fine and change the enemy to FOLLOW10 if not
At FOLLOW10 animation (disable MindControl)
At dizzyfx header
And its IDLE
But someway the globalvar gets nullified out of the blue. I have a debug function to track its value and I can confirm when it got nullified.
Plus, the dizzyfx is not lasting until the global var is nullified.
What I am doing wrong? or its a bug?
As far as I remember, globalvars ARE persistent, right?
But I am facing a stranger behaviour: the globalvar get nullified out of the blue and I don't know WHY.
Let me explain how it works:
Emma Frost uses a "attack8" box, to trigger PAIN8.
At PAIN8 animation (triggers the MindControl)
Code:
@script
if(frame==1){
void self = getlocalvar("self");
int MindControl = getglobalvar("MindControl");
if (MindControl==NULL()) {
changeentityproperty(self, "hostile", "TYPE_ENEMY");
changeentityproperty(self, "type", openborconstant("TYPE_NPC"));
changeentityproperty(self, "candamage", "TYPE_ENEMY");
setglobalvar("MindControl", 1);
spawner("dizzyfx", 0, 55, 1);
}
}
@end_script
Works fine. It will only trigger the MindControl if there is no other enemy being controlled (or I could control the entire game).
At IDLE animation (checks if MindControl is still active, if not, change to Follow 10)
Code:
@script
void self = getlocalvar("self");
int MindControl = getglobalvar("MindControl");
int Type = getentityproperty(self, "type");
if(frame==1 && MindControl==NULL() && Type==openborconstant("TYPE_NPC")){
performattack(self,openborconstant("ANI_FOLLOW10"));
}
@end_script
The code above checks if the the globalvar was nullified and it the enemy is now an NPC.
It woks fine and change the enemy to FOLLOW10 if not
At FOLLOW10 animation (disable MindControl)
Code:
@script
if(frame==1){
void self = getlocalvar("self");
changeentityproperty(self, "hostile", "TYPE_PLAYER");
changeentityproperty(self, "type", openborconstant("TYPE_ENEMY"));
changeentityproperty(self, "candamage", "TYPE_PLAYER");
setglobalvar("MindControl", NULL());
}
@end_script
At dizzyfx header
name dizzyfx
type none
shadow 0
Antigravity 100
palette none
script @script
void main()
{
void self = getlocalvar("self");
void parent = getentityproperty(self, "parent");
int MindControl = getglobalvar("MindControl");
if(parent!=NULL()){
float x = getentityproperty(parent, "x");
float z = getentityproperty(parent, "z");
float a = getentityproperty(parent, "a");
changeentityproperty(self, "position", x, z+1, a+55);
}
if (MindControl==NULL())
{ killentity(self);
}
}
@end_script
And its IDLE
anim idle
loop
1
delay
4
offset
20 11
frame
data/chars/misc/dizzyfx/1.gif
frame
data/chars/misc/dizzyfx/2.gif
frame
data/chars/misc/dizzyfx/3.gif
frame
data/chars/misc/dizzyfx/4.gif
frame
data/chars/misc/dizzyfx/1.gif
frame
data/chars/misc/dizzyfx/2.gif
frame
data/chars/misc/dizzyfx/3.gif
frame
data/chars/misc/dizzyfx/4.gif
But someway the globalvar gets nullified out of the blue. I have a debug function to track its value and I can confirm when it got nullified.
Plus, the dizzyfx is not lasting until the global var is nullified.
What I am doing wrong? or its a bug?