- Joined
- Jul 26, 2008
- Messages
- 1,009
Hi, I was wondering how I could use a trigger to make a unit no longer purchasable at night from a nuetral building that sells them.
I just dont' want a certain unit from being purchasable during the Night, but available during the day. Also I want all of it's type to be removed from the map. Here is what I've done so far, which hasn't worked.
I just dont' want a certain unit from being purchasable during the Night, but available during the day. Also I want all of it's type to be removed from the map. Here is what I've done so far, which hasn't worked.
JASS:
//Night Trigger
function RemoveDamned takes nothing returns boolean
if GetUnitTypeId(GetEnumUnit()) == 'uC02' then
call KillUnit(GetEnumUnit())
endif
return false
endfunction
function Trig_Slowtime_Actions takes nothing returns nothing
local group g = CreateGroup()
call SetMapFlag(MAP_LOCK_SPEED, true)
call GroupEnumUnitsInRect(g, GetPlayableMapRect(), function RemoveDamned)
if IsPlayerInForce(GetLocalPlayer(), udg_BloodPackPlayer) then
call DisplayTextToPlayer(GetLocalPlayer(), 0,0, "Damned Souls are no longer available")
call SetPlayerTechMaxAllowed(GetLocalPlayer(), 'uC02', 0)
endif
if udg_EasyMode == 1 then
else
endif
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Slowtime takes nothing returns nothing
set gg_trg_Slowtime = CreateTrigger( )
call TriggerRegisterGameStateEvent(gg_trg_Slowtime, GAME_STATE_TIME_OF_DAY, EQUAL, 18.10)
call TriggerAddAction( gg_trg_Slowtime, function Trig_Slowtime_Actions )
endfunction
JASS:
//Day Trigger
function Trig_Skiptime_Actions takes nothing returns nothing
if IsPlayerInForce(GetLocalPlayer(), udg_BloodPackPlayer) then
call SetPlayerTechMaxAllowed(GetLocalPlayer(), 'uC02', -1)
endif
if udg_EasyMode == 1 then
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 7.10)
call SetTimeOfDayScale(1.15)
else
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 8.10)
call SetTimeOfDayScale(1.25)
endif
endfunction
//===========================================================================
function InitTrig_Skiptime takes nothing returns nothing
set gg_trg_Skiptime = CreateTrigger( )
call TriggerRegisterGameStateEvent(gg_trg_Skiptime, GAME_STATE_TIME_OF_DAY, EQUAL, 6.10)
call TriggerAddAction( gg_trg_Skiptime, function Trig_Skiptime_Actions )
endfunction