Wellllllll.....I haven't a danmdest clue why this wont work. The problem is this. We have caves, and when we kill the rubble in front of the cave the caves is "open", when we destroy a dummy object you collapse the cave and thuse closing it. This all works well and good, BUT the problem is this. Units are suppose to spawn when the cave is considered "open" and not spawn when it is "closed". Only problem is that it seems as if after i initlilize the values the caves wont change from being closed or open.
Code for the caves
Code that uses Cave info
Now i am 99.9% sure that the problem lies within the IsCaveOpen function. But i have checked it a ton and have no idea. My only theory is that the sethandlehandle function when using like a location doesn;t define the string based of the data but the memory location. But if thats true....BGSDFSAADASDA
Whatever. And don't say be more specific or something cause if your confused you won't be able to answer my question.
Code for the caves
JASS:
function SetCaveOpen takes location l returns nothing
call SetHandleInt(l, "open", 1)
endfunction
function SetCaveClosed takes location l returns nothing
call SetHandleInt(l, "open", 2)
endfunction
function IsCaveOpen takes location cave returns boolean
if GetHandleInt(cave, "open") == 1 then
return true
else
return false
endif
endfunction
function CloseCave takes unit u returns nothing
local location temp = GetUnitLoc(u)
//call KillUnit(u)
call SetCaveClosed(temp)
call SetCaveCreepProgression(I2R(0), GetUnitLoc(u))
call CreateUnitAtLoc(Player(15), GetCaveClosedId(), temp, I2R(0))
set temp = null
endfunction
//////////////////////////////////////////
function OpenCave takes unit u returns nothing
local location temp = GetUnitLoc(u)
//call DisplayTextToPlayer(Player(0), 0,0, "New Unit Loc is" + R2S(GetLocationX(temp)) + "," + R2S(GetLocationY(temp)))
//call KillUnit(u)
call CreateUnitAtLoc(Player(15), GetCaveOpenId(), temp, I2R(0))
call SetCaveOpen(temp)
call SetCaveCreepProgression(GetCreepSpeed(), temp)
set temp = null
endfunction
function Trig_Caves takes nothing returns nothing
if(GetUnitTypeId(GetTriggerUnit()) == GetCaveClosedId()) then
call OpenCave(GetTriggerUnit())
else
call CloseCave(GetTriggerUnit())
endif
endfunction
function InitTrig_Caves takes nothing returns nothing
set gg_trg_Caves = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(gg_trg_Caves,Player(15), EVENT_PLAYER_UNIT_DEATH , null)
call TriggerAddCondition(gg_trg_Caves, Condition(function Trig_UnitCaveCheck))
call TriggerAddAction(gg_trg_Caves, function Trig_Caves)
endfunction
JASS:
function SpawnWeak takes nothing returns nothing
local integer i = 0
loop
exitwhen i > udg_numCaves
if IsCaveOpen(udg_Caves[i]) then
call SpawnZerglings(udg_Caves[i])
call SpawnHydralisks(udg_Caves[i])
else
call DisplayTextToPlayer(Player(0), 0,0, "CaveClosed!" + R2S(GetLocationX(udg_Caves[i])) + "," + R2S(GetLocationY(udg_Caves[i])))
endif
set i = i + 1
endloop
endfunction
function SpawnMedium takes nothing returns nothing
local integer i = 0
loop
exitwhen i > udg_numCaves
if IsCaveOpen(udg_Caves[i]) then
call SpawnZerglings(udg_Caves[i])
call SpawnHydralisks(udg_Caves[i])
else
call DisplayTextToPlayer(Player(0), 0,0, "CaveClosed!" + R2S(GetLocationX(udg_Caves[i])) + "," + R2S(GetLocationY(udg_Caves[i])))
endif
set i = i + 1
endloop
endfunction
function SpawnHard takes nothing returns nothing
local integer i = 0
loop
exitwhen i > udg_numCaves
if IsCaveOpen(udg_Caves[i]) then
call SpawnZerglings(udg_Caves[i])
call SpawnHydralisks(udg_Caves[i])
call SpawnUltralisks(udg_Caves[i])
endif
set i = i + 1
endloop
endfunction
function wave takes nothing returns nothing
if udg_GameStage == 1 then
//call CreepProgression()
call SpawnWeak()
elseif udg_GameStage == 2 then
//call CreepProgression()
call SpawnMedium()
elseif udg_GameStage == 3 then
//call CreepProgression()
call SpawnHard()
endif
//call CreepProgression()
endfunction
function Trig_Waves takes nothing returns nothing
local integer i = 0
set udg_Wave = CreateTrigger()
call TriggerAddAction(udg_Wave, function wave)
if GetGameMode() == 2 then
call TriggerSleepAction(10)
call StageIncreased()
loop
exitwhen i > GetWavesPerStage()
call TriggerExecute(udg_Wave)
call TriggerSleepAction(20)
endloop
call StageIncreased()
set i = 0
loop
exitwhen i > GetWavesPerStage()
call TriggerExecute(udg_Wave)
call TriggerSleepAction(20)
endloop
call StageIncreased()
set i = 0
loop
exitwhen i > 10000
call TriggerExecute(udg_Wave)
call TriggerSleepAction(20)
endloop
endif
endfunction
function InitTrig_Waves takes nothing returns nothing
set gg_trg_Waves = CreateTrigger()
call TriggerRegisterTimerEventSingle(gg_trg_Waves, 4.00)
call TriggerAddAction(gg_trg_Waves, function Trig_Waves)
endfunction
Now i am 99.9% sure that the problem lies within the IsCaveOpen function. But i have checked it a ton and have no idea. My only theory is that the sethandlehandle function when using like a location doesn;t define the string based of the data but the memory location. But if thats true....BGSDFSAADASDA
Whatever. And don't say be more specific or something cause if your confused you won't be able to answer my question.
Last edited by a moderator: