Global Variable
Posted: Fri Nov 09, 2007 10:53 pm
I need to store a global variable that can be refrenced from all pawn scripts.
I have pawns that respawn. Each has its own script.
After each pawn is killed x number of times it is removed.
What I want is to count the number of times the pawns are killed, and if its more than the global variable, activate a trigger. I have searched the forum and ebook and manual with no luck.
I tried making a variable in player.ini
[dc]
initial = 0
low = 0
high = 10
And in each of the pawn scripts Death order I have
Death[()
{
//DelTimerOrder(1); // remove alert timer
//AddPainOrder("IdlePain", 0); // remove pain order
//FindTargetOrder(0, "FoundTarget", DAMAGEATTRIBUTE); // remove target finding
//DelTriggerOrder("IdleToAlert"); // remove alert trigger
//SetNoCollision(); // remove bounding box so there are no collisions with corpse
switch(random(1,4)) // chose between 4 death animations
{
case 1
{
AnimateStop(DIE, DIEHOLD, "");
}
case 2
{
AnimateStop(DIE1, DIEHOLD, "");
}
case 3
{
AnimateStop(DIE2, DIEHOLD, "");
}
case 4
{
AnimateStop(DIE, DIEHOLD, "");
}
}
PC=PC+1;
PlayerDistOrder(0,"");
FadeOut(DIEFADE,0);
switch(random(1,4)) // chose between 4 death animations
{
case 1
{
TeleportToPoint("p7",0,0,0);
NewPoint("p7");
RotateToAlign("idle",500,false,"");
}
case 2
{
TeleportToPoint("p5",0,0,0);
NewPoint("p5");
RotateToAlign("idle",500,false,"");
}
case 3
{
TeleportToPoint("p8",0,0,0);
NewPoint("p8");
RotateToAlign("idle",500,false,"");
}
case 4
{
TeleportToPoint("p9",0,0,0);
NewPoint("p9");
RotateToAlign("idle",500,false,"");
}
}
if(PC<1)
{
DC=DC+1;
FadeIn(DIEFADE,255);
AttributeOrder("enemy_health",20, "Death"); //eh 50, death
NewOrder("LostTarget");
}
else
{
LowLevel("trig");
}
}]
trig[()
{
if(DC > 2 )
{
ActivateTrigger("doortrig1");
}
HighLevel("Die1");
}]
Die1[()
{
Remove(true);
}]
Everything works fine except the global variable.
Ive tried several variations with no luck, any help os apriciated!!
I have pawns that respawn. Each has its own script.
After each pawn is killed x number of times it is removed.
What I want is to count the number of times the pawns are killed, and if its more than the global variable, activate a trigger. I have searched the forum and ebook and manual with no luck.
I tried making a variable in player.ini
[dc]
initial = 0
low = 0
high = 10
And in each of the pawn scripts Death order I have
Death[()
{
//DelTimerOrder(1); // remove alert timer
//AddPainOrder("IdlePain", 0); // remove pain order
//FindTargetOrder(0, "FoundTarget", DAMAGEATTRIBUTE); // remove target finding
//DelTriggerOrder("IdleToAlert"); // remove alert trigger
//SetNoCollision(); // remove bounding box so there are no collisions with corpse
switch(random(1,4)) // chose between 4 death animations
{
case 1
{
AnimateStop(DIE, DIEHOLD, "");
}
case 2
{
AnimateStop(DIE1, DIEHOLD, "");
}
case 3
{
AnimateStop(DIE2, DIEHOLD, "");
}
case 4
{
AnimateStop(DIE, DIEHOLD, "");
}
}
PC=PC+1;
PlayerDistOrder(0,"");
FadeOut(DIEFADE,0);
switch(random(1,4)) // chose between 4 death animations
{
case 1
{
TeleportToPoint("p7",0,0,0);
NewPoint("p7");
RotateToAlign("idle",500,false,"");
}
case 2
{
TeleportToPoint("p5",0,0,0);
NewPoint("p5");
RotateToAlign("idle",500,false,"");
}
case 3
{
TeleportToPoint("p8",0,0,0);
NewPoint("p8");
RotateToAlign("idle",500,false,"");
}
case 4
{
TeleportToPoint("p9",0,0,0);
NewPoint("p9");
RotateToAlign("idle",500,false,"");
}
}
if(PC<1)
{
DC=DC+1;
FadeIn(DIEFADE,255);
AttributeOrder("enemy_health",20, "Death"); //eh 50, death
NewOrder("LostTarget");
}
else
{
LowLevel("trig");
}
}]
trig[()
{
if(DC > 2 )
{
ActivateTrigger("doortrig1");
}
HighLevel("Die1");
}]
Die1[()
{
Remove(true);
}]
Everything works fine except the global variable.
Ive tried several variations with no luck, any help os apriciated!!