Rotating Searchlight

scubazoo

Member
Reaction score
1
Hi, I would like to make a trigger with which a rotating searchlight provides an arc of light revealing dark areas. The map is continually black masked, so that when the lamp rotates back, the previously lit area becomes dark again. I have made a trigger which provides an arc of light in the direction in which a unit is facing and a trigger which resumes darkness; these triggers are below.

flashlight trigger(to be lamp light arc)
Code:
flashlight 2
    Events
        Timer - Every 0.0125 seconds of Game Time
    Local Variables
        counter = 0.0 <Real>
        flashlight holders = (Any units in (Playable map area) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) <Unit Group>
        flashlight length = 9 <Integer>
        flashlight initial size = 1.25 <Real>
        flashlight expanding size = 0.25 <Real>
        unit facing angle = 0.0 <Real>
        unit position = No Point <Point>
    Conditions
    Actions
        Unit Group - Pick each unit in flashlight holders and do (Actions)
            Actions
                Variable - Set unit position = ((Position of (Picked unit)) offset by (0.0, 0.0))
                Variable - Set unit facing angle = (Facing of (Picked unit))
                General - For each integer counter from 0 to flashlight length with increment 1, do (Actions)
                    Actions
                        Visibility - Reveal (Region((unit position offset by counter towards unit facing angle degrees), (flashlight initial size + (counter * flashlight expanding size)))) for player (Owner of (Picked unit)) for 0.0125 seconds and Do Not check cliff level


black mask
Trigger:
  • black mask
    • Events
      • Timer - Every 0.01 seconds of Game Time
    • Local Variables
    • Conditions
    • Actions
      • Visibility - Enable Black Mask visibility
      • Visibility - Enable Fog Of War visibility
      • Visibility - Change visibility for player 1 to Unexplored within (Playable map area) and Do Not check cliff level



Now, I would like to use the doodad for the rotating lamp and attach this light trigger to it and have the arc of light rotate with the lamp as it rotates. How do I do this? I would like to use the variation of the lamp which is rotating, would it be possible to attach this lamp model to a unit or structure, or could the trigger be attached to the doodad itself?

Thanks
 

scubazoo

Member
Reaction score
1
Would it work if I set the unit position to the position of an actor instead, and then rotate the actor? I have not the slightest idea how to do this though, I just saw that setting the variable as an actor instead as an option, and then I think it is possible to rotate the actor. Or, would it work to set the unit position to a point in front of the unit, and then make the point to look at certain angles, and define these angles as an array, while making the point hesitate, or wait, say 2 game seconds, before continuing the rotation in the next angle? Not sure how to trigger this either. Or, could the position the light is facing be instead attached to a dummy unit which rotates? Any help appreciated.
 

scubazoo

Member
Reaction score
1
I have been trying random things. Actually, I have a new trigger, which does what i want it to to a degree; the unit(lamp rotates, and reveals an area, however, the area it reveals is much smaller than the area intended. I am not sure how to have a constant amount of area revealed. Unlike the flashlight trigger, which grows to its complete area and remains constant, the trigger for the lamp never reaches the length or width of the same amount of area and instead only reveals a small portion.

Heres the rotating lamp trigger:
Trigger:
  • flashlight rotating
    • Events
      • Game - Map initialization
    • Local Variables
      • counter 2 = 0.0 &lt;Real&gt;
      • flashlight length 2 = 10 &lt;Integer&gt;
      • flashlight initial size 2 = 1.25 &lt;Real&gt;
      • flashlight expanding size 2 = 0.25 &lt;Real&gt;
      • unit facing angle 2 = 0.0 &lt;Real&gt;
      • unit position 2 = No Point &lt;Point&gt;
    • Conditions
    • Actions
      • Unit - Create 1 dummy for player 1 at Point 001 facing 360.0 degrees (No Options)
      • Variable - Set unit position 2 = ((Position of (Last created unit)) offset by (0.0, 0.0))
      • Variable - Set unit facing angle 2 = (Facing of (Last created unit))
      • Visibility - Reveal (Region((unit position 2 offset by counter 2 towards unit facing angle 2 degrees), (flashlight initial size 2 + (counter 2 * flashlight expanding size 2)))) for player 1 for 0.0125 seconds and Do Not check cliff level
      • Unit - Make (Last created unit) face 270.0 over 3.0 seconds
      • General - Wait 1.0 Game Time seconds
      • Unit - Make (Last created unit) face 360.0 over 3.0 seconds
      • General - Wait 1.0 Game Time seconds
      • Unit - Make (Last created unit) face 270.0 over 3.0 seconds


So this creates an invisible unit which rotates and projects light in the direction it faces, dispelling the darkness, which refills newly unlit areas as the unit continues to rotate. However, it doesn't reveal the proper area as I have stated above. Furthermore, because this unit is placed at a point near the lamp doodad, and is not the lamp itself, their movements are not synchronized. Is there a way to make a unit, with the model art of the rotating doodad? I would like to use variation 2 of the floodlight doodad, which is a prop. And then, once I have this unit, would it be possible to establish a direction for the direction in which the lamp light is facing? This seems difficult because I do not know if there is a way to attach an actor(not really sure what to attach though either way) to the direction in which the lamp light faces. Thanks for looking.

EDIT: Actually, it isn't rotating, it shines light once, and then stops. I have also tried adding more instances of the visibility reveal region action, such as after the make unit face angle action, and wait action but to no avail.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top