• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] mana costing buildings

Status
Not open for further replies.
Level 21
Joined
Mar 29, 2020
Messages
1,237
hey,

I am trying to create an ability that allows the hero to build (without having to stay there while it is built) a few ability-specific buildings only using mana and cooldown (not gold or lumber). The initial way I tried doing that was with a spell book and abilities based off of the different "build tiny X" abilities. that didn't work bc they all have the same order ID. if I use dummy casting with channel, I don't know how to make it target using the building spacer thing and not just a point. I tried making the hero just be able to build them, but then I can't figure out how to make it only available according to if the hero learned the ability, and to cost mana and have a cooldown. any help would be welcome, thanks!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,549
There's no good way of going about it. The building spacer is exclusive to the Tiny abilities and the standard building construction.

I suppose you could catch the use of a Tiny ability, disable it, and enable a passive ability and start it's cooldown (Exhume Corpses is the only passive ability that is capable of doing this). Then reverse the process when the cooldown is finished (enable the Tiny ability, disable the passive ability).

You'll have to trigger the mana cost as well.
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
I suppose you could catch the use of a Tiny ability, disable it, and enable a passive ability and start it's cooldown (Exhume Corpses is the only passive ability that is capable of doing this). Then reverse the process when the cooldown is finished (enable the Tiny ability, disable the passive ability).

I'm not sure I get what you mean. If I would be catching use of tiny abilities, then I would be back to the original problem, that whenever I would try to catch one of the tiny abilities, it would catch only one of them (and not the one i wanted) bc it still has the same order ID. no?
 
Level 5
Joined
Oct 16, 2007
Messages
67
You can't have the ability multiple times, however you can do a few things:
  • Use items instead (maybe a dummy unit and sync mana between hero and dummy unit, or use an ability to switch inventories and loose the ability to take/drop items in that time).
  • Add dummy abilitys in a spellbook and a singel build ability and switch this ability at will (adding/removing abilitys will reset cooldown, could use tech requierment for cooldown).
  • Give up on the building on the cursor and use channel to create dummy units that will build (requires you to check if building realy started for refunds and cd-reset).

There are probably more possibilitys, but that is what i can come up with right now.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,549
I'm not sure I get what you mean. If I would be catching use of tiny abilities, then I would be back to the original problem, that whenever I would try to catch one of the tiny abilities, it would catch only one of them (and not the one i wanted) bc it still has the same order ID. no?
Yeah, I never finished the idea xD

Anyway, using that method I described you could do what Lartin said:
"Add dummy abilitys in a spellbook and a singel build ability and switch this ability at will (adding/removing abilitys will reset cooldown, could use tech requierment for cooldown)."

But combine it with what I described. So I guess instead of passive abilities you could use Active Dummy abilities (Instant). So when you click a Dummy ability it disables it and enables it's Tiny version.

So essentially the user would have to click the hotkey twice, once to enable the Tiny ability, and again to cast it.

It's a pretty ugly solution. I would honestly give up on the "placement image" or whatever we want to call it, and just use Point abilities to create the structures.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
thanks. actually what I'm doing functions like one, spell, you only need to hit the button once:

spellbook with dummy channel based, instant-targeting type spells. those are triggered to give the caster the right "build tiny" ability and force UI key the hotkey of the ability so the user can choose where to put the building. currently I'm stuck on getting rid of the ability when it is cancelled.


  • Facade
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(avatar))
    • Actions
      • Game - Display to (All players) for 30.00 seconds the text: triggered
      • Unit - Order (Triggering unit) to Stop
      • Unit - Add Tower (Facade) to (Triggering unit)
      • Game - Force (Triggering player) to press Escape/Cancel
      • Wait 0.50 seconds
      • Game - Force (Triggering player) to press the key l
      • Unit Group - Add (Triggering unit) to FacadeGroup
  • remove tiny builds
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • ((Triggering unit) is in FacadeGroup) Equal to True
      • (Ability being cast) Equal to Tower (Facade)
      • (Ability being cast) Not equal to Tower (Channel)
      • (Ability being cast) Equal to Facade
    • Actions
      • Unit - Remove Tower (Facade) from (Triggering unit)
      • Unit Group - Remove (Triggering unit) from FacadeGroup
right now it's only set up for one ability, but I don't see why it shouldn't work for a lot as long as all of the spellbook abilities have dfferent IDs
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,549
Your conditions for remove tiny builds should use an OR. Remember, conditions by default need to ALL be true.

So right now you're asking:
Is Ability being cast equal to Tower (Facade)
Is Ability being cast NOT equal Tower (Channel)
<--- Unneeded as the previous and next conditions would exclude it if they were true
Is Ability being cast equal to Facade <--- Now the Actions will never run as an ability can't be two things at once. It can't be equal to Tower (Facade) AND Facade at the same time.

  • Example
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • ((Triggering unit) is in (FacadeGroup) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Tower (Facade)
          • (Ability being cast) Equal to Facade
    • Actions
Also, Wait 0.50 seconds and then referencing Triggering Player will cause problems. Instead, reference Owner of Triggering Unit since Triggering Unit is treated like a local variable and won't change after the Wait.
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
oh, most of those are disabled in my editor.. it didn't copy that...(leftovers from experimenting which I forgot to remove before posting...)

it's working to detect when the ability is casted and removing it, what I can't figure out how to detect is when the ability is clicked on, so you get the building placer, and then cancelled. in that case the ability stays..
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,549
I don't understand how it could run. You're asking if two mutually exclusive things are both true, I guess maybe it picks one at random.

Also the Force UI Hotkey is a very ugly solution that gets even worse in online games, so keep that in mind.

And for detecting when an ability button is clicked, maybe this will work:
  • Events
    • Game - Button for ability Animate Dead and order Human Peasant - Repair pressed.
The fact that it requires an Order leads me to believe that it won't work but maybe it's just worded poorly. But we could already do this with the "A unis issues an order" Events so I don't know why Blizzard would've added it if it does nearly the same thing.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
what? I meant that the conditions are "disabled functions" in my editor. leftovers from experimenting that I forgot to delete before posting. only the first two conditions in the second trigger are "on".

what is wrong with using force UI hotkey? could you elaborate?

is that an event? I can't find it (maybe its newer than 1.31.1)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,549
Oh, you're using 1.31.1. I think it was introduced in 1.32.

Force UI Hotkey will have a slower response in multiplayer, so it leaves room for the player to select a different unit or click something else before the hotkey is actually pressed.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
Force UI Hotkey will have a slower response in multiplayer, so it leaves room for the player to select a different unit or click something else before the hotkey is actually pressed.

that much slower? that sucks... and disabling the unit for the interim is probably as much a solution as it is a new problem...

back to the drawing board I guess...

Is there a way to hide the "build" ability?
 
Last edited:
Status
Not open for further replies.
Top