Dual Mounted weapons help
by Jose Salinas · in Torque 3D Beginner · 09/02/2014 (12:53 am) · 7 replies
Hi, I want both of my weapons to be mounted on the character at the same time and use a different key for each. I remember pulling it off with TGE but I can't seem to find the resource. Back then I knew nothing of programming, now I'm kinda getting the hang of it but I remember only setting another $weaponslot =1; and then modifying the onUse function. Is it possible to do? I tried %obj.getMountedImage but it doesn't seem to work.
Here is a small video of my work.
Here is a small video of my work.
About the author
3D artist/Game Designer
#2
09/02/2014 (12:52 pm)
Thank you. I have been looking at the script and changing it but I only get it to show but I can't use it.
#3
09/02/2014 (2:55 pm)
This is something to do with triggers (as in $Trigger0, $Trigger1, etc) - look at how alt-fire is handled, perhaps preempt the alt-fire for your off-hand weapon fire....
#4
If this is true then we need to know a couple of more things. Namely, how are you currently handling your weapon mounting? Images usual have a single mount point specified that they will use, but in your video I see the sword switching from a back mount position to the hand (and the same with the pistol on the side). How is this accomplished?
09/02/2014 (8:34 pm)
Alrighty then. I think I see from your video what you're trying to do, but correct me if I'm wrong. You want the sword and pistol mounted at the same time but to use them (both with the same hand) when two different keys are pressed?If this is true then we need to know a couple of more things. Namely, how are you currently handling your weapon mounting? Images usual have a single mount point specified that they will use, but in your video I see the sword switching from a back mount position to the hand (and the same with the pistol on the side). How is this accomplished?
#5
I want both mounted and use with different hands not with the same hand.
09/02/2014 (10:54 pm)
I have 3 weapon mounts, one on the back for the sword, another on the thigh for my custom gun and the reg mount0 for the guns of the soldier. Its 2 animations on for the sword and one for the soldier and I merge them with script in the state machine for the weapons thats why they look a little off.I want both mounted and use with different hands not with the same hand.
#6
function PlayerData::onAdd(%this, %obj)
{
// put the crossbow in the player's hand
%obj.mountImage(CrossBowImage, 0);
};
09/03/2014 (12:59 am)
any one know why this function doesnt work anymore?function PlayerData::onAdd(%this, %obj)
{
// put the crossbow in the player's hand
%obj.mountImage(CrossBowImage, 0);
};
#7
So you already have the player switching to and from the weapons, so now you just need to fire them. In client/default.bind.cs you will see that the "altTrigger" function uses "$mvTriggerCount1" for the alt fire. This will fire the weapon mounted in weapon slot 1. So if you mounted the gun using "mountImage(GunImage, 0)" and the sword with "mountImage(SwordImage, 1)" then the left mouse button would fire the gun and the right mouse would use the sword. Note the the actual mountPoints don't really matter. Only the actual weapon slot you choose when mounting the image.
09/03/2014 (9:28 am)
Mounting code in your onAdd function may be getting overwritten by the default inventory system. In server/game.cs you'll find the code that handles setting up the main inventory items as well as mounting the player's initial weapon with "GameConnection::loadOut". Furthermore, "onAdd" is called on the PlayerData name that is defined with the player's dataBlock (eg "Armor" for the default player setup). Check server/player.cs to see how "onAdd" is called in there. It might need to be "Armor::onAdd(%this, %obj)". So you already have the player switching to and from the weapons, so now you just need to fire them. In client/default.bind.cs you will see that the "altTrigger" function uses "$mvTriggerCount1" for the alt fire. This will fire the weapon mounted in weapon slot 1. So if you mounted the gun using "mountImage(GunImage, 0)" and the sword with "mountImage(SwordImage, 1)" then the left mouse button would fire the gun and the right mouse would use the sword. Note the the actual mountPoints don't really matter. Only the actual weapon slot you choose when mounting the image.
Torque Owner Caleb
Default Studio Name