I have a trigger that when a unit starts construction of a windmill that it must just keep constructing it and deduct some values from variables but if they variable values arent high enough it should cancel the construction and remove the structure. Ingame, (the variables are high enough and it deducts them(i see that in multiboard) but when it starts building the unit dissapears its unselectable or anything but i put the builder in a unit groupt with ctrl+1 but if i select it it looks like its still constructing but in an inexisting building. Someone please help me, this is my trigger:
Its converted GUI since it's for my roc map and I had to convert it to jass, so I know its weird coding like if (not (.... but that's not the problem.
Edit: Still a problem look my other post but updated tirgger
Thanks in advance!
JASS:
function Trig_windmill_Conditions takes nothing returns boolean
return GetUnitTypeId(GetConstructingStructure()) == 'h002'
endfunction
function Trig_windmill_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetOwningPlayer(GetConstructingStructure())) + 1
if udg_lumber[i] >= 60 and udg_stone[i] >= 40 and udg_iron[i] >= 30 and udg_clay[i] >= 20 and udg_food[i] >= 0 then
set udg_lumber[i] = udg_lumber[i] - 60
set udg_stone[i] = udg_stone[i] - 40
set udg_iron[i] = udg_iron[i] - 30
set udg_clay[i] = udg_clay[i] - 20
set udg_food[i] = udg_food[i] - 0
else
call TriggerSleepAction(0)
call KillUnit(GetConstructingStructure())
endif
endfunction
//===========================================================================
function InitTrig_windmill takes nothing returns nothing
set gg_trg_windmill = CreateTrigger( )
call TriggerAddCondition( gg_trg_windmill, Condition( function Trig_windmill_Conditions))
call TriggerAddAction( gg_trg_windmill, function Trig_windmill_Actions )
endfunction
Its converted GUI since it's for my roc map and I had to convert it to jass, so I know its weird coding like if (not (.... but that's not the problem.
Edit: Still a problem look my other post but updated tirgger
Thanks in advance!
Last edited: