| 10-14-2007, 05:42 PM | #1 |
This trigger simply checks if the target of the items ability is in one of two regions ( rects ) but it keeps giving me a missing endif and I can't quite put my finger on my problem. Edit: I realised I did somthing very wrong (I solved it) so Im updating my post to reflect recent changes. Original Code JASS:function LockedConditions takes nothing returns boolean if ( GetSpellAbilityId() == 'A00D' ) then return true endif return false endfunction function Locked takes nothing returns nothing local unit u = GetTriggerUnit() local location l = GetSpellTargetLoc() local real x = GetLocationX(l) local real y = GetLocationY(l) if x<GetRectMaxX(gg_rct_SentryRoom) or x>GetRectMinX(gg_rct_SentryRoom) or y<GetRectMaxY(gg_rct_SentryRoom) or y>GetRectMinY(gg_rct_SentryRoom) then call IssueImmediateOrder(u,"holdposition") call RemoveLocation(l) set l = null set u = null elseif x<GetRectMaxX(gg_rct_LockedRoom) or x>GetRectMinX(gg_rct_LockedRoom) or y<GetRectMaxY(gg_rct_LockedRoom) or y>GetRectMinY(gg_rct_LockedRoom) then call IssueImmediateOrder(u,"holdposition") call RemoveLocation(l) set l = null set u = null endif endfuntion //=========================================================================== function InitTrig_Locked takes nothing returns nothing set gg_trg_Locked = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( gg_trg_Locked, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Locked, Condition( function LockedConditions ) ) call TriggerAddAction( gg_trg_Locked, function Locked ) endfunction JASS:function LockedConditions takes nothing returns boolean return GetSpellAbilityId() == 'A00D' endfunction function Locked takes nothing returns nothing local unit u = GetTriggerUnit() local location l = GetSpellTargetLoc() local real x = GetLocationX(l) local real y = GetLocationY(l) if x<GetRectMaxX(gg_rct_SentryRoom) and x>GetRectMinX(gg_rct_SentryRoom) and y<GetRectMaxY(gg_rct_SentryRoom) and y>GetRectMinY(gg_rct_SentryRoom) then call IssueImmediateOrder(u,"holdposition") call RemoveLocation(l) set l = null set u = null elseif x<GetRectMaxX(gg_rct_LockedRoom) and x>GetRectMinX(gg_rct_LockedRoom) and y<GetRectMaxY(gg_rct_LockedRoom) and y>GetRectMinY(gg_rct_LockedRoom) then call IssueImmediateOrder(u,"holdposition") call RemoveLocation(l) set l = null set u = null endif endfunction //=========================================================================== function InitTrig_Locked takes nothing returns nothing set gg_trg_Locked = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( gg_trg_Locked, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Locked, Condition( function LockedConditions ) ) call TriggerAddAction( gg_trg_Locked, function Locked ) endfunction |
| 10-14-2007, 05:53 PM | #2 |
You mistyped endfuntion in the second funtion. |
| 10-14-2007, 05:56 PM | #3 |
Thanks for replying so fast, it worked! [+ rep] |
| 10-14-2007, 06:27 PM | #4 |
Unrelated: function LockedConditions could be simplified- all it has to be is: JASS:function LockedConditions takes nothing returns boolean return GetSpellAbilityId() == 'A00D' endfunction |
| 10-14-2007, 06:33 PM | #5 |
Implemented!Thanks for your input. [+rep] |
