| 03-11-2009, 10:54 PM | #1 |
Ok, this is really strange. I am having trouble detecting a unit using an Artifact. Actively Used is set to true, and this is the code JASS:scope ItemTrigger private function Actions takes nothing returns nothing call BJDebugMsg("lawl") if GetItemType(GetManipulatedItem()) == ITEM_TYPE_ARTIFACT then call EquipItem(GetManipulatedItem(), GetManipulatingUnit()) endif endfunction private function InitTrig takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_USE_ITEM) call TriggerAddAction(t, function Actions) set t = null endfunction endscope Why is this not catching the item being used? The item has the "manual of hp" ability that adds 0 hp and plays no graphic. |
| 03-11-2009, 11:06 PM | #2 |
Why not detect the item ability? |
| 03-11-2009, 11:08 PM | #3 |
Already tried, does nothing as well. JASS:scope Test private function Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A02N' endfunction private function Actions takes nothing returns nothing call BJDebugMsg("lawl") endfunction //=========================================================================== function InitTrig takes nothing returns nothing local trigger t = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( t, Condition( function Conditions ) ) call TriggerAddAction( t, function Actions ) set t = null endfunction endscope Edit: Forgot to type JASS at the end of Hidden. Damn ninjas. |
| 03-11-2009, 11:15 PM | #4 |
So this function does not display "lawl"? |
| 03-11-2009, 11:19 PM | #5 |
try this snippet and tell us what it displays when you use the item... JASS:scope Debug initializer Init // *Show Order Id private function showorderid takes nothing returns nothing local integer id=GetIssuedOrderId() local unit u=GetOrderedUnit() if(StringLength(OrderId2String(id))>1)then call BJDebugMsg(GetUnitName(u)+" "+OrderId2String(id)) else call BJDebugMsg(GetUnitName(u)+" "+I2S(id)) endif set u=null endfunction //INITIALIZER //========================================= private function Init takes nothing returns nothing local trigger t=CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER ) call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER ) call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER ) call TriggerAddAction(t, function showorderid ) set t=null endfunction endscope |
| 03-11-2009, 11:19 PM | #6 |
That isn't going to change a single thing... Edit: i have something almost identical to that in my map actually. It returns 852008 |
| 03-11-2009, 11:22 PM | #7 |
Hmmm... try changing the InitTrig to a private function and then add an initializer InitTrig at the top of the scope. |
| 03-11-2009, 11:33 PM | #8 |
That works, but I have plenty of other triggers with the function InitTrig that are all private and work just fine without initializer. Strange. |
| 03-11-2009, 11:36 PM | #9 |
I'm not sure how well public function InitTrig works anymore, but that used to be the vJass syntax for initializers in scopes. Also, having the default function InitTrig_TriggerName might work as well. |
