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
 
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.
 
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 The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top