Author Topic: claws  (Read 894 times)

im making a dual-wielded claw weapon that when you click both of the claws protrude from your hand, but i can only make one do that, as well as i want to make it so when you right click, the blades go back into your hand by calling a different animation and return to pre-draw, i used a lot from racer's walking stick
my code:
Code: [Select]
//HiddenBlade.cs

//////////
// item //
//////////
datablock ItemData(HiddenBladeItem)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "./HiddenBlade.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "HiddenBlade";
iconName = "./icon_HiddenBlade";
doColorShift = false;
colorShiftColor = "0.471 0.471 0.471 1.000";

// Dynamic properties defined by the scripts
image = HiddenBladeImage;
canDrop = true;
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(HiddenBladeImage)
{
   // Basic Item properties
   shapeFile = "./HiddenBlade.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "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 = false;

   eyeOffset = "0 0 0";

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

   // Projectile && Ammo.
   item = HiddenBladeItem;
   ammo = " ";
   projectile = HiddenBladeProjectile;
   projectileType = Projectile;
   

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

   //casing = " ";
   doColorShift = false;
   colorShiftColor = "0.471 0.471 0.471 1.000";

   // 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";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateSound[0]                    = WeaponswitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Draw";
stateAllowImageChange[1]         = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "FireHidden";
stateTransitionOnTriggerDown[4] = "Fire";



stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "ReadyDrawed";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";

stateName[6] = "Draw";
stateTransitionOnTimeout[6] = "ReadyDrawed";
stateSound[6]                    = HiddenBladeDrawSound;
stateSequence[6]                = "Draw";
stateEjectShell[6]       = true;
stateTimeoutValue[6]            = 0.5;

stateName[7]                     = "ReadyDrawed";
stateTransitionOnTriggerDown[7]  = "Prefire";
stateAllowImageChange[7]         = true;

stateName[8] = "FireHidden";
stateTimeoutValue[8] = 0.09;
stateScript[8] = "onFireHidden";
stateTransitionOnTimeOut[8] = "ready";




};
function HiddenBladeImage::onFireHidden(%this,%obj,%slot)
{
   %obj.setImageTrigger(1,0);
}
datablock ShapeBaseImageData(LeftHandedHiddenBladeImage)
{
   // Basic Item properties
   shapeFile = "Add-Ons/Weapon_HiddenBlade/HiddenBlade.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 = HiddenBladeItem;
   ammo = " ";
   projectile = HiddenBladeProjectile;
   projectileType = Projectile;

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

   doColorShift = false;
   colorShiftColor = "0.471 0.471 0.471 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";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateSound[0]                    = WeaponswitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Draw";
stateAllowImageChange[1]         = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";


stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "ReadyDrawed";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";

stateName[6] = "Draw";
stateTransitionOnTimeout[6] = "ReadyDrawed";
stateSound[6]                    = HiddenBladeDrawSound;
stateSequence[6]                = "Draw";
stateEjectShell[6]       = true;
stateTimeoutValue[6]            = 0.5;

stateName[7]                     = "ReadyDrawed";
stateTransitionOnTriggerDown[7]  = "Prefire";
stateAllowImageChange[7]         = true;


};

function LeftHandedHiddenBladeImage::onFire(%this, %obj, %slot)
{
   Parent::onFire(%this,%obj,%slot);
   if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, leftarmattack);
}
function HiddenBladeImage::onFire(%this, %obj, %slot)
{
   Parent::onFire(%this,%obj,%slot);
   if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, armattack);
}
function HiddenBladeImage::onMount(%this, %obj, %slot)
{
   Parent::onMount(%this, %obj, %slot);
   //mount lefthanded gun
   %obj.mountImage(LeftHandedHiddenBladeImage, 1);
   //%obj.playThread(0, armreadyboth);
}
function HiddenBladeImage::onUnMount(%this, %obj, %slot)
{
   Parent::onUnMount(%this, %obj, %slot);
   //unmount lefthanded gun
   %obj.unMountImage(1);
   //%obj.playThread(0, root);
}

function HiddenBladeImage::onPreFire(%this, %obj, %slot)
{
%obj.playthread(2, armattack);
}

function HiddenBladeImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(2, root);
}
function LeftHandedHiddenBladeImage::onPreFire(%this, %obj, %slot)
{
%obj.playthread(1, leftarmattack);
}

function LeftHandedHiddenBladeImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(1, root);
}

if anyone could help me just figure out how to make both attack/protrude that would be great
« Last Edit: May 10, 2009, 02:21:58 AM by Healbadbad »

That would be done with the animations and state system. Change/make some stateSequence bits to have the claws come out. (You need to add animations to the model)

To make it "un-draw" via states, use %player.setImageAmmo(%slot,%on) and then use stateTransitionOnAmmo[] and stateTransitionOnNoAmmo[] to trigger changes when you right click.

Code: [Select]
//Decals
datablock DecalData(HiddenBladeCI)
{
   textureName = "./CI_HiddenBlade";
};   

datablock DecalData(HiddenBladeIcon)
{
   textureName = "./icon_HiddenBlade";
};
Don't do it like this, please. We don't need to be force-downloaded your unnecessary icons - there's already a default ? and skull icon in place for that specific reason.

That would be done with the animations and state system. Change/make some stateSequence bits to have the claws come out. (You need to add animations to the model)

To make it "un-draw" via states, use %player.setImageAmmo(%slot,%on) and then use stateTransitionOnAmmo[] and stateTransitionOnNoAmmo[] to trigger changes when you right click.

Code: [Select]
//Decals

};
Don't do it like this, please. We don't need to be force-downloaded your unnecessary icons -
i can make the reverse animation, but ive been working with the state system for the past few hours trying to figure out how to make both the left and right claw use the draw animation, which i can only make the right one do.

i will definitely take away the decals, and to retract would i add at the bottom something like
Code: [Select]
package HiddenBlade
{
function armor::onTrigger(%this,%player,%slot,%val)
{
if(%player.getMountedImage(0) $= HiddenBladeImage.getID())
{
%player.setImageAmmo(0,0);

}
else
Parent::onTrigger(%this,%player,%slot,%val);
}
};
ActivatePackage(HiddenBlade);
and then place a stateTransitionOnNoAmmo[4] = "Retract";
in the checkfire sequence?

Well, that'd affect the right claw. You'd also need to do %player.setImageAmmo(1,0); to affect the one mounted in the left-hand slot.

Assuming you have a "Retract" state for both weapon images, if not you'll need to add one.

Well, that'd affect the right claw. You'd also need to do %player.setImageAmmo(1,0); to affect the one mounted in the left-hand slot.

Assuming you have a "Retract" state for both weapon images, if not you'll need to add one.
that helped me a lot, and i set the statements to retract, but when the statement calls my OnNoAmmo function, it gives me
Code: [Select]
Add-Ons/Weapon_HiddenBlade/server.cs (385): Unable to find object: '' attempting to call function 'setImageAmmo'as well as just reverting to the ready statement
the function i have is
Code: [Select]
function HiddenBladeImage::onNoAmmo(%this,%obj,%slot)
{
   %player.setImageAmmo(0,1);
   %player.setImageAmmo(1,1);
}
did i set the wrong variables after Ammo?

is there a way to make them both go at once and not alternate like akimbo guns?


edit the states
k, same exact things ive been doing.

would this actually switch which claw that is used when clicked?
Code: [Select]
function HiddenBladeImage::onFireHidden(%this,%obj,%slot)
{
   %obj.setImageTrigger(1,1);
}

im making a dual-wielded claw weapon that when you click both of the claws protrude from your hand, but i can only make one do that, as well as i want to make it so when you right click, the blades go back into your hand by calling a different animation and return to pre-draw, i used a lot from racer's walking stick
my code:
Code: [Select]
//HiddenBlade.cs

//////////
// item //
//////////
datablock ItemData(HiddenBladeItem)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "./HiddenBlade.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "HiddenBlade";
iconName = "./icon_HiddenBlade";
doColorShift = false;
colorShiftColor = "0.471 0.471 0.471 1.000";

// Dynamic properties defined by the scripts
image = HiddenBladeImage;
canDrop = true;
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(HiddenBladeImage)
{
   // Basic Item properties
   shapeFile = "./HiddenBlade.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "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 = false;

   eyeOffset = "0 0 0";

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

   // Projectile && Ammo.
   item = HiddenBladeItem;
   ammo = " ";
   projectile = HiddenBladeProjectile;
   projectileType = Projectile;
   

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

   //casing = " ";
   doColorShift = false;
   colorShiftColor = "0.471 0.471 0.471 1.000";

   // 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";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateSound[0]                    = WeaponswitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Draw";
stateAllowImageChange[1]         = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "FireHidden";
stateTransitionOnTriggerDown[4] = "Fire";



stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "ReadyDrawed";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";

stateName[6] = "Draw";
stateTransitionOnTimeout[6] = "ReadyDrawed";
stateSound[6]                    = HiddenBladeDrawSound;
stateSequence[6]                = "Draw";
stateEjectShell[6]       = true;
stateTimeoutValue[6]            = 0.5;

stateName[7]                     = "ReadyDrawed";
stateTransitionOnTriggerDown[7]  = "Prefire";
stateAllowImageChange[7]         = true;

stateName[8] = "FireHidden";
stateTimeoutValue[8] = 0.09;
stateScript[8] = "onFireHidden";
stateTransitionOnTimeOut[8] = "ready";




};
function HiddenBladeImage::onFireHidden(%this,%obj,%slot)
{
   %obj.setImageTrigger(1,0);
}
datablock ShapeBaseImageData(LeftHandedHiddenBladeImage)
{
   // Basic Item properties
   shapeFile = "Add-Ons/Weapon_HiddenBlade/HiddenBlade.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 = HiddenBladeItem;
   ammo = " ";
   projectile = HiddenBladeProjectile;
   projectileType = Projectile;

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

   doColorShift = false;
   colorShiftColor = "0.471 0.471 0.471 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";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateSound[0]                    = WeaponswitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Draw";
stateAllowImageChange[1]         = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";


stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "ReadyDrawed";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";

stateName[6] = "Draw";
stateTransitionOnTimeout[6] = "ReadyDrawed";
stateSound[6]                    = HiddenBladeDrawSound;
stateSequence[6]                = "Draw";
stateEjectShell[6]       = true;
stateTimeoutValue[6]            = 0.5;

stateName[7]                     = "ReadyDrawed";
stateTransitionOnTriggerDown[7]  = "Prefire";
stateAllowImageChange[7]         = true;


};

function LeftHandedHiddenBladeImage::onFire(%this, %obj, %slot)
{
   Parent::onFire(%this,%obj,%slot);
   if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, leftarmattack);
}
function HiddenBladeImage::onFire(%this, %obj, %slot)
{
   Parent::onFire(%this,%obj,%slot);
   if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, armattack);
}
function HiddenBladeImage::onMount(%this, %obj, %slot)
{
   Parent::onMount(%this, %obj, %slot);
   //mount lefthanded gun
   %obj.mountImage(LeftHandedHiddenBladeImage, 1);
   //%obj.playThread(0, armreadyboth);
}
function HiddenBladeImage::onUnMount(%this, %obj, %slot)
{
   Parent::onUnMount(%this, %obj, %slot);
   //unmount lefthanded gun
   %obj.unMountImage(1);
   //%obj.playThread(0, root);
}

function HiddenBladeImage::onPreFire(%this, %obj, %slot)
{
%obj.playthread(2, armattack);
}

function HiddenBladeImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(2, root);
}
function LeftHandedHiddenBladeImage::onPreFire(%this, %obj, %slot)
{
%obj.playthread(1, leftarmattack);
}

function LeftHandedHiddenBladeImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(1, root);
}

if anyone could help me just figure out how to make both attack/protrude that would be great
im some what new to this game but how the heck do you understand and create this?!?!?!?!? i really have no idea plz personal message me to tell me i dont look back at the things i quote.

im some what new to this game but how the heck do you understand and create this?!?!?!?!? i really have no idea plz personal message me to tell me i dont look back at the things i quote.
It takes time.
Try looking at something smaller, like Weapon_Gun.