[Event bugged] onObjectShot()

Started by karan20000000000, Apr 17, 2015, 03:17 PM

Previous topic - Next topic

karan20000000000

This event seems to be giving wrong information as well as useless errors.
For example i created three objects and enabled their TrackingShots in a test script with the model and id as follows:
440, ID: 0
440, ID: 1
440, ID: 2
And onObjectShot event as follows:
function onObjectShot(player,object,weapon)
{
  print(object.Model+",.. ID: "+object.ID);
}
And then this was the output:
AN ERROR HAS OCCURED [Member Variable not found]
CALLSTACK
*FUNCTION [onObjectShot()] testing.nut line [142]
LOCALS
[weapon] 17
[object] INSTANCE
[player] INSTANCE
[this] TABLE


After this i changed the code in the event a bit as follows:
function onObjectShot(player,obje,weapon)
{
  local object = FindObject(obje.ID);
  print(object.Model+",.. ID: "+object.ID);
}

This time there were no errors in console but every time I shot any object, the model id and the ID of the  first object was being printed in console and the model id and ID of that new object was not being printed.
Output when I created objects:
[SCRIPT]  440, ID: 0
[SCRIPT]  450, ID: 1
[SCRIPT]  460, ID: 2

Output when I shot the objects:
[SCRIPT]  440,.. ID: 0
[SCRIPT]  440,.. ID: 0
[SCRIPT]  440,.. ID: 0
With regards,
KP
------------------------------------------

Gudio

Correct parameters: object, player, weapon.
Please follow wiki next time.
Not a bug.

Stormeus