Author Topic: Dual Wielding Weapons  (Read 1474 times)

I need to know how to make a weapon dual-wielded because I am workin on a dual-wield sword (I have icons and evrythin). If anyone can help you get a free  :nes: notrly
« Last Edit: June 06, 2009, 08:16:06 AM by AndreZ »


i would tell you but the emotes drive me away.

you have to have a second shapebaseimage datablock and mount the second datablock to your left hand, look at guns akimbo

Code: [Select]
function <WEAPONNAME>Image::onMount(%this, %obj, %slot)
{
   Parent::onMount(%this, %obj, %slot);
   //mount lefthanded gun
   %obj.mountImage(Left<WEAPONNAME>Image, 1);
   //%obj.playThread(0, armreadyboth);
}
function Dual<WEAPONNAME>Image::onUnMount(%this, %obj, %slot)
{
   Parent::onUnMount(%this, %obj, %slot);
   //unmount lefthanded gun
   %obj.unMountImage(1);
   //%obj.playThread(0, root);
}


function Left<WEAPONNAME>Image::onMount(%this, %obj, %slot)
{
   Parent::onMount(%this, %obj, %slot);
   %obj.playThread(1, armreadyboth);
}
function Left<WEAPONNAME>Image::onUnMount(%this, %obj, %slot)
{
   Parent::onUnMount(%this, %obj, %slot);
}

function <WEAPONNAME>Image::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
Parent::onFire(%this,%obj,%slot);

   //%obj.setImageTrigger(1,1);
}
Replace <WEAPONNAME> with the name of your weapon. Your also have to make another section of 'ItemData'; here's and example, from the Dual Mac 10.
Code: [Select]
datablock ShapeBaseImageData(LeftmacImage)
{
   // Basic Item properties
   shapeFile = "./mac10.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 1;
   offset = "0 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = BowItem;
   ammo = " ";
   projectile = mac10Projectile;
   projectileType = Projectile;

casing = gunShellDebris;
shellExitDir        = "1.0 -1.3 1.0";
shellExitOffset     = "0 0 0";
shellExitVariance   = 15.0;
shellVelocity       = 7.0;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = false;

   doColorShift = true;
   colorShiftColor = mac10Item.colorShiftColor;//"0.400 0.196 0 1.000";

   //casing = " ";

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "Ready";
stateTimeoutValue[0] = 0.2;
stateSequence[0] = "ready";
   stateSound[0] = weaponSwitchSound;

stateName[1] = "Ready";
stateSequence[1] = "ready";
stateTransitionOnTriggerDown[1] = "Fire";

stateName[2] = "Fire";
stateEjectShell[2]       = true;
stateSequence[2] = "Fire";
stateTransitionOnTimeout[2] = "reload";
   stateWaitForTimeout[2] = true;
stateTimeoutValue[2] = 0.04;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateScript[2] = "onFire";
stateSound[2] = mac10Shot1Sound;
   stateEmitter[2] = gunFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";



stateName[4] = "Reload";
stateAllowImageChange[4] = false;
stateTransitionOnTriggerUp[4] = "Ready";
stateSequence[4] = "ready";


};
See it says Left<WEAPONNAME>Image? Guys if your going to post actually help the person, even if they spam emotes. Also, AndreZ, I think you're going to have to stay away from those emote buttons. I might be wrong, this is all I know about Dual-Wielding.

Hmmmm, you could look through some other codes instead of hindering us to do your work.

tyty crysis locking...

wen fixed

Hmmmm, you could look through some other codes instead of hindering us to do your work.
thats what i do...

Hmmmm, you could look through some other codes instead of hindering us to do your work.
thats what i do...

:o

ontopic: Well I've done that but i only get one sword held for some reason i need help...
oya heres the code...

How is it offtopic to suggest you stop being lazy and actually look at the Weapon_Guns_Akimbo.zip and see how its meant to be done. Coding Help helps those that help themselves.

thats what i do...


:o

ontopic: Well I've done that but i only get one sword held for some reason i need help...
oya heres the code...

all you have to do is change the mountPoint = 0; to mountPoint = 1;

You didn't type the right thing it says 'Leftswordimage' when it should say 'LefthandedswordImage'
Code: [Select]
function swordImage::onMount(%this, %obj, %slot)
{
   Parent::onMount(%this, %obj, %slot);
   //mount lefthanded gun
   %obj.mountImage(LeftswordImage, 1);
   //%obj.playThread(0, armreadyboth);
}
function DualswordImage::onUnMount(%this, %obj, %slot)
{
   Parent::onUnMount(%this, %obj, %slot);
   //unmount lefthanded gun
   %obj.unMountImage(1);
   //%obj.playThread(0, root);
}


function LeftswordImage::onMount(%this, %obj, %slot)
{
   Parent::onMount(%this, %obj, %slot);
   %obj.playThread(1, armreadyboth);
}
function LeftswordImage::onUnMount(%this, %obj, %slot)
{
   Parent::onUnMount(%this, %obj, %slot);
}

function swordImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
Parent::onFire(%this,%obj,%slot);

   //%obj.setImageTrigger(1,1);
}
See its everywhere, yet you have this.
Code: [Select]
datablock ShapeBaseImageData(LeftHandedswordImage)
Also, you have 'DualswordImage' that should also be 'LeftHandedswordImage'.

You didn't type the right thing it says 'Leftswordimage' when it should say 'LefthandedswordImage'
Code: [Select]
function swordImage::onMount(%this, %obj, %slot)
{
   Parent::onMount(%this, %obj, %slot);
   //mount lefthanded gun
   %obj.mountImage(LeftswordImage, 1);
   //%obj.playThread(0, armreadyboth);
}
function DualswordImage::onUnMount(%this, %obj, %slot)
{
   Parent::onUnMount(%this, %obj, %slot);
   //unmount lefthanded gun
   %obj.unMountImage(1);
   //%obj.playThread(0, root);
}


function LeftswordImage::onMount(%this, %obj, %slot)
{
   Parent::onMount(%this, %obj, %slot);
   %obj.playThread(1, armreadyboth);
}
function LeftswordImage::onUnMount(%this, %obj, %slot)
{
   Parent::onUnMount(%this, %obj, %slot);
}

function swordImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
Parent::onFire(%this,%obj,%slot);

   //%obj.setImageTrigger(1,1);
}
See its everywhere, yet you have this.
Code: [Select]
datablock ShapeBaseImageData(LeftHandedswordImage)
Also, you have 'DualswordImage' that should also be 'LeftHandedswordImage'.

sht! fixin