• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Turning Lights Off For Specific Regions

Status
Not open for further replies.
Level 18
Joined
Jun 13, 2016
Messages
586
I think that function is safe for local clients, so when the camera via a GetCameraTargetPosition... is within the bounds of that region, via some IsPointInRegion native (which may or may not exist), you call that function above.

Yeah, this is precisely how I do it in my map. It's perfectly save to call in a local context.

Just grab the camera position in compare it against your rect bounds, and then apply the DNC if needed. Just make sure to rever it when the camera goes back outside the region.
 
Level 13
Joined
Oct 12, 2016
Messages
769
Just grab the camera position in compare it against your rect bounds, and then apply the DNC if needed. Just make sure to rever it when the camera goes back outside the region.
I am struggling to find an event to trigger this. How would you recommend executing this for a player's camera going into and out of specific regions?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Camera move doesn't have any events associated with it as far as I know. If I was doing this I'd periodically check camera position for each player. If you can be more specific about when/why you want to change the day/night models perhaps there's something else you can use instead, like a unit enters region, spell cast, or unit in range event.
 
Level 13
Joined
Oct 12, 2016
Messages
769
I'm still in the dark completely for this (no pun intended). I still can't find any conditions to go with this per player for camera position.
Basically, all I've got is:
  • Cave Lighting
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Custom script: call SetDayNightModels("","")
        • Else - Actions
          • Custom script: call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdx","Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdx")
It does nothing, I know.
I want to make it so that whenever a player's camera is in "RegionA" and "RegionB," the lights turn off for that player specifically (like @Sir Moriarty and @MyPad mentioned),
but then turn back on when they leave that region.
So, how exactly do I go about executing this?
 
There is this function which you can use in the if-conditional statement:

JASS:
function RectContainsCoords(rect r, real x, real y) returns boolean

Don't be confused with the rect type, it is simply the JASS equivalent of the GUI region type.
Now, you can use the following natives:

JASS:
constant native GetCameraTargetPositionX() returns real
constant native GetCameraTargetPositionY() returns real

Use those two natives as the parameters in RectContainsCoords. However, you may have to use custom script in its' entirety...

JASS:
if <condition> then
    call SetDayNightModels("","")
else
    call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdx","Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdx")
endif
 
Status
Not open for further replies.
Top