#import "data/scripts/aniScp.c"
#import "data/scripts/scr/gui.c"
//# i nclude "data/scripts/aniScp.c"
//# i nclude "data/scripts/scr/gui.c"
void main()
{
int vSelf;
if ( getlocalvar("self") ) { vSelf = getlocalvar("self"); }
if ( vSelf != NULL() && getentityproperty(vSelf, "exists") ) {
void target = getentityproperty(vSelf, "opponent");
if ( target != NULL() && getentityproperty(target, "exists")) {
void health = 0;
void aParent = getentityproperty(target, "parent");
int gold = 0;
int allplrhealth = 0;
int iChance = 0;
int spawned = -1;
int aentity = -1;
void rname = randomallhealthitems(1);
int P1 = -1;
int P2 = -1;
int P3 = -1;
int P4 = -1;
int aPointSys = 0;
int aPointSysMax = 0;
//////////////Default settings//////////////
if ( getentityproperty(vSelf, "maxhealth") ) { health = getentityproperty(vSelf, "maxhealth"); }
allplrhealth = gethealthpercentageforallplayers(1);
gold = health/10;
//////////////Get all players//////////////
if ( getplayerproperty(0, "entity") ) { P1 = getplayerproperty(0, "entity"); } //Get Player 1
if ( getplayerproperty(1, "entity") ) { P2 = getplayerproperty(1, "entity"); }//Get Player 2
if ( getplayerproperty(2, "entity") ) { P3 = getplayerproperty(2, "entity"); }//Get Player 3
if ( getplayerproperty(3, "entity") ) { P4 = getplayerproperty(3, "entity"); }//Get Player 4
//////////////Get player save settings//////////////
if ( target == P1 ) { aPointSysMax = getvMaxAPoint(0); }
if ( target == P2 ) { aPointSysMax = getvMaxAPoint(1); }
if ( target == P3 ) { aPointSysMax = getvMaxAPoint(2); }
if ( target == P4 ) { aPointSysMax = getvMaxAPoint(3); }
if ( aParent == P1 ) { aPointSysMax = getvMaxAPoint(0); }
if ( aParent == P2 ) { aPointSysMax = getvMaxAPoint(1); }
if ( aParent == P3 ) { aPointSysMax = getvMaxAPoint(2); }
if ( aParent == P4 ) { aPointSysMax = getvMaxAPoint(3); }
aPointSysMax = aPointSysMax + 31;
//////////////Add to All Player Special(A-Point)//////////////
if ( target == P1 ||
target == P2 ||
target == P3 ||
target == P4 )
{
if ( getentityvar(target, 2) != NULL() ) { aPointSys = getentityvar(target, 2); }
aPointSys++;
if ( aPointSys < aPointSysMax ) { setentityvar(target, 2,aPointSys); }
}
if ( getentityproperty(target, "parent") == P1 ||
getentityproperty(target, "parent") == P2 ||
getentityproperty(target, "parent") == P3 ||
getentityproperty(target, "parent") == P4 )
{
if ( getentityvar(getentityproperty(target, "parent"), 2) != NULL() ) { aPointSys = getentityvar(getentityproperty(target, "parent"), 2); }
aPointSys++;
if ( aPointSys < aPointSysMax ) { setentityvar(getentityproperty(target, "parent"), 2,aPointSys); }
}
if (target == P1 || getentityproperty(target, "parent") == P1 )
{ setvscore(0,getvscore(0)+gold); } else
if (target == P2 || getentityproperty(target, "parent") == P2 )
{ setvscore(1,getvscore(1)+gold); } else
if (target == P3 || getentityproperty(target, "parent") == P3)
{ setvscore(2,getvscore(2)+gold); } else
if (target == P4 || getentityproperty(target, "parent") == P4)
{ setvscore(3,getvscore(3)+gold); }
//log(" \n Death Spawn Name "+rname);
//////////Spawn Health Items//////////////
if (allplrhealth > 90)
{
iChance = rand()%100;
if (iChance > (95 - (health/30)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
} else
if (allplrhealth > 50)
{
iChance = rand()%100;
if (iChance > (47 - (health/30)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
} else
if (allplrhealth < 20)
{
iChance = rand()%100;
if (iChance > (2 - (health/30)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
} else {
iChance = rand()%100;
if (iChance > (87 - (health/30))) { spawned = spawnentity( rname,0,0,0,0 ); }
}
///////////Spawn Mana Items///////////////////
allplrhealth = getmppercentageforallplayers(1);
rname = randomallmpitems(1);
if (allplrhealth > 90)
{
iChance = rand()%100;
if (iChance > (94 - (health/30)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
} else
if (allplrhealth > 50)
{
iChance = rand()%100;
if (iChance > (60 - (health/30)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
} else
if (allplrhealth < 20)
{
iChance = rand()%100;
if (iChance > (27 - (health/30)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
} else {
iChance = rand()%100;
if (iChance > (87 - (health/30)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
}
/////////////Spawn Special Items//////////////////
rname = randomallmiscitems(1);
iChance = rand()%100;
if (iChance > (93 - (health/95)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
rname = randomallbasicitems(1);
/////////////Basic Items/////////////
iChance = rand()%100;
if (iChance > (77 - (health/60)) ) { spawned = spawnentity( rname,0,0,0,0 ); }
/////////////Gui Update/////////////
/*
if ( getentityproperty(target, "type") == openborconstant("TYPE_Player") )
{
dogui(target);
}
if ( getentityproperty( getentityproperty(target, "parent"), "type") == openborconstant("TYPE_Player") )
{
dogui( getentityproperty(target, "parent") );
}
*/
if ( target == P1 ||
target == P2 ||
target == P3 ||
target == P4 )
{ dogui(target); } else
if ( getentityproperty(target, "type") == openborconstant("TYPE_Player") )
if ( getentityproperty(target, "parent") == P1 ||
getentityproperty(target, "parent") == P2 ||
getentityproperty(target, "parent") == P3 ||
getentityproperty(target, "parent") == P4 )
{ dogui(getentityproperty(target, "parent")); }
}
}
//spawnentity( "as",0,0,0,0 );
//log(" Death 1");
}