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

Aoe damage problem!

Status
Not open for further replies.
Level 5
Joined
Jan 13, 2008
Messages
96
Hello! I have a problem with my aoe spell... My spell is single target (Entagling Roots). It needs to damage only my ennemies in aoe... I have this trigger.
  • Event - Unit start effect an ability
  • Condition - Ability being cast equal to Entagling Roots
  • Action - Unit group - Pick every unit in (Units withing 600.00 of (position of (Target unit of ability being cast)) matching (((Target unit of ability being cast ) belong to an ennemy of (Owner of casting unit))) Equal to False)) and do actions.
  • Loop actions -
  • Unit to cause (Casting unit) to damage (picked unit), dealing My hero str x level of ability damage of attack type normal.
It gives damage to my caster too... Please help!
 
Level 5
Joined
Jan 13, 2008
Messages
96
((Target unit of ability being cast ) belong to an ennemy of (Owner of casting unit))) Equal to False)

Needs to be true instead of false.

If I`m using this, it doesnt damage anything :).

1. Your scripts leak

2. The (((Target unit of ability being cast ) belong to an ennemy of (Owner of casting unit))) Equal to False))

Target unit of ability being cast Matching unit

False True

You`re the best! Thanks!
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
During the loop inside the for group, you should place the If/Then/Else.
Inside the If block, you place three conditions.
1, Picked unit is alive equal to true
2, Picked unit belongs to an enemy of Owner of Casting unit equal to true
3, Picked unit is a structure equal to false
(The third one is optional but ussually placed in spells. The other two are required in yours.)

About the leaks, yes, you have to remove the group leak and location leak.
Group is easiest fixed by placing a custom script just above the loop containing "set bj_wantDestroyGroup = true" as text.
The location (and second way to fix the group leak) is to store the position of the target in a global variable. Then you can use that variable instead and once you are done, you do a custom script containing "call RemoveLocation(<locationname>)" as text.
(Where <locationname> is "udg_" + the name of your global variable.)

One more thing to improve performance in your map is to store all duplicates in a global variable.
There is no use to re-calculate the damage for each individual unit or to do a request to find out who the caster is. etc. etc. etc.
Store all things that are used multiple times in global variables.
Casting unit, picked unit, owner of casting unit, total damage and ofcourse the location.
 
Status
Not open for further replies.
Top