WarCraft: Source

 

SetCoolDown

Page history last edited by freddukes@... 1 yr ago

SetCoolDown

 


 

 

This is used to set a cooldown timer for a skill. A cooldown timer means that a player cannot use that ability/skill until the timer has ran out. If the skill you're setting a cooldown for is not an ultimate, you MUST use the command GetCoolDown first, and see if it's 0 before you run the command; if it's an ultimate (player_ultimate_on), then you don't need to run GetCoolDown.

 

The correct syntax is:

 

wcs.Command(<userid>).SetCoolDown(<"Skill Name">, <Cooldown Time>)

 

  • Userid - The player who you're setting a cooldown timer for
  • Skill name - The name of the skill you're setting the cooldown timer for
  • Cooldown Time - The amount of time (in seconds) that you'll set the cooldown timer for

 

 


 

Example:

 

 

For an ability, use GetCoolDown

 

race = wcs.Race('My Race Name')

race.registerSkill('My Cooldown Skill',1,1,'Skill to test cooldown on')

 

def player_ability_on(ev):

    if not wcs.Command(ev['userid']).GetCoolDown('My Cooldown Skill'):

        # The cooldown is 0, so we can carry on with the skil ^_^.. See GetCoolDown

        es.msg('You're skill has been activated')

        wcs.Command(ev['userid']).SetCoolDown('My Cooldown Skill',30)

        # Sets a cooldown for this skill for 30 seconds...

 

For an ultimate, don't use GetCoolDown

 

race = wcs.Race('My Race Name')

race.registerUltimate('My Cooldown Ultimate',8,1,1,'Ultimate to test cooldown on')

 

def player_ultimate_on(ev):

    es.msg('You're skill has been activated')

    wcs.Command(ev['userid']).SetCoolDown('My Cooldown Ultimate',30)

    # Sets a cooldown for this skill for 30 seconds...

 

Comments (0)

You don't have permission to comment on this page.