How to get ListenToGameEvent to work?
I have the following code in my 'addon_game_mode.lua' file :
function CAddonTemplateGameMode:InitGameMode() print( "Template addon is loaded." ) GameRules:GetGameModeEntity():SetThink( "OnThink", self, "GlobalThink", 2 ) ListenToGameEvent("dota_inventory_item_changed", Dynamic_Wrap(CAddonTemplateGameMode, 'InventoryChange'), self) end
And elsewhere in the same file :
function CAddonTemplateGameMode:InventoryChange(keys) [rest of code here]
The rest of the code inside of InventoryChange does not matter, since it appears the interior of the InventoryChange function is not ever accessed.
I have tried the 'dota_inventory_changed' game event as well, which did not appear to work either.
What am I doing wrong? I cannot seem to find any tutorials on global events.