- Joined
- Nov 25, 2008
- Messages
- 1,309
So in the current map I'm making Infection The terrain is given a random heightmap, which certain tiles are placed onto it based on the elevation. This weather takes the average of the elevation in a cell (512x512) of terrain and picks a weather type based on the value. The below function is what creates the weather. It says it is working and picking the correct weather types, but it fails to actually create the weather (in game no weather is visible).
I generate weather after terrain.
PS: Assume all global variables are correctly set up.
I generate weather after terrain.
JASS:
function CreateWeather takes nothing returns nothing
local real X=-udg_WorldSize
local real Y=0
local integer Index=0
local integer Wait=0
local integer ID=-1
local integer Weather=udg_WeatherType[0]
local integer Loop=0
loop
exitwhen X>=udg_WorldSize
set Y=-udg_WorldSize
loop
exitwhen Y>=udg_WorldSize
set ID=GetTerrainType(X+256,Y+256)
set Loop=0
loop
exitwhen Loop>10
if ID==udg_TileTypes[Loop]then
set Weather=udg_WeatherType[Loop]
endif
set Loop=Loop+1
endloop
call RemoveRect(udg_WeatherRects[Index])
set udg_WeatherRects[Index]=null
set udg_WeatherRects[Index]=Rect(X,Y,X+480,Y+480)
call RemoveWeatherEffect(udg_Weathers[Index])
set udg_Weathers[Index]=null
set udg_Weathers[Index]=AddWeatherEffect(udg_WeatherRects[Index],Weather)
call EnableWeatherEffect(udg_Weathers[Index],true)
//Code
set Index=Index+1
set Wait=Wait+1
if Wait>=10then
set Wait=0
call DisplayTextToPlayer(Player(0),0,0,"Weathering...")
call TriggerSleepAction(0.25)
endif
set Y=Y+512
endloop
set X=X+512
endloop
endfunction
PS: Assume all global variables are correctly set up.