Title is confusing, I know, I just couldnt word it better. Its actually pretty simple what Im trying to do. What I want is for my weapon to switch to a different image datablock after it finishes firing. At the end of the script theres a "done" state containing the stateScript "onDone", which I want to use to switch datablocks. But its not working for me. Can I have a little help with the syntax here?
(PLEASE NOTE THIS IS MY FIRST ATTEMPT AT MAKING A FUNCTION MYSELF SO DONT BE MEAN.)
datablock ShapeBaseImageData(HiBlastImage)
{
// Basic Item properties
shapeFile = "./vectorray.dts";
emap = true;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 0;
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 = XItem;
ammo = " ";
projectile = XProjectile;
projectileType = Projectile;
//melee particles shoot from eye node for consistancy
melee = false;
//raise your arm up or not
armReady = true;
minShotTime = 1500;
doColorShift = true;
colorShiftColor = vectorItem.colorShiftColor;
// 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.15;
stateTransitionOnTimeout[0] = "Ready";
stateSequence[0] = "Ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateTimeoutValue[1] = 0.01;
stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "Smoke";
stateTimeoutValue[2] = 0.14;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = gunFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = XFireSound;
stateName[3] = "Smoke";
stateEmitterTime[3] = 0.1;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3] = 0.5;
stateTransitionOnTimeout[3] = "Reload";
stateName[4] = "Reload";
stateTimeoutValue[4] = 1;
stateSequence[4] = "reload";
stateTransitionOnTimeout[4] = "Wait";
stateWaitForTimeout[4] = true;
stateEjectShell[4] = true;
stateName[5] = "Wait";
stateTimeoutValue[5] = 0.1;
stateTransitionOnTimeout[5] = "Ready";
};
package HiBlastSplitterBeam
{
function Armor::onTrigger(%this,%obj,%slot,%val)
{
Parent::onTrigger(%this,%obj,%slot,%val);
if(%slot == 4 && %val)
{
if(%obj.getMountedImage(0) == HiBlastImage.getID())
{
%obj.updateArm(XImage);
%obj.mountImage(XImage,0);
}
else if(%obj.getMountedImage(0) == XImage.getID())
{
%obj.updateArm(XImage);
%obj.mountImage(HiBlastImage,0);
}
}
}
function XImage::onDone(%this,%obj,%slot,%val)
{
if(%slot == 4 && %val)
{
if(%obj.getMountedImage(0) == HiBlastImage.getID())
{
%obj.updateArm(XImage);
%obj.mountImage(XImage,0);
}
else if(%obj.getMountedImage(0) == XImage.getID())
{
%obj.updateArm(XImage);
%obj.mountImage(HiBlastImage,0);
}
}
}
};
activatePackage(HiBlastSplitterBeam);
EDIT: After looking this over I now realize there was no way this was going to work. But I still dont know how I would properly do this. Help would be very much appreciated.