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

Help Making This Spell Not Suck?

Status
Not open for further replies.
Level 3
Joined
Aug 4, 2009
Messages
54
I am at a bit of an impasse here. The spell works, but it's got a pretty glaring holes that could make things messy if not addressed.

The spell is "Anti-Magic", which dispels all buffs from a unit and additionally gives it a one-time Spell Shield. Right now it goes something like this.

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Anti-Magic (Neutral Hostile)
    • ((Casting unit) belongs to an ally of (Owner of (Target unit of ability being cast))) Equal to True
    • ((Target unit of ability being cast) has buff Spell Shield) Equal to False
  • Actions
    • Set AntiMagicTempPoint = (Position of (Target unit of ability being cast))
    • Unit - Create 1 GhostCastingHero for Player 10 (Light Blue) at AntiMagicTempPoint facing (Center of (Playable map area))
    • Item - Create Rune of Shielding at AntiMagicTempPoint
    • Unit - Order (Last created unit) to Right-Click (Last created item)
    • Wait until (((Target unit of ability being cast) has buff Spell Shield) Equal to True), checking every 0.10 seconds
    • Unit - Remove (Last created unit) from the game
    • Custom script: call RemoveLocation(udg_AntiMagicTempPoint)
Like I said, it works, but because I have to put in a wait period before removing the dummy hero (for some reason, it cannot grab the rune instantly, there is a tiny wait), there is a chance it could overlap with another "Remove last created unit" action and leave the one or more dummies hanging. And since there's no order-string associated with Spell Shield, I can't work with that either. Assistance?

And on an unrelated note, am I doing this "preventing memory leaks" thing right?
 
Level 8
Joined
Aug 1, 2008
Messages
420
Well, the major leak that i saw was "facing (Center of (Playable map area))" anything which says "Center of playable map area" leaks pretty much..

You should use much more variables... i dont know, variables make the spell easier.
You should have (in my opinion):

AntiMagicTarget = Unit
AntiMagicDummy = Unit
MapCenter = Point (you should set this at map initialization i think..)
AntiMagicTempPoint = Point (which you already have)

are you sure thats right? "Create 1 GhostCastingHero for "Player 10"? You sure you dont want it to be the casting player?

to stop the (last created unit) thing overlapping, assign the "AntiMagicDummy" variable to the dummy, simple. then remove it.

  • Set AntiMagicTarget = (Target unit of ability being cast)
  • Set AntiMagicTempPoint = (Position of AntiMagicTarget)
  • Unit - Create 1 GhostCastingHero for Player 10 (Light Blue) at AntiMagicTempPoint facing (MapCenter [OR default building angle if you dont care where its facing])
  • Set AntiMagicDummy = (Last created unit)
  • Item - Create Rune of Shielding at AntiMagicTempPoint
  • Unit - Order AntiMagicDummy to Right-Click (Last created item)
  • Wait until (AntiMagicDummy) has buff Spell Shield) Equal to True), checking every 0.10 seconds
  • Unit - Remove AntiMagicDummy from the game
  • Custom script: call RemoveLocation(udg_AntiMagicTempPoint)
should go along the lines of that.
 
Level 8
Joined
Aug 1, 2008
Messages
420
Oh sorry, i forgot to answer your mui question.

yeah, Maker is 100% right ;)

Maker, shouldnt it be "Cant raise, DOES DECAY?"
 
Status
Not open for further replies.
Top