• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Gui Spell

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
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: 85
Status
Not open for further replies.
Top