• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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,069
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