• 🏆 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!

trigger help

Status
Not open for further replies.
Level 12
Joined
Jun 20, 2017
Messages
959
How would you set up a trigger to fire when a acolyte begins to harvest a haunted gold mine? I've tried pretty much all the conditions in the editor but none of them activate the trigger.
 
Level 12
Joined
Nov 3, 2013
Messages
989
There doesn't appear to be any direct way, but you could know the amount of harvesters by keeping track of the player gold. And luckily the acolyte don't have to move so the harvesting rate should be consistent.


My preliminary idea: Make a unit group for all acolytes whose last unit order was either 'smart' or 'harvest (targeting a haunted goldmine of course), whenever an an acolyte is ordered to target a haunted goldmine with smart or harvest order—add them to the group. If an acolyte who is in the unit group is given any other order, remove them.

Use something like Is Unit Moving 2.1.0.0 to check whether the acolytes are standing still (if they're moving they're obviously not harvesting any gold), since unlike the unit starts the effect of an ability and similar events, a unit simply being issued the order doesn't mean that they're actually performing the action.


Then you'd need to keep track of the player's gold, in particular the amount that's being harvested. Now I'm actually not quite sure how you could tell the gold gained from harvesting apart from other gold sources, but I did notice that there's constant playerscore PLAYER_SCORE_GOLD_MINED_TOTAL = ConvertPlayerScore(10) and constant native GetPlayerScore takes player whichPlayer, playerscore whichPlayerScore returns integer, so maybe one can use the playerscore?

Actually I opened the world editor and checked with the world editor, and
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red)'s Current gold becomes Greater than or equal to 0.00
    • Conditions
    • Actions
      • Game - Display to (All players) for 6.00 seconds the text: (String((Player 1 (Red) Total gold gathered)))
      • Game - Display to (All players) for 6.00 seconds the text: (String((Player 1 (Red) Gold Mined (Total))))
both of those worked, and even if you already have more than 0 gold, the event still fires even though it technically doesn't become more than 0 (since it wasn't less than 0).


Anyway, so you should be able to do something with that, check for how long an acolyte has stood still next to a haunted goldmine while it's last issued order was harvest...



Honestly it's pretty convoluted and I image it would be a pain in the ass to make...


What about just making a fake harvest ability based on channel or something?

Or how about having a channel ability that does nothing, but whenever an acolyte is ordered to either harvest or "smart" targeting a haunted goldmine, you could order the acolyte to use this dummy channel ability instead and detect when the channel ability is cast.

Then when the channel ability is cast, just order the acolyte to harvest the goldmine as usual.


Both of those workarounds would let you know when an acolyte begins harvesting gold.
 
Status
Not open for further replies.
Top