• 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.

Bind Spell Help

Status
Not open for further replies.
Level 12
Joined
Nov 5, 2007
Messages
730
I need a help with making a spell...It goes like this:

Creates a bond between a caster and a target enemy unit.If the unit gets farther than 400 range of the caster,it will take damage.

It should have 4 levels and last 10 seconds.
Any help would be appreciated.

BTW,this is off-topic a bit...
Someone told me that spells like this leak:

-Every 0.5 seconds of game time

-Pick all units in playable map area and do (Actions)
If/Then/Else
-If
Picked unit has buff (Buff)
-Then
Do something
-Else
Do nothing

Is it true?I did a leakcheck on those triggers,and it didnt detect any,but,as i said,someone told me that picking all units every 0.5 secs causes big lags...
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
BTW,this is off-topic a bit...
Someone told me that spells like this leak:

-Every 0.5 seconds of game time

-Pick all units in playable map area and do (Actions)
If/Then/Else
-If
Picked unit has buff (Buff)
-Then
Do something
-Else
Do nothing

Is it true?I did a leakcheck on those triggers,and it didnt detect any,but,as i said,someone told me that picking all units every 0.5 secs causes big lags...

Picking units makes a unit group without you noticing it (because you are using GUI :p) and thus the group needs to be destroyed or it will leak it.

The "set bj_wantDestroyGroup = true" custom script will remove the group right after it finished all its actions.
  • Example
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Unit - Throw_Off_A_Cliff (Picked unit)

You can also set the units you want to pick into a unit group and later on destroy the group.


As to your spell, im too lazy at the moment to make it. You can try to make it alone though.
You need to set your caster and target into unit variables and activate a timer which will check every 1 second or so what is the distance between them.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Picking Every unit every 0.5 seconds is fine if you use the bj_wantDestroyGroup thing like GhostWolf said (still try to avoid doing it many times)

But no I have a better solution (me pwnazar)
3 Variables
TempUnit unit variable (arrayed)
TempLoc location variable (arrayed)
TempDamage real variable

  • Events
    • Unit - Unit Starts Effect of Ability
  • Conditions
    • if Ability is PWNAZ0R TEH HERETIC
  • Actions
    • Custom script: local unit array udg_TempUnit
    • Custom script: local integer bj_forLoopAIndex
    • Custom script: local integer bj_forLoopAIndexEnd
    • Custom script: local real udg_TempDamage
    • Set TempUnit[1] = Triggering Unit
    • Set TempUnit[2] = Target Unit Of Ability Beign Cast
    • Set TempDamage = <you know>
    • For Each integer A from 1 to 20
      • loop
        • Set TempLoc[1] = Position of TempUnit[1]
        • Set TempLoc[2] = Position of TempUnit[2]
        • if Distance Between TempLoc[1] and TempLoc[2] greater than 400
          • then
            • Unit - Make TempUnit[1] damage to TempUnit[2] by udg_TempDamage
          • else
        • Custom script: call RemoveLocation(TempLoc[1])
        • Custom script: call RemoveLocation(TempLoc[2])
    • Set TempUnit[1] = No Unit
    • Set TempUnit[2] = No Unit
Should %100 work and MUI
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
DAMN
  • Events
    • Unit - Unit Starts Effect of Ability
  • Conditions
    • if Ability is PWNAZ0R TEH HERETIC
  • Actions
    • Custom script: local unit array udg_TempUnit
    • Custom script: local integer bj_forLoopAIndex
    • Custom script: local integer bj_forLoopAIndexEnd
    • Custom script: local real udg_TempDamage
    • Set TempUnit[1] = Triggering Unit
    • Set TempUnit[2] = Target Unit Of Ability Beign Cast
    • Set TempDamage = <you know>
    • For Each integer A from 1 to 20
      • Loop - Actions
      • Set TempLoc[1] = Position of TempUnit[1]
      • Set TempLoc[2] = Position of TempUnit[2]
      • if Distance Between TempLoc[1] and TempLoc[2] greater than 400
        • Then - Actions
          • Unit - Make TempUnit[1] damage to TempUnit[2] by udg_TempDamage
          • Else - Actions
        • Wait 0.5 seconds
        • Custom script: call RemoveLocation(TempLoc[1])
        • Custom script: call RemoveLocation(TempLoc[2])
      • Set TempUnit[1] = No Unit
      • Set TempUnit[2] = No Unit
Ok now ? (Beg for mercy I'll pwnaz0r you)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Yes I guess its fine now.

YOU CAN'T PWNZOR ME IM UNBEATENABLE MUHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH
 
Level 12
Joined
Nov 5, 2007
Messages
730
Thanks for the help guys....unfortunately,i already repped you both :(
Ill remember it tho,when i spread some rep around :)
 
Status
Not open for further replies.
Top