| 07-14-2009, 09:47 AM | #1 |
Hello! I'm creating a new item shop system, but for the first tests it just didn't work. It actually didn't ran. What it does is when a item is bought, it checks if it's the item I want and then stores the id of the item in a 2D array variable, in a slot which belongs to the team of the player. I placed several debug messages across the code, but it didn't showed a single one. I guess it's another of my invisible bugs. Here is the code I've made: JASS:library ItemShops globals public constant integer iBlazzerId = 'I007' public integer array boughtItems [10][20] public integer array itemsIndex endglobals function ItemShops_Conditions takes nothing returns boolean call BJDebugMsg( "condition works" ) return GetUnitTypeId( GetManipulatingUnit( ) ) == 'H002' endfunction function ItemShops_Actions takes nothing returns nothing local item i = GetManipulatedItem( ) local integer id = GetItemTypeId( i ) local integer p = GetPlayerId( GetOwningPlayer( GetTriggerUnit( ) ) ) call BJDebugMsg( "actions works so far" ) call RemoveItem( i ) if id == iBlazzerId then call BJDebugMsg( I2S( itemsIndex[p] ) ) set boughtItems[p][itemsIndex[p]] = iBlazzerId set itemsIndex[p] = itemsIndex[p] + 1 call BJDebugMsg( I2S( boughtItems[p][itemsIndex[p]] ) ) call BJDebugMsg( I2S( itemsIndex[p] ) ) else endif set i = null endfunction //=========================================================================== function Init_ItemShops takes nothing returns nothing local trigger t = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM ) call BJDebugMsg( "Works" ) call TriggerAddCondition( t, Condition( function ItemShops_Conditions ) ) call TriggerAddAction( t, function ItemShops_Actions ) endfunction endlibrary I tried to remove the library part and remove the public statements, but it worked out the same. And I also tried to make the other functions public, no results though. Thanks in advance! Wizzy.. |
| 07-14-2009, 09:56 AM | #2 |
where is code fail i see debug but dont see any results posted also there is no initializer for library. |
| 07-14-2009, 10:01 AM | #3 |
so how do I initialize the library? library ItemShops initializer Init? [edit] tried that and it works. I thought that it could work without initializing them. Thanks for the help! +cookie |
