So, here's the deal. Inspired by DonRevan and TeacherCreature's work, I decided to learn to code. I've read a book on C some time ago, so adjusting to the basic functions in War3Source was not EXTREMELY hard -- thanks to DonRevan's continuous help and support.
But he's not here right now and my first race is on the verge of completion
.So, tl;dr: here's the scoop.
Code:
public OnW3TakeDmgBulletPre( victim, attacker, Float:damage)
{
for(new client = 1; client <= MaxClients; client++)
{
new race = War3_GetRace(client);
if (bInUlti[client] = true && race == thisRaceID && IsPlayerAlive( client ) )
{
War3_DamageModPercent(2.0);
}
else if(bInUlti[client] = false && race == thisRaceID && IsPlayerAlive( client ) )
{
War3_DamageModPercent(1.0);
}
}
}
{
for(new client = 1; client <= MaxClients; client++)
{
new race = War3_GetRace(client);
if (bInUlti[client] = true && race == thisRaceID && IsPlayerAlive( client ) )
{
War3_DamageModPercent(2.0);
}
else if(bInUlti[client] = false && race == thisRaceID && IsPlayerAlive( client ) )
{
War3_DamageModPercent(1.0);
}
}
}
I declared the bool bInUlti[MAXPLAYERS] and I set it to true in the Ultimate.
I believe my intent is obvious:
The ultimate sets bInUlti to true, which then triggers double damage.
I've also created a Timer that sets bInUlti[client] to false after a certain time(dependent on the Ultimate level), which SHOULD then stop the double damage.
However, for some reason this doesn't work - I do not get receive the damage.
Can you see the fault in the code?
For additional reference, here's the other pieces of code..
Ultimate:
Code:
public OnUltimateCommand(client, race, bool:pressed)
{
if( race == thisRaceID && pressed && IsPlayerAlive( client ) )
{
new ulti=War3_GetSkillLevel( client, race, SKILL_ULT );
if( ulti > 0)
{
if( War3_SkillNotInCooldown( client, thisRaceID, SKILL_ULT, true ) )
{
bInUlti[client] = true;
War3_SetBuff( client,fMaxSpeed,thisRaceID, 1.65 );
CreateTimer(durationUlti[ulti], Timer_RemoveDamage, client);
CreateTimer(durationUlti[ulti], normal_speed, client);
PrintHintText( client, "You've been enhanced!");
War3_CooldownMGR(client,GetConVarFloat(ultCooldownCvar),thisRaceID,SKILL_ULT,true,true);
EmitSoundToAll( ultOn, client );
EmitSoundToAll( ultOn, client );
}
else
{
new cooldownUlti = War3_CooldownRemaining(client,thisRaceID,SKILL_ULT);
PrintHintText( client, "Enhancement failed You can enhance in %d seconds!", cooldownUlti );
}
}
else
{
PrintHintText( client, "You have not yet unlocked your Ultimate!");
}
}
}
{
if( race == thisRaceID && pressed && IsPlayerAlive( client ) )
{
new ulti=War3_GetSkillLevel( client, race, SKILL_ULT );
if( ulti > 0)
{
if( War3_SkillNotInCooldown( client, thisRaceID, SKILL_ULT, true ) )
{
bInUlti[client] = true;
War3_SetBuff( client,fMaxSpeed,thisRaceID, 1.65 );
CreateTimer(durationUlti[ulti], Timer_RemoveDamage, client);
CreateTimer(durationUlti[ulti], normal_speed, client);
PrintHintText( client, "You've been enhanced!");
War3_CooldownMGR(client,GetConVarFloat(ultCooldownCvar),thisRaceID,SKILL_ULT,true,true);
EmitSoundToAll( ultOn, client );
EmitSoundToAll( ultOn, client );
}
else
{
new cooldownUlti = War3_CooldownRemaining(client,thisRaceID,SKILL_ULT);
PrintHintText( client, "Enhancement failed You can enhance in %d seconds!", cooldownUlti );
}
}
else
{
PrintHintText( client, "You have not yet unlocked your Ultimate!");
}
}
}
Declaring the bool:
Code:
new bool:bInUlti[MAXPLAYERS];
The Timer:
Code:
public Action:Timer_RemoveDamage(Handle:timer,any:client)
{
if(client>0)
{
bInUlti[client]=false;
}
else
PrintToServer("Error when setting bInUlti[client] to false!.");
}
{
if(client>0)
{
bInUlti[client]=false;
}
else
PrintToServer("Error when setting bInUlti[client] to false!.");
}
Thanks a lot in advance,
Vulpone
PS: Remember, this is my first race and I'm not a professional - yet. I'll continue working hard on races and I'll try to contribute if I can
.






Logged



DarkEnergy