| 12-07-2006, 03:56 PM | #1 |
JASS:function Item_Pickup_Conditions takes nothing returns boolean return GetItemType(GetManipulatedItem()) == ITEM_TYPE_MISCELLANEOUS endfunction function Item_Pickup_Actions takes nothing returns nothing call BJDebugMsg("I am running") endfunction function InitTrig_Item_Pickup takes nothing returns nothing set gg_trg_Item_Pickup = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_Pickup, EVENT_PLAYER_UNIT_PICKUP_ITEM) call TriggerAddCondition(gg_trg_Item_Pickup, Condition(function Item_Pickup_Conditions)) call TriggerAddAction(gg_trg_Item_Pickup, function Item_Pickup_Actions) endfunction The trigger action never runs even when you pickup an item of type MISCELLANEOUS. Is there some itemtype bug I'm not aware of? Or am I doing something wrong? |
| 12-07-2006, 04:12 PM | #2 |
Do some debug messages. Does the condition run? Is it getting the right item? Et cetera. |
| 12-07-2006, 04:20 PM | #3 |
Using this Debug in the condition -- JASS:function Item_Pickup_Conditions takes nothing returns boolean call BJDebugMsg(GetItemName(i)) return GetItemType(GetManipulatedItem()) == ITEM_TYPE_MISCELLANEOUS endfunction And I am 100% sure the item type of the item is Miscellaneous. |
| 12-07-2006, 04:36 PM | #4 |
Well, FWIW, the couple times I tried something with item classes, I got the weirdest results when using any "misc" items. And all vanished once I switched to a decent item class... Now, what the actual feature would be... or even if there is one... I have no idea. All I know is that I never use "misc" if I need the class in a trigger. |
| 12-07-2006, 05:24 PM | #5 |
I i like campaign and artifact myself. Permanent is good too, but fills up quickly. |
| 12-07-2006, 07:40 PM | #6 |
There's an issue with bitflag checks and boolexprs, it might be that GetItemType is bugged. Try return (GetItemType(GetManipulatedItem()) == ITEM_TYPE_MISCELLANEOUS) == true |
| 12-07-2006, 07:55 PM | #7 |
That's unlikelly it is a comparission, and I highly doubt comparissions would ever return anything but 1 or 0. It would make sense if it was an IsItemType native or something like that |
| 12-07-2006, 08:48 PM | #8 |
Well I tried the identical code with everyother itemtype and it runs properly. It appears that MISCELLANEOUS is just bugged. Thanks guys. |
| 12-07-2006, 09:42 PM | #9 | |
Quote:
There actually is a bug with UNIT_TYPE_TOWNHALL when you use the the return boolexpr function JASS:return (IsUnitType(GetFilterUnit()) == UNIT_TYPE_TOWNHALL) will not work were as JASS:return (IsUnitType(GetFilterUnit()) == UNIT_TYPE_TOWNHALL) == true will work. There is a bug where for some wierd reason when the unit type is false it returns 64, not 1 (which is identified as false in booleans). It can easily be possible that there is a similar bug with ITEM_TYPE_MISCELLANEOUS EDIT: Got my natives mixed up |
| 12-07-2006, 11:16 PM | #10 |
I wouldn't believe your post at all since the GetUnitType native does not exist, instead there is an IsUnitType native which is not a JASS comparission but a native that seems to use bitflags. |
| 12-08-2006, 12:15 AM | #11 |
Woops, i typed this from school so I don't remember the natives completely correctly, there is a post on it in www.wc3jass.com http://www.wc3jass.com/viewtopic.php?t=2370 |
| 12-08-2006, 01:21 AM | #12 |
Kind of odd that you are referencing me to my own post, anyways what I am trying to say is that == is unlikelly to ever return things different than 0 or 1. So GetItemType(it)==something should not ever have this issue, no bitflags are involved. IsUnitType is a native that does the comparission internally and most likelly uses bitflags. So they behave different so there are no chances they got the same bug, |
