Adding different arm positions for weapons help
by Tim Heldna · in Torque Game Engine · 10/07/2004 (4:12 pm) · 7 replies
I'm in need more help on trying to get a different arm position when swaping
different guns. Im pretty new to scripting so it would be great if a little
more detail can be used.
Ive gone through all the scripts, turorials and this is one thing that I can't find
anything on!
different guns. Im pretty new to scripting so it would be great if a little
more detail can be used.
Ive gone through all the scripts, turorials and this is one thing that I can't find
anything on!
About the author
#2
ie:
in the function Weapon::onUse that is in the weapon.cs file
where armThread is a script variable defined in the image of the weapon which contains the sequence name
10/08/2004 (2:21 am)
You have to use the setArmThread function, passing the name of the sequence that contains the arm animationie:
in the function Weapon::onUse that is in the weapon.cs file
Weapon::onUse(%data, %obj)
{
...
%obj.setArmThread(%data.image.armThread);
...
}where armThread is a script variable defined in the image of the weapon which contains the sequence name
#3
10/08/2004 (2:27 am)
For a custom solution you may want to look in the player class at how the recoilSequences are used (search 'recoilSequence'). However, as this comment suggests, its only clientside.
#4
10/09/2004 (4:19 pm)
I do it in the onMount function, and you might want to throw an if statement in there.function WeaponImage::onMount(%this,%obj,%slot)
{
// Images assume a false ammo state on load. We need to
// set the state according to the current inventory.
if (%obj.getInventory(%this.ammo))
%obj.setImageAmmo(%slot,true);
if (%this.armthread $= "")
%obj.setArmThread(look);
else
%obj.setArmThread(%this.armThread);
}
#5
But if you use the standard torque, either your solution works well, because you can use only the weapon that you mount
10/10/2004 (1:23 am)
I don't do it in the onMount function because when the player is spawned I mount several weapons on it but I use only one at a time :)But if you use the standard torque, either your solution works well, because you can use only the weapon that you mount
#6
what do I need to enter into the the e.g crossbow.cs file to
call on my second armThread animation?
Thanks
10/10/2004 (1:53 pm)
Ok, so if i enter the armThread code into the weapon.cs filewhat do I need to enter into the the e.g crossbow.cs file to
call on my second armThread animation?
Thanks
#7
i figured out why -- the mArmAnimation.thread variable was NULL in player.cc ... apparently this is initialized when you have a look animation ONLY..... so you might be able to fix this by loading up a look somehow.
i fixed this by modding the C++ by adding this code:
right at the beginning of Player::setArmThread
i post this here to save anyone interested in armThreads the heinous debugging i had to get into.
01/04/2007 (4:10 pm)
My game was crashing whenever i called setArmThread(....) i figured out why -- the mArmAnimation.thread variable was NULL in player.cc ... apparently this is initialized when you have a look animation ONLY..... so you might be able to fix this by loading up a look somehow.
i fixed this by modding the C++ by adding this code:
if (!mArmAnimation.thread) mArmAnimation.thread = mShapeInstance->addThread();
right at the beginning of Player::setArmThread
i post this here to save anyone interested in armThreads the heinous debugging i had to get into.
Torque Owner Erik Madison