Problem when adding new weapons/abilities
Hey there,
I'm trying to add a new alien ability to the game, but somehow it throws me a strange error and I have no idea why.
I basically copied the SwipeBlink ability of the Fade and derived it from the Ability class. I also linked the class and loaded it on all three VMs: Client, Server, Predict.
The weapon gets added to the Alien player in the InitWeapons method on the Server VM.
This is the error message I get:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[Predict] Script Error #485: lua/Player.lua:693: attempt to call method 'OnUpdateWeapon' (a nil value)
Call stack:
[Client] Script Error #419: lua/Player.lua:693: attempt to call method 'OnUpdateWeapon' (a nil value)
Call stack:
#1: WeaponUpdate lua/Player.lua:693
#1: WeaponUpdate lua/Player.lua:693
self = Fade-1759 {activeWeaponId=373, ... [removed variable spam]}
self = Fade-1759 {activeWeaponId=373, ... [removed variable spam] }
weapon = PropDynamic-373 { [removed variable spam] }<!--c2--></div><!--ec2-->
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[Client] Script Error #2: lua/Player.lua:1090: attempt to call method 'ConstrainMoveVelocity' (a nil value)
Call stack:
#1: ComputeForwardVelocity lua/Player.lua:1090
self = Fade-1759 {[removed variable spam] }
input = Move {[removed variable spam]}
forwardVelocity = Vector {x=0, y=0, z=0 }
move = Vector {x=0, y=0, z=0 }
angles = Angles {pitch=0, roll=0, yaw=6.0254726409912 }
viewCoords = Coords {[removed variable spam] }
accel = 65
moveVelocity = Vector {x=0, y=0, z=0 }
activeWeapon = PropDynamic-373 {[removed variable spam] }<!--c2--></div><!--ec2-->
As you might see, the active weapon is a PropDynamic, but I have no idea why.
Here's the code:
<a href="https://github.com/myrio/ns2-hidden/blob/master/lua/HiddenFade_Server.lua" target="_blank">Fade_Server.lua</a>
<a href="https://github.com/myrio/ns2-hidden/blob/master/lua/HiddenFade.lua" target="_blank">Fade.lua</a>
<a href="https://github.com/myrio/ns2-hidden/blob/master/lua/HiddenSwipeLeap.lua" target="_blank">NewAbility.lua</a>
Has anyone got an idea what I'm doing wrong here?
I'm trying to add a new alien ability to the game, but somehow it throws me a strange error and I have no idea why.
I basically copied the SwipeBlink ability of the Fade and derived it from the Ability class. I also linked the class and loaded it on all three VMs: Client, Server, Predict.
The weapon gets added to the Alien player in the InitWeapons method on the Server VM.
This is the error message I get:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[Predict] Script Error #485: lua/Player.lua:693: attempt to call method 'OnUpdateWeapon' (a nil value)
Call stack:
[Client] Script Error #419: lua/Player.lua:693: attempt to call method 'OnUpdateWeapon' (a nil value)
Call stack:
#1: WeaponUpdate lua/Player.lua:693
#1: WeaponUpdate lua/Player.lua:693
self = Fade-1759 {activeWeaponId=373, ... [removed variable spam]}
self = Fade-1759 {activeWeaponId=373, ... [removed variable spam] }
weapon = PropDynamic-373 { [removed variable spam] }<!--c2--></div><!--ec2-->
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[Client] Script Error #2: lua/Player.lua:1090: attempt to call method 'ConstrainMoveVelocity' (a nil value)
Call stack:
#1: ComputeForwardVelocity lua/Player.lua:1090
self = Fade-1759 {[removed variable spam] }
input = Move {[removed variable spam]}
forwardVelocity = Vector {x=0, y=0, z=0 }
move = Vector {x=0, y=0, z=0 }
angles = Angles {pitch=0, roll=0, yaw=6.0254726409912 }
viewCoords = Coords {[removed variable spam] }
accel = 65
moveVelocity = Vector {x=0, y=0, z=0 }
activeWeapon = PropDynamic-373 {[removed variable spam] }<!--c2--></div><!--ec2-->
As you might see, the active weapon is a PropDynamic, but I have no idea why.
Here's the code:
<a href="https://github.com/myrio/ns2-hidden/blob/master/lua/HiddenFade_Server.lua" target="_blank">Fade_Server.lua</a>
<a href="https://github.com/myrio/ns2-hidden/blob/master/lua/HiddenFade.lua" target="_blank">Fade.lua</a>
<a href="https://github.com/myrio/ns2-hidden/blob/master/lua/HiddenSwipeLeap.lua" target="_blank">NewAbility.lua</a>
Has anyone got an idea what I'm doing wrong here?