• 🏆 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!

making full darkness on part of map

Status
Not open for further replies.
Level 11
Joined
Jul 17, 2013
Messages
544
ok so i have learned how to make full darkness (turn off light and make it so u can only have light with torch) i mean just like in this map
my question is is it possible to make it only for half of map? i cant do it for full map because meanwhile team 1 on same map is playing different story and turning off light would disturb them. if its not possible to do so then maybe some model exist which gives darkness? on map and i can use torch to make light?
 
Level 10
Joined
Dec 11, 2009
Messages
234
This type of darkness is achieved by making call SetDayNightModels( "", "" )
I have doubts if using local player will actually work without causing desync.
Do not have doubts... Because it works perfectly.
I use this method in my map (MWS Hardcore mentioned by OP),
just need to be careful with strings.
JASS:
function test()
    local string s1=""
    local string s2=""
        
    if GetPlayerId(GetLocalPlayer()) == 0 then
        set s1="Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl"
        set s2="Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl"
    endif

    call SetDayNightModels(s1,s2)

    set s1 = null
    set s2 = null
endfunction
 
Do not have doubts... Because it works perfectly.
I use this method in my map (MWS Hardcore mentioned by OP),
just need to be careful with strings.
JASS:
function test()
    local string s1=""
    local string s2=""
       
    if GetPlayerId(GetLocalPlayer()) == 0 then
        set s1="Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl"
        set s2="Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl"
    endif

    call SetDayNightModels(s1,s2)

    set s1 = null
    set s2 = null
endfunction
Creating a new string locally may cause a desync. It is best to declare all strings globally but utilize them locally.
 
Level 39
Joined
Feb 27, 2007
Messages
5,031
maddeem means something like this:
JASS:
globals
  string use1 = "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl"
  string use2 = "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl"
endglobals

function test()
    local string s1=""
    local string s2=""
       
    if GetPlayerId(GetLocalPlayer()) == 0 then
        set s1=use1
        set s2=use2
    endif

    call SetDayNightModels(s1,s2)

    set s1 = null
    set s2 = null
endfunction
 
Level 10
Joined
Dec 11, 2009
Messages
234
Creating a new string locally may cause a desync. It is best to declare all strings globally but utilize them locally.
You mean like this?
JASS:
globals
    string DNC_MODEL_TERRAIN_DEFAULT = "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl"
    string DNC_MODEL_UNIT_DEFAULT = "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl"
endglobals
 
function test()
    local string s1=""
    local string s2=""
     
    if GetPlayerId(GetLocalPlayer()) == 0 then
        set s1=DNC_MODEL_TERRAIN_DEFAULT
        set s2=DNC_MODEL_UNIT_DEFAULT
    endif

    call SetDayNightModels(s1,s2)

    set s1 = null
    set s2 = null
endfunction
UPD: LOL, we posted simultaneously
 
JASS:
function test takes nothing returns nothing
    local string s1="Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl"
    local string s2=""

 
    if GetPlayerId(GetLocalPlayer()) == 0 then
    call SetDayNightModels(s1,s1)
    else
    call SetDayNightModels(s2,s2)
    endif

    set s1 = null
    set s2 = null
endfunction
I worded that poorly. It doesn't have to be a global variable, but it when declaring a new string, you need to do it outside of a local player block. You can use local variables, similarly to how you used the globals when using strings.

Also, you don't need the other DNC model as far as I know.
 
Status
Not open for further replies.
Top