• 🏆 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] Trigger for Mage gather Gold

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
I have a mage unit that I want to be able to gather gold from gold mines without returning to it's townhall.

I thougt of this:

Mage casts channel spell on Gold Mine. (Aerial Shackles, Life Drain etc)
Every 1 sec 10 gold is added to the gold reserve.
Every 1 sec 10 gold is removed from targeted Gold Mine.
If spell interuppts/cancels the trigger stops.

This does not have to be affected by upkeep.

Is this possible to do with triggers?
 
Level 24
Joined
Jun 16, 2008
Messages
1,939
hm, dunno is it if possible to remove gold from gold mine
just set an integer amount for each goldmine on the map
e.g. each goldmine is supposed to have 50000 gold stored inside of it

now set a trigger that uses unit - a unit starts channeling an ability and store the unit into a unit array

activate a trigger that adds 10 gold to every channeling unit per second and remove 10 gold from the goldmine integer

if an integer goes to 0, remove the goldmine

if you dont know what i mean, ask sb in the request forum to make it for u
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
My solution consists of 2 triggers:

  • Gold Gather
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
    • Actions
      • -------- Put your spell in conditions --------
      • -------- Base it off channel --------
      • Unit Group - Add (Triggering unit) to GoldGroup
  • Gold Gather Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GoldGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • (Current order of (Picked unit)) Equal to (Order(channel))
            • Then - Actions
              • Player - Add 10 to (Owner of (Picked unit)) Current gold
              • -------- You could add some floating texts here like this: --------
              • Set TempPoint = (Position of (Picked unit))
              • Floating Text - Create floating text that reads +10 at TempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 33.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 256.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.20 seconds
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Neutral Building - Add -10 gold to YourGoldMine
            • Else - Actions
              • Unit Group - Remove (Picked unit) from GoldGroup
 
Status
Not open for further replies.
Top