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

Show Tower Range

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
Hm, you could set the point value of the unit to the range.
Or you could set some variables in a table.

Well, I'll try to explain both of them, but they're basically the same ^^
Either way, you need to create a "show range"-ability and a dummy unit (special effect, no shadow, abilities: locust, invulnerable, disable attack, doesn't show on minimap).

Point Value:


  • Show Range
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Range
    • Actions
      • Set loc[1] = (Position of (Triggering unit))
      • For each (Integer LoopInt) from 1 to 36, do (Actions)
        • Loop - Actions
          • Set loc[2] = (loc[1] offset by (Real((Point-value of (Unit-type of (Triggering unit))))) towards (10.00 x (Real(LoopInt))) degrees)
          • Unit - Create 1 Range Dummy for (Triggering player) at loc[2] facing Default building facing degrees
          • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_loc[2])
      • Custom script: call RemoveLocation(udg_loc[1])
That was easy, lol :p
Ehh... this just creates 36 dummy units in a circle around the caster with as offset the point value ( = range)

Simple Table: (point value isn't always an option)


  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RangeInt = (RangeInt + 1)
      • Set RangeType[RangeInt] = Peasant
      • Set Range[RangeInt] = 200.00
      • Set RangeInt = (RangeInt + 1)
      • Set RangeType[RangeInt] = Footman
      • Set Range[RangeInt] = 800.00
      • Set RangeInt = (RangeInt + 1)
      • Set RangeType[RangeInt] = Knight
      • Set Range[RangeInt] = 600.00

  • Show Range
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set loc[1] = (Position of (Triggering unit))
      • For each (Integer LoopInt) from 1 to RangeInt, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to RangeType[LoopInt]
            • Then - Actions
              • Set TempReal = Range[LoopInt]
            • Else - Actions
      • For each (Integer LoopInt) from 1 to 36, do (Actions)
        • Loop - Actions
          • Set loc[2] = (loc[1] offset by TempReal towards (10.00 x (Real(LoopInt))) degrees)
          • Unit - Create 1 Footman for (Triggering player) at loc[2] facing Default building facing degrees
          • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation(udg_loc[2])
      • Custom script: call RemoveLocation(udg_loc[1])
Set all variables in the init variable-trigger like I've done it.

I didn't test this, but it seems right... if it doesn't work, please tell me the exact problem.

Of course, you can change the amount of dummies spawned :/
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Being picky now, are we? D:

Well, I've looked it up, couldn't really come with a foolproof method.
The only method I've tested is this one:
First you need to create a dummy model (the same as the previous one)
BUT: give it the model "UI\Feedback\Target\Target.mdx"

Then you create that unit and increase the size according to the range (that's your job -.-).
 
Level 4
Joined
Jun 11, 2009
Messages
23
Now i made a trigger like this

third
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Range
Actions
Set Loc[1] = (Position of (Casting unit))
Unit - Create 1 Dummy Range for (Owner of (Casting unit)) at Loc[1] facing 270.00 degrees
Animation - Change (Last created unit)'s size to ((Current acquisition range of (Casting unit))%, (Current acquisition range of (Casting unit))%, 100.00%) of its original size
Animation - Change (Last created unit)'s animation speed to 20.00% of its original speed
Unit - Add a 5.00 second Generic expiration timer to (Last created unit)



The problem. Is that.. It set the % of Acquisition Range.. Wich is much smaller than the Real Range..
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Hmm.. Cant you do it this way:


White circle = Range

I just thought of something but i'm not sure if it works and how precise it would be, how about changing its selections scale to be as big as his range?
If you can calculate the range of the tower, then you can make his selection to be something similar.
Example, tower's range 700 - selection scale 3.00?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
The problem. Is that.. It set the % of Acquisition Range.. Wich is much smaller than the Real Range..
=.= that's not true
The acquisition range is always greater than the real range (always, there are no exceptions).
The reason why it looks smaller is because the size is a percentage (if the tower's Acq. Range is 600, you set the size of the circle to 600%).

I've also said that you need to set the point value of the unit to its range, so the point value = range of the unit.
On top of that, you didn'tgive the dummy the locust ability.

You need to calculate the Size % versus the range yourself...

Reason3 said:
how about changing its selections scale to be as big as his range?
Yeah, I also thought about that, but didn't know how :/ (apart from creating a lot of dummy units in the object editor, each with a different scale :S).
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
then, how to calculate that? ..
I know the Math triggers..
...that's up to you, you will need to come up with the formula yourself, as there is no preset function for it or any known formula (afaik).

All I can say is this: the unit art scale is multiplied with it's original size.
So if the scale is 1.50 and the size is 100, the new size will be 150.

You need to do some testing, increase/decrease the size of the dummy and compare it with the actual range, things like that.

Good luck ^^
 
Status
Not open for further replies.
Top