Highlighting an area?

Status
Not open for further replies.
Level 6
Joined
Feb 16, 2014
Messages
193
How do i highlight an area?, like for example:
A player selects a unit then a circular area(of the unit's attack range) would be highlighted with a blue color or some other color. How do i do that? Thx in advance.
 
Level 11
Joined
Dec 19, 2012
Messages
411
When selected the unit, you must know what is the unit range since you must deal with trigger. Below is an example trigger:
  • Example
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set Loc1 = (Position of (Triggering unit))
      • Set Unit_Range = the unit range
      • -------- Determine the maximum loop amount --------
      • Set Loop_MaxInteger = 8
      • -------- Angle / Loop_MaxInteger must be equal to 360 (Complete circle) --------
      • Set Temp_Int = (360 / Loop_MaxInteger)
      • For each (Integer Loop_Integer) from 1 to Loop_Integer, do (Actions)
        • Loop - Actions
          • Set Angle = ((Real(Loop_Integer)) x Real(Temp_Int))
          • Set Loc2 = (Loc1 offset by Unit_Range towards Angle degrees)
          • -------- Special effect for displaying the maximum range of the unit. --------
          • -------- You may probably want the special effect get destroyed after deseleting the unit, --------
          • -------- so you may go self figure out how to do it. --------
          • Special Effect - Create a special effect at Loc2 using ANY MODEL YOU WANT
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_Loc2)
      • Custom script: call RemoveLocation(udg_Loc1)
Basically this trigger just giving you a basic concept for how to displaying a unit's attack range. So if you got multiple units that want to display their attack range, you would need to change the trigger.

Since highlighting the whole area probably would be quite messy, so display the maximum range of the unit should be better/enough.
 
Level 6
Joined
Feb 16, 2014
Messages
193
When selected the unit, you must know what is the unit range since you must deal with trigger. Below is an example trigger:
  • Example
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set Loc1 = (Position of (Triggering unit))
      • Set Unit_Range = the unit range
      • -------- Determine the maximum loop amount --------
      • Set Loop_MaxInteger = 8
      • -------- Angle / Loop_MaxInteger must be equal to 360 (Complete circle) --------
      • Set Temp_Int = (360 / Loop_MaxInteger)
      • For each (Integer Loop_Integer) from 1 to Loop_Integer, do (Actions)
        • Loop - Actions
          • Set Angle = ((Real(Loop_Integer)) x Real(Temp_Int))
          • Set Loc2 = (Loc1 offset by Unit_Range towards Angle degrees)
          • -------- Special effect for displaying the maximum range of the unit. --------
          • -------- You may probably want the special effect get destroyed after deseleting the unit, --------
          • -------- so you may go self figure out how to do it. --------
          • Special Effect - Create a special effect at Loc2 using ANY MODEL YOU WANT
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_Loc2)
      • Custom script: call RemoveLocation(udg_Loc1)
Basically this trigger just giving you a basic concept for how to displaying a unit's attack range. So if you got multiple units that want to display their attack range, you would need to change the trigger.

Since highlighting the whole area probably would be quite messy, so display the maximum range of the unit should be better/enough.

Thx, i'm gonna try this later :thumbs_up: Though i only need for 1 unit :) (cause i'm making a turn-based map)
 
Status
Not open for further replies.
Top