If i understand correctly the scenario you are describing, then the problem is that your code is running -before- everything in the game is finished loading properly.
-Do not run the code until after PLAYER_ENTERING_WORLD has fired.
-Possibly run it 1 second after the event has triggered. Take a look at the C_Timer.After() function to make a callback function to yourself.
Does the code have to be executed the instant the user is logging in/reloading?
Maybe use some other event or function that you can hook into (player moved, character tab opened).
You mention UNIT_INVENTORY_CHANGED firing 112 times; You could always change it so that your code only runs once and ignores the other 111 times it's fired:
-unregister from the event after the first time its triggered
-use a boolean to stop the code executing more than once (booFirstTime = false/true)
Last edited by Jarod24 : 07-12-15 at 07:06 AM.
|