Cooldown, Gold Cost AND Techtree Requirement on Ability/Unit

Level 13
Joined
Aug 31, 2009
Messages
741
So the title sets out basically what I want.

I want to be able to cast an ability (or train a unit, it doesn't matter which) but it must:
1) Have a Resource Cost, which is not trigger related.
2) Have a cooldown, again preferably not trigger related.
3) Have a tech-tree requirement. This must absolutely not be trigger related.

The 4 things I tried are:
1) Base it on Channel. Channel can have a techtree requirement and a cooldown, but I can't associate a gold cost with it.
2) Base it on "Charge Gold/Lumber" ability. Works with Techtree requirement and costs Gold to use, however the cooldown does NOT work for this ability.
3) Base it on Hiring (selling) a unit. Gives it a cooldown, and a gold cost, but now it ignores techtree requirements.
4) Base it on training a unit. Gives it a gold cost and a techtree requirement, but now I can't give it a cooldown.


All I want essentially is a button that has all 3 requirements in one go. Doesn't matter if it's a train unit button or ability or whatever, as long as it caters for all 3.
 
Level 13
Joined
Aug 31, 2009
Messages
741
Because then the tooltip looks weird. I want the tooltip to properly grey out when techtree requirements aren't met, and I want a normal cooldown display. Also, if you cast Channel and don't have the gold, the ability will get put on cooldown anyway, and that's not an acceptable outcome.
 
Level 12
Joined
Oct 16, 2010
Messages
681
this way u can reset the cooldown on one ability

  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Custom script: local integer abil
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Ability being cast) Equal to (==) Thunder Clap
            • (Player 1 (Red) Current gold) Less than (<) 100
          • Then - Actions
            • Unit - Order (Triggering unit) to stop
            • Custom script: set abil = GetSpellAbilityId()
            • Custom script: call UnitRemoveAbility(GetTriggerUnit(),abil)
            • Custom script: call UnitAddAbility(GetTriggerUnit(),abil)
          • Else - Actions
U can even add error massage to it and the spell description is to small problem IMO to not do this

at least u can achive what u want this way

EDIT: oh and don't forget to store the abilitys lvl in a variable and set it back after readded it to the unit
cus it will be lvl 1
 
Level 13
Joined
Aug 31, 2009
Messages
741
Not quite what I meant.
I mean, a shop (i.e. a Structure) sells an item. The actual button to buy the item can have a cooldown (via Stock Replenishment) a Techtree requirement and a gold cost.

The trigger would then check for when the item is purchased and go from there. Seems like this would be the best way to do it.
 
Level 10
Joined
Nov 15, 2007
Messages
780
Base it on charge gold/lumber. When the ability is used, remove it - then add a dummy ability based on Berserk, and order the unit to use the Berserk ability. Use a wait/timer equal to the cooldown of the dummy Berserk ability, and afterwards remove the Berserk ability and add the original charge gold ability. This should emulate the effect you're looking for.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If the thread starter would allow the trigger to solve the problem, I'd be gladly to help.
Don't worry, triggers are the ones that makes your map looks exceptionally better than non-triggered maps

Even melee map has its own trigger, lol
 
Level 10
Joined
Nov 15, 2007
Messages
780
If the thread starter would allow the trigger to solve the problem, I'd be gladly to help.
Don't worry, triggers are the ones that makes your map looks exceptionally better than non-triggered maps

Even melee map has its own trigger, lol

As far as I can tell, the only reason he doesn't want anything triggered is because he wants the values to be displayed on the ability in the UI. As in, show when the ability is on cooldown, show in the tooltip how much gold it costs, and show it as disabled when the tech tree requirement isn't fulfilled. The only way I can think of doing this is what I posted above.
 
Level 13
Joined
Aug 31, 2009
Messages
741
As Meticulous said, that's the exact reason. If possible, I want to utilise the game UI as much as possible.

However, I managed to find an even shorter way to overcome this anyway - simply make the button an item purchase button. It can have all the requirements above. As long as there's a hidden unit nearby with an inventory it works fine, especially if you remove the "Select Unit" ability from the shop and make the unit select indicator invisible. You'd never even know it was an item you were buying to trigger the effects.

But anyhow, case solved.
 
Top