Author Topic: Custom Cooldowns  (Read 583 times)

abgar

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Custom Cooldowns
« on: January 15, 2016, 09:39:30 PM »
Hi guys,

Is there a way to change the description of a Coolodown messaging, without changing the skill description?

I have a skill as such:
SKILL_START = War3_AddRaceSkill(thisRaceID,"Start Menu","Start the menu (+ultimate)",false,1);

This spawns a menu, where the client chooses an option.  One of the options in the menu has a cooldown associated for it, however the cooldown messaging will then say "Start Menu is not ready yet".  Whereas i want it to say something else - like "Respawn is not ready yet".  What's the best way to do this please?

I had tried using a new skill altogether, with 0 levels in it (as the respawn checks off the SKILL_START level), which works great, except that you still see that skill in the skill description menu - which i don't actually want it to....  I had also just tried defining the new skill and NOT using the AddRaceSkill function for it, however this then doesn't produce any cooldown messaging at all.

So my questions are:
1 - Is there a way to change the skill description ONLY in the cooldown messaging, OR
2 - Is there a way to create a 'blank' skill with a description, but have it NOT appear in the skill description menu?

Thanks for any help you can give :)

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Custom Cooldowns
« Reply #1 on: January 15, 2016, 11:49:11 PM »
native bool:War3_SkillNotInCooldown(client,raceid,skillNum,bool:printTextIfNotReady=false)
native W3SkillCooldownOnSpawn(raceid,skillnum,Float:cooldownTime,bool:printmsgonexpire=true)
stock bool:SkillAvailable(client,yourRaceID,skillnumber,bool:printCooldown=true,bool:checksilenced=true,bool:printSilenced=true)

see those optional parameters? pass false and cooldown engine won't display any messages, create your own messages

abgar

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: Custom Cooldowns
« Reply #2 on: January 16, 2016, 12:38:27 AM »
Sorry Ownz,

Yep i know how to turn off the default messages - and i know i can use similar to below:

Code: [Select]
new SKILL_RESPAWN;

// Rest of code check here
if(SkillAvailable(client,thisRaceID,SKILL_MENU,false,true,true))
{
FormMenu(client);
}
else
{
new TimeLeft = War3_CooldownRemaining(client, thisRaceID, SKILL_RESPAWN);
PrintHintText(client,"This skill isn't ready yet - %i seconds remaining",TimeLeft);
}

But i was thinking along the lines of how can i get a message to automatically pop up to say that the skill is ready, if i use a blank skill (without the War3_AddRaceSkill)?
And also what's the best way to get a 5 second countdown on the cooldown, like the cooldown manager already has?


I had also looked at using the War3_CreateGenericSkill function, as i thought this might serve my needs - however i can't find any clear indication as to what this is, what it actually does, or how to properly use it....

I thought maybe someone else would have done something similar to what i'm trying to achieve, and there might have been a native function for it....

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Custom Cooldowns
« Reply #3 on: January 16, 2016, 01:23:14 AM »
implement

forward OnCooldownExpired(client,raceID,skillNum,bool:expiredByTime)

in your race and print your custom message


generic skill is for skills sharing across races, it is just a skill not tied to any race, but any race can register it as if it is using that skill, see War3_UseGenericSkill

Human class has an example of this, its teleport skill is a generic skill.


abgar

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: Custom Cooldowns
« Reply #4 on: January 16, 2016, 05:00:56 AM »
Thanks Ownz,

Makes sense - only thing i need help with please is exactly how to forward that particular function...

Using this wouldn't compile:
Quote
public OnCooldownExpired(client,thisRaceID,SKILL);
{
   if(raceID == thisRaceID && skillnum == SKILL_MENU)
   {
      PrintHintText(client,"Your Cooldown has expired");
   }
}

(sorry if that's a stupid question)

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Custom Cooldowns
« Reply #5 on: January 16, 2016, 11:09:11 AM »
try SKILL == SKILL_MENU


abgar

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: Custom Cooldowns
« Reply #6 on: January 16, 2016, 06:01:55 PM »
Oh God, it must have been late lol.

Looking again this morning it all makes sense:

Code: [Select]
public OnCooldownExpired(client,raceID,skillNum)
{
if(raceID == thisRaceID && skillNum == SKILL_MENU)
{
PrintHintText(client,"Menu is now ready");
}
}

This works correctly - thanks Ownz :)