trb92
Throwing science at the wall to see what sticks
- Reaction score
- 142
Ok, I have this in my code
The part that doesn't work is
I know this part isn't working, because this:
Never actually happens. But it looks to me like it should work, could someone please explain to me why it doesn't?
JASS:
function Trig_CollisionDamage_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 039;n000039;
endfunction
function Trig_CollisionDamage_Actions takes nothing returns nothing
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) - 3.00 ) )
endfunction
function MakeCollision takes nothing returns nothing
local location loc = GetDestructableLoc(GetEnumDestructable())
local trigger CollisionDamage = CreateTrigger()
call CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE),039;n001039;,loc,0.00)
call TriggerRegisterUnitInRangeSimple( CollisionDamage, 250, GetLastCreatedUnit())
call TriggerAddCondition( CollisionDamage, Condition( function Trig_CollisionDamage_Conditions ) )
call TriggerAddAction(CollisionDamage, function Trig_CollisionDamage_Actions)
call RemoveLocation(loc)
endfunction
function Trig_Manipulator_Init_Trigger_Actions takes nothing returns nothing
call RemoveUnit(CreateUnit(Player(0),039;n000039;,0.00,0.00,0.00))
call EnumDestructablesInRectAll( GetPlayableMapRect(), function MakeCollision )
endfunction
The part that doesn't work is
JASS:
local trigger CollisionDamage = CreateTrigger()
call TriggerRegisterUnitInRangeSimple( CollisionDamage, 250, GetLastCreatedUnit())
call TriggerAddCondition( CollisionDamage, Condition( function Trig_CollisionDamage_Conditions ) )
call TriggerAddAction(CollisionDamage, function Trig_CollisionDamage_Actions)
call RemoveLocation(loc)
I know this part isn't working, because this:
JASS:
call SetUnitLifeBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) - 3.00 ) )
Never actually happens. But it looks to me like it should work, could someone please explain to me why it doesn't?