- Joined
- Apr 3, 2018
- Messages
- 499
Very impressive and looks good in game.
Somehow no triggers or import show up in the editor but they are there if the map is opened with an MPQ editor.
It can be a bit difficult to import a spell if you can't see the triggers or the imported files. Can you add importing instructions to the resource description?
Somehow no triggers or import show up in the editor but they are there if the map is opened with an MPQ editor.
It can be a bit difficult to import a spell if you can't see the triggers or the imported files. Can you add importing instructions to the resource description?
JASS:
globals
integer chatCmdNargs = 0
string array chatCmdArgs
string array dncTs
string array dncUs
integer ndnc
endglobals
function print takes string s returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0.0, 0.0, 10.0, s)
endfunction
function chatCmdsTokenize takes string s returns nothing
local integer ns = StringLength(s)
local integer p = 0
local integer start
local string c
set chatCmdNargs = 0
loop
loop
set c = SubString(s, p, p + 1)
exitwhen " " != c
set p = p + 1
endloop
exitwhen "" == c
set start = p
loop
set c = SubString(s, p, p + 1)
exitwhen " " == c
exitwhen "" == c
set p = p + 1
endloop
set chatCmdArgs[chatCmdNargs] = SubString(s, start, p)
set chatCmdNargs = chatCmdNargs + 1
endloop
endfunction
function ccI takes integer idx returns integer
return S2I(chatCmdArgs[idx])
endfunction
function ccF takes integer idx returns real
return S2R(chatCmdArgs[idx])
endfunction
function ccS takes integer idx returns string
return chatCmdArgs[idx]
endfunction
function chatCmdsDispatch takes nothing returns nothing
local integer a = 0 - 1
loop
set a = a + 1
exitwhen 16 == a
set chatCmdArgs[a] = ""
endloop
call chatCmdsTokenize(GetEventPlayerChatString())
call ExecuteFunc("onPlayerChatEvent")
endfunction
function chatCmdsInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0), "", false)
call TriggerAddAction(t, function chatCmdsDispatch)
endfunction
function dncsInit takes nothing returns nothing
set dncTs[0] = "Environment\\DNC\\DNCAshenvale\\DNCAshenValeTerrain\\DNCAshenValeTerrain.mdx"
set dncTs[1] = "Environment\\DNC\\DNCDalaran\\DNCDalaranTerrain\\DNCDalaranTerrain.mdx"
set dncTs[2] = "Environment\\DNC\\DNCDungeon\\DNCDungeonTerrain\\DNCDungeonTerrain.mdx"
set dncTs[3] = "Environment\\DNC\\DNCFelwood\\DNCFelWoodTerrain\\DNCFelWoodTerrain.mdx"
set dncTs[4] = "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdx"
set dncTs[5] = "Environment\\DNC\\DNCUnderground\\DNCUndergroundTerrain\\DNCUndergroundTerrain.mdx"
set dncTs[6] = "models\\dnctest_t.mdx"
set dncUs[0] = "Environment\\DNC\\DNCAshenvale\\DNCAshenValeUnit\\DNCAshenValeUnit.mdx"
set dncUs[1] = "Environment\\DNC\\DNCDalaran\\DNCDalaranUnit\\DNCDalaranUnit.mdx"
set dncUs[2] = "Environment\\DNC\\DNCDungeon\\DNCDungeonUnit\\DNCDungeonUnit.mdx"
set dncUs[3] = "Environment\\DNC\\DNCFelwood\\DNCFelWoodUnit\\DNCFelWoodUnit.mdx"
set dncUs[4] = "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdx"
set dncUs[5] = "Environment\\DNC\\DNCUnderground\\DNCUndergroundUnit\\DNCUndergroundUnit.mdx"
set dncUs[6] = dncUs[4]
set ndnc = 7
endfunction
function setDnc takes integer a returns nothing
call SetDayNightModels(dncTs[a], dncUs[a])
endfunction
function setSun takes integer a returns nothing
local string s = I2S(a)
call SetDayNightModels("models\\dnc_t_" + s + ".mdx", "models\\dnc_u_" + s + ".mdx")
endfunction
function updateSun takes nothing returns nothing
local real t = GetTimeOfDay()
local integer a
set a = R2I((t / 24.0) * 360)
set a = ModuloInteger(a - 0, 360)
// if a < 0 then
// set a = 0
// elseif 359 < a then
// set a = 359
// endif
call setSun(a)
// call print(I2S(a))
endfunction
function onPlayerChatEvent takes nothing returns nothing
local string C = ccS(0)
if "a" == C then
call setDnc(ccI(1))
elseif "t" == C then
call SetTimeOfDay(ccF(1))
elseif "ts" == C then
call SetTimeOfDayScale(ccF(1))
elseif "s" == C then
call setSun(ccI(1))
elseif "d" == C then
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, ccF(1), 0.0)
endif
endfunction
function onMapInit1 takes nothing returns nothing
call SetCameraField(CAMERA_FIELD_FARZ, 10*1000.0, 0.0)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 3000.0, 0.0)
call SetTimeOfDayScale(35.0)
call CreateUnit(Player(0), 'hfoo', 0.0, 0.0, 270.0)
call CreateUnit(Player(0), 'Hpal', 0.0, 0.0, 270.0)
call TimerStart(CreateTimer(), 0.1, true, function updateSun)
endfunction
function onMapInit0 takes nothing returns nothing
call dncsInit()
call chatCmdsInit()
call FogEnable(false)
call FogMaskEnable(false)
call SetTimeOfDay(6.0)
endfunction
function main takes nothing returns nothing
call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
call NewSoundEnvironment( "Default" )
call SetAmbientDaySound( "LordaeronSummerDay" )
call SetAmbientNightSound( "LordaeronSummerNight" )
call SetMapMusic( "Music", true, 0 )
call InitBlizzard( )
call onMapInit0()
call TimerStart(CreateTimer(), 0.0, false, function onMapInit1)
endfunction
function InitCustomPlayerSlots takes nothing returns nothing
call SetPlayerStartLocation( Player(0), 0 )
call SetPlayerColor( Player(0), ConvertPlayerColor(0) )
call SetPlayerRacePreference( Player(0), RACE_PREF_HUMAN )
call SetPlayerRaceSelectable( Player(0), true )
call SetPlayerController( Player(0), MAP_CONTROL_USER )
endfunction
function config takes nothing returns nothing
call SetMapName( "TRIGSTR_001" )
call SetMapDescription( "TRIGSTR_003" )
call SetPlayers( 1 )
call SetTeams( 1 )
call SetGamePlacement( MAP_PLACEMENT_USE_MAP_SETTINGS )
call DefineStartLocation( 0, 0.0, 0.0 )
call InitCustomPlayerSlots( )
call SetPlayerSlotAvailable( Player(0), MAP_CONTROL_USER )
call InitGenericPlayerSlots( )
endfunction
Last edited: