Example of how the code has changed:
Original global var deceleration:
Code:
new thisRaceID;
new SKILL_IMPALE,SKILL_SPIKE,SKILL_BEETLES,ULT_LOCUST;
//Increase length from 5 to 6
//skill 1
//Impale
new Float:ImpaleChanceArr[]={0.0,0.1,0.16,0.22,0.26,0.33};
//skill 2
//Spiked Carapace
//new Float:SpikeDamageRecieve[]={1.0,0.95,0.9,0.85,0.8,0.75};
//new Float:SpikeArmorGainArr[]={0.0,0.0,0.0,0.0,0.0,0.0};
new Float:SpikeChanceArr[]={0.0,0.2,0.25,0.3,0.35,0.4};
new Float:SpikeReturnDmgArr[]={0.0,0.1,0.13,0.15,0.17,0.2};
new ArmorArr[]={0,110,130,160,180,200};
//skill 3
//Carrion Beetles
new BeetleDamageArr[]={0,5,7,9,12,15};
new Float:BeetleChanceArr[]={0.0,0.2,0.25,0.28,0.3,0.33};
//ultimate
//Locust Swarm
new Handle:ultCooldownCvar;
new Handle:ultRangeCvar;
new const LocustDamage=25;
new const LocustMaxHealth=150;
new RemoveArmorArr[]={0,10,15,20,25,30};
new String:ultimateSound[]="war3source/locustswarmloop.wav";
New decelerations:
Code:
new thisRaceID;
new SKILL_ONE, SKILL_TWO, SKILL_THREE, ULT;
const RaceLevels = 5;
//Impale
new skill_level_one[MAXPLAYERSCUSTOM+1];
public Float:ImpaleChance(currentLevel)
{
return AbilityValue(0.1, 0.33, RaceLevels, currentLevel);
}
//Spiked Carapace
new skill_level_two[MAXPLAYERSCUSTOM+1];
public ArmorAmt(currentLevel)
{
return RoundFloat(AbilityValue(110.0, 200.0, RaceLevels, currentLevel));
}
public Float:SpikeChance(currentLevel)
{
return AbilityValue(0.2, 0.4, RaceLevels, currentLevel);
}
public Float:SpikePercent(currentLevel)
{
return AbilityValue(0.1, 0.2, RaceLevels, currentLevel);
}
//Carrion Beetles
new skill_level_three[MAXPLAYERSCUSTOM+1];
public Float:BeetlesChance(currentLevel)
{
return AbilityValue(0.2, 0.33, RaceLevels, currentLevel);
}
public BeetlesDmg(currentLevel)
{
return RoundFloat(AbilityValue(5.0, 15.0, RaceLevels, currentLevel));
}
//Locust Swarm
new skill_level_ult[MAXPLAYERSCUSTOM+1];
public ArmorSteal(currentLevel)
{
return RoundFloat(AbilityValue(10.0, 30.0, RaceLevels, currentLevel));
}
new String:ultimateSound[]="war3source/locustswarmloop.wav";
You can see here how the new methodology allows for easier customization of the ability values and simple adjustment to the races total levels. This makes it so that the race can have abilities and level requirements easily changed in a few seconds. It also reduces memory usage by lowering the number of global arrays required. Instead the resultant values are calculated on demand which does take more cpu but we are talking about basic math here. Likewise the memory savings are not really all that great anyways but this does fully prevent indexing errors by making them literally impossible due to the reduced reliance of arrays. Lastly the ability names have been standardized as to reduce development time.