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

[Spell] How to create Spells in Radius

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2011
Messages
460
Hello. I'm working on a spell that in a radius that is determined by an point spell and I need a way to store coordinates or a region in that location. If that isn't clear, when a hero casts a spell, it takes the point location of the spell cast and I need to store the area in a radius of x around that point as some type of value or region. Ideas?
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Use a unit group!
  • Set UnitGroup = (Units within (130.00 + (20.00 x (Real((Level of YourSpell for (Triggering unit)))))) of (Position of PointVariable)
This groups all the units within 130 (+ 20*level of a spell) units of a point you want.

Then you can do something like this with those units in the group :
  • Unit Group - Pick every unit in UnitGroup and do (Actions)
    • Loop - Actions
      • Unit - Cause UnitVariable to damage (Picked unit), dealing (25.00 + (25.00 x (Real(LevelOfSpell)))) damage of attack type Spells and damage type Lightning
This will damage all the units in the group. Hope that helps! :]
 
Level 9
Joined
Apr 23, 2011
Messages
460
Hmm, so if I store this point and check the radius, could it be possible to index every unit in that radius, and their standing with the caster of the spell (probably a boolean where true = ally, and false = enemy)? I'm trying to create a spell in which a certain area with a radius of 350 is "locked" out from enemy units to enter or exit, but allied units can enter freely.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
The solution :
  • Set UnitGroup = (Units within (130.00 + (20.00 x (Real((Level of AnySpell for (Triggering unit)))))) of (Position of PointVariable) matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False)
This will add all the enemies of the caster in the unit group, but the allied ones will not be added. :) When setting the value of your unit group, use the function "Units In Range Matching Condition".
 
Level 9
Joined
Apr 23, 2011
Messages
460
I'll be converting this to vJass anyways.. but thanks for the concept. It will be more difficult to do though. I just came up with an idea though. Using a system of processing the units that enter the radius around the point constantly, and adding the units that are enemies to a group that enter, through another loop I can ensure that they don't leave the radius. It'll be somewhat complicated to do, but I'm certain with enough pseudo-code planning, it'll become a possibility.
 
Status
Not open for further replies.
Top