| 11-13-2009, 03:53 AM | #1 |
Well boy howdy, here is a fun new bug :/ Zinc:Library SomeLib { function B2S(boolean b) { if(b) return "true"; return "false"; } function onInit() { unit u = CreateUnit(Player(0),'Hpal',0,0,0); BJDebugMsg(B2S(UnitAddItemToSlotById(u,'rag1',9))); BJDebugMsg(B2S(UnitAddItemToSlotById(u,'rag1',-9))); } Thats right the item actually gets added to the hero. Oh and it gets better, whenever you try to leave the game or remove the hero it causes the game to crash. Whats more you can even remove the item and it still crashes on hero removal. This here is a library to prove the point. By the way, I love anonymous functions. Zinc://! zinc library test { item Item; unit Unit; trigger T; function onInit() { Unit = CreateUnit(Player(0),'Hpal',0,0,0); T = CreateTrigger( ); TriggerRegisterAnyUnitEventBJ( T, EVENT_PLAYER_UNIT_PICKUP_ITEM ); TriggerAddAction( T, function() { timer t = CreateTimer(); Unit = GetManipulatingUnit(); Item = GetManipulatedItem(); BJDebugMsg("Item Acquired!"); BJDebugMsg(I2S(GetHandleId(Item))); TimerStart(t,0,false,function(){RemoveItem(Item);DestroyTimer(GetExpiredTimer());}); } ); UnitAddItemToSlotById(Unit,'rag1',-1); } } //! endzinc |
| 11-13-2009, 06:13 AM | #2 |
It's funny that it lets you "add" an item to a negative item slot. :p |
| 11-13-2009, 07:53 AM | #3 |
This is not bug, just like reverse on 100kmh breaking engine. |
| 11-13-2009, 11:32 PM | #4 |
I don't understand the analogy, but yeah no it is totally a bug. You should not be able to add items to negative spots. And if you do the item isn't real so you can't drop it. You can remove its memory, but when warcraft3 tries to release the memory of the hero it gets all wierded out by the negative index and crashes. |
| 11-14-2009, 04:37 AM | #5 |
remember slot 8191 and savegame\loadgame stupid user == bugs. |
| 11-14-2009, 08:56 AM | #6 |
I don't see why using the index 8191 is stupid ... Especially for vJass extended arrays. Ofc only if we hadn't this stupid bug. I had never the use of it but i think some extended item systems use this bug, but it seems only some negative slots works "properly". |
