Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2016-08-04 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog

Author Topic: Can't change ultimate cooldown  (Read 219 times)

plock

  • Newbie
  • *
  • Posts: 4
    • View Profile
Can't change ultimate cooldown
« on: February 18, 2016, 11:41:51 AM »
Hello,

I tried to create my own race based on the default ones that come. Successfully I was able to do so, but unfortunately I tried to change the ultimate cooldown, so I could, for example, spam ultimate (test purposes) or even make it shorter depending on the race.

I tried to change the cooldown of Human Alliance and Crypt Lord ultimate, but it remains 20 seconds...

Any idea what could possibly be?

Thanks in Advance,
Plock

Revan

  • Hero Member
  • *****
  • Posts: 503
    • View Profile
#war3source on gamesurge

plock

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Can't change ultimate cooldown
« Reply #2 on: February 18, 2016, 12:20:49 PM »
Show some code.

Most races have a CVar so you can configure the ultimate cooldown without the need to recompile it.
https://github.com/War3Source/War3Source/blob/master/addons/sourcemod/scripting/War3Source_002_HumanAlliance.sp#L65
https://github.com/War3Source/War3Source/blob/master/addons/sourcemod/scripting/War3Source_015_Lich.sp#L62

I already changed that :/

Code: [Select]
//ultimate
new Handle:ultCooldownCvar;
new Float:TeleportDistance[5]={0.0,600.0,700.0,850.0,1000.0};

Code: [Select]
public OnPluginStart()
{
    ultCooldownCvar = CreateConVar("war3_human_teleport_cooldown","0.0","Cooldown between teleports");
   
    m_vecVelocity_0 = FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
    m_vecVelocity_1 = FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
    m_vecBaseVelocity = FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
   
    if(GAMECSANY){
        HookEvent("player_jump",PlayerJumpEvent);
    }
}

Code: [Select]
public OnUltimateCommand(client,race,bool:pressed)
{
    if(RaceDisabled)
    {
        return;
    }

    //DP("ult pressed");
    if( pressed  && ValidPlayer(client,true) && !Silenced(client))
    {
        new Handle:genericSkillOptions;
        new Float:distances[5];
        new customerrace,customerskill;
   
        new level=W3_GenericSkillLevel(client,GENERIC_SKILL_TELEPORT,genericSkillOptions,customerrace,customerskill);
        //DP("level CUSrace CUSskill %d %d %d",level,customerrace,customerskill);
        if(level)
        {
            GetArrayArray(genericSkillOptions,    0,distances);
            new Float:cooldown=GetConVarFloat(GetArrayCell(genericSkillOptions,1));
            //DP("cool %f",cooldown);
            if(War3_SkillNotInCooldown(client,customerrace,customerskill,true)) //not in the 0.2 second delay when we check stuck via moving
            {
                TPFailCDResetToRace[client]=customerrace;
                TPFailCDResetToSkill[client]=customerskill;
                new bool:success = Teleport(client,distances[level]);
                if(success)
                {
                    //new Float:cooldown=GetConVarFloat(ultCooldownCvar);
                    War3_CooldownMGR(client,cooldown,customerrace,customerskill,_,_);
                }
            }
       
        }
        else if(War3_GetRace(client)==customerrace)
        {
            W3MsgUltNotLeveled(client);
        }
    }

}

Now reading it more carefully, seems the code which uses my Cvar is commented:

Code: [Select]
if(success)
                {
                    //new Float:cooldown=GetConVarFloat(ultCooldownCvar);
                    War3_CooldownMGR(client,cooldown,customerrace,customerskill,_,_);
                }

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2428
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Can't change ultimate cooldown
« Reply #3 on: February 20, 2016, 12:41:06 AM »
new Float:cooldown=GetConVarFloat(GetArrayCell(genericSkillOptions,1));

its getting it from the generic race cooldown convar

you can comment the line i listed and use custom cvar instead:
//new Float:cooldown=GetConVarFloat(ultCooldownCvar);

but give this a different name so it doesnt conflict with existing cvars

ultCooldownCvar = CreateConVar("war3_human_teleport_cooldown","0.0","Cooldown between teleports");

plock

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Can't change ultimate cooldown
« Reply #4 on: February 20, 2016, 05:06:03 AM »
new Float:cooldown=GetConVarFloat(GetArrayCell(genericSkillOptions,1));

its getting it from the generic race cooldown convar

you can comment the line i listed and use custom cvar instead:
//new Float:cooldown=GetConVarFloat(ultCooldownCvar);

but give this a different name so it doesnt conflict with existing cvars

ultCooldownCvar = CreateConVar("war3_human_teleport_cooldown","0.0","Cooldown between teleports");

I will try, thank you very much!! I'm still learning, good to know about the generic race cooldown (: