Why would this happen?
by Tasty Green Pees :-, · in General Discussion · 04/29/2006 (3:58 am) · 5 replies
My ammo and weapon pickup sound was working fine until it suddenly stopped working.
the error I keep getting is this:
I get this error with both weapons and ammos. Why would it not be able to "find" the object? It certainly picks the weapon and ammo up alright .
here is the onPickUp function:
the error I keep getting is this:
MyGame/server/scripts/weapon.cs (121): Unable to find object: '1540' attempting to call function 'getTransform'
I get this error with both weapons and ammos. Why would it not be able to "find" the object? It certainly picks the weapon and ammo up alright .
here is the onPickUp function:
function Weapon::onPickup(%this, %obj, %shape, %amount)
{
// The parent Item method performs the actual pickup.
// For player's we automatically use the weapon if the
// player does not already have one in hand.
if (Parent::onPickup(%this, %obj, %shape, %amount))
{
serverPlay3D(WeaponPickupSound, %obj.getTransform());
if ((%shape.getClassName() $= "Player" || %shape.GetClassName() $= "AIPlayer") &&
%shape.getMountedImage($WeaponSlot) == 0)
{
%shape.use(%this);
}
}
}About the author
#2
04/29/2006 (4:41 am)
Ups, I just saw you posted in the public forums. Please move code related questions to the private forums.
#3
04/29/2006 (4:54 am)
This is script, it's fine to be in the public forums.
#4
04/29/2006 (5:12 am)
It should at least be in a Torque forum rather than general discussion.
#5
And Martin, u were right the object gets deleted on pickup which so when I call the getTransform there is nothing there anylonger.
04/29/2006 (6:24 am)
Sorry if i posted this on the wrong forum.And Martin, u were right the object gets deleted on pickup which so when I call the getTransform there is nothing there anylonger.
Torque Owner Martin Schultz
if (Parent::onPickup(%this, %obj, %shape, %amount)) { [b]error("Object ID of %obj: " @ %obj @ ", is it still an object? " @ isObject(%obj) );[/b] serverPlay3D(WeaponPickupSound, %obj.getTransform());Martin