ZachHandley
New Member
- Reaction score
- 1
So as the title suggests, I need to make a custom win. But it's not the game win, just a battle win. Normally I'd detect every unit thats in the enemies base and when they're all dead just say hey you win now go back to your base. But the problem is that the game I'm making isn't made that way, and the buildings don't die.
Meaning when they get to less than or equal to ten health they go invulnerable and play the death animation.
Here's the code for that trigger.
So if that's what happens, which is what's supposed to happen. How do I make it so that when a players buildings are all "destroyed", then they "win" the battle.
About the Map: It's a free for all of 6 players, and to attack they have to spawn units in to kill the enemies buildings from the reserve they have at home.
I was thinking a local boolean loaded from a hashtable. But not sure where to go from there.
Meaning when they get to less than or equal to ten health they go invulnerable and play the death animation.
Here's the code for that trigger.
JASS:
function NoKillBuildings takes nothing returns nothing
local unit u = GetTriggerUnit()
if ( GetUnitStateSwap(UNIT_STATE_LIFE, u) <= 10) and (IsUnitType(u, UNIT_TYPE_STRUCTURE)) then
call SetUnitAnimation( u, "death" )
call SetUnitInvulnerable( u, true )
endif
set u = null
endfunction
//===========================================================================
function InitTrig_No_Kill_Buildings takes nothing returns nothing
set gg_trg_No_Kill_Buildings = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_No_Kill_Buildings, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_No_Kill_Buildings, function NoKillBuildings )
endfunction
So if that's what happens, which is what's supposed to happen. How do I make it so that when a players buildings are all "destroyed", then they "win" the battle.
About the Map: It's a free for all of 6 players, and to attack they have to spawn units in to kill the enemies buildings from the reserve they have at home.
I was thinking a local boolean loaded from a hashtable. But not sure where to go from there.