• 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.

[General] DNCs and GetLocalPlayer

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2012
Messages
159
Hi there :)
I was wondering: is it possible to change DNCs (fx DNCLordaeronTerrian.mdx) for individuel players if their camera is within a specific area?

For instance, if a player's camera 'goes' into a dark forest I want it to become really dark and spooky while the camera is within the area. But it's a multiplayer map so ofcourse the DNCs should only change for that specific player. :)
 
Level 19
Joined
Dec 12, 2010
Messages
2,074
periodic trigger
check camera eye position
if (x/y in the region of forest AND CurrentLighter != wood) then set light to the one you need
save integer CurrentLighter=Wood, for instance, to keep track of currently active light
else Set default light and set CurrentLigher to anything else
 
Level 13
Joined
Nov 7, 2014
Messages
571
Here's a list of the DNC model paths.

You can use the GetLocalPlayer() and the native SetDayNightModels takes string terrainDNCFile, string unitDNCFile returns nothing natives:
JASS:
local player p = Player(0) // Player Red
if p == GetLocalPlayer() then
    call SetDayNightModels("Environment\\DNC\\DNCAshenvale\\DNCAshenValeTerrain\\DNCAshenValeTerrain.mdx", "Environment\\DNC\\DNCAshenvale\\DNCAshenValeUnit\\DNCAshenValeUnit.mdx")
endif
to change a specific player's DNC models.

You can determine a player's camera target x/y coordinates with these natives
JASS:
constant native GetCameraTargetPositionX    takes nothing returns real
constant native GetCameraTargetPositionY    takes nothing returns real
constant native GetCameraTargetPositionZ    takes nothing returns real
constant native GetCameraTargetPositionLoc  takes nothing returns location

...

local player p = Player(0)
local real x
local real y
if p == GetLocalPlayer() then
    set x = GetCameraTargetPositionX()
    set y = GetCameraTargetPositionY()
endif

and if a point is within a rect with:
JASS:
function IsPointInRect takes rect r, real x, real y returns boolean
    return (GetRectMinX(r) <= x and x <= GetRectMaxX(r)) and (GetRectMinY(r) <= y and y <= GetRectMaxY(r))
endfunction

With that said you should be able to do what DracoL1ch described.
 
Status
Not open for further replies.
Top