Trying to figure out why this doesn't work

trb92

Throwing science at the wall to see what sticks
Reaction score
142
Ok, I have this in my code
JASS:
function Trig_CollisionDamage_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'n000'
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),'n001',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),'n000',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:

Never actually happens. But it looks to me like it should work, could someone please explain to me why it doesn't?
 

Cohadar

master of fugue
Reaction score
209

trb92

Throwing science at the wall to see what sticks
Reaction score
142
Make that change, it works perfectly... Thank you Cohadar, I'll need to remember that.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top