cr4xzZz
Also known as azwraith_ftL.
- Reaction score
- 51
I tried to make a trigger that periodically changes the terrain on the map, but for some reason it's not working at all... What have I done wrong? :\
EDIT: Answered and fixed.
EDIT: Answered and fixed.
JASS:
scope Deform initializer Init
globals
private constant real PERIOD = 60.
private constant integer SNOW1 = 039;Nsnw039;
private constant integer SNOW2 = 039;Nice039;
private constant integer SNOW3 = 039;Ngrs039;
private constant integer SNOW4 = 039;Nrck039;
private constant integer FALL1 = 039;Fdrg039;
private constant integer FALL2 = 039;Fgrs039;
private constant integer FALL3 = 039;Fgrd039;
private constant integer FALL4 = 039;Fdro039;
private constant integer GRASS1 = 039;Vgrs039;
private constant integer GRASS2 = 039;Lgrs039;
private constant integer GRASS3 = 039;Lgrd039;
private constant integer GRASS4 = 039;Vgrt039;
endglobals
private function Actions takes nothing returns nothing
local integer i1 = GetRandomInt(1, 3)
local integer i2 = 0
local integer i3 = GetRandomInt(1,3)
local real x
local real y
if i3 == 1 then
loop
exitwhen i2 > 1000
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, SNOW1, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, SNOW2, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, SNOW3, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, SNOW4, -1, i1, 0)
set i2 = i2 + 1
set i1 = GetRandomInt(1, 3)
endloop
elseif i3 == 2 then
loop
exitwhen i2 > 1000
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, FALL1, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, FALL2, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, FALL3, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, FALL4, -1, i1, 0)
set i2 = i2 + 1
set i1 = GetRandomInt(1, 3)
endloop
elseif i3 == 3 then
loop
exitwhen i2 > 1000
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, GRASS1, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, GRASS2, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, GRASS3, -1, i1, 0)
set x = GetRandomReal(GetRectMinX(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea))
set y = GetRandomReal(GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))
call SetTerrainType(x, y, GRASS4, -1, i1, 0)
set i2 = i2 + 1
set i1 = GetRandomInt(1, 3)
endloop
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger trig = CreateTrigger()
//call DisableTrigger(trig) // for a game mode
call TriggerRegisterTimerEvent(trig, PERIOD, true)
call TriggerAddAction(trig, function Actions)
endfunction
endscope