• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Gui Spell

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,248
ok made a quick example spell. No configurations, nor effects. However it works :p

There's also a minor leak, but I was at school when I did it so I didn't have a lot of time.

  • init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set GD_hash = (Last created hashtable)
  • cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Custom script: local integer i = GetHandleId(GetSpellTargetUnit())
      • Custom script: call SaveReal(udg_GD_hash, i, 1, 0)
      • Unit Group - Add (Target unit of ability being cast) to gold_drain_group
  • loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in gold_drain_group and do (Actions)
        • Loop - Actions
          • Custom script: local integer i = GetHandleId(GetEnumUnit())
          • Custom script: local real counter = LoadReal(udg_GD_hash, i, 1) + 0.03
          • Custom script: if counter > 1 then
          • Neutral Building - Add -500 gold to (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Resource quantity contained in (Picked unit)) Equal to 0
            • Then - Actions
              • Unit Group - Remove (Picked unit) from gold_drain_group
            • Else - Actions
          • Custom script: set counter = 0
          • Custom script: endif
          • Custom script: call SaveReal(udg_GD_hash, i, 1, counter)
various (minor) flaws can be found in terms of efficiency, and I am aware of a few of them. However I wont update this unless there is some major bug in the code. So good trigger guys shouldn't bother pointing them out :p
 

Attachments

  • gold mine derp.w3x
    17.7 KB · Views: 86
Status
Not open for further replies.
Top