Okay, so rather than doing that schedule stuff with setImageTrigger, I've attempted to use setImageLoaded instead. Here's the setup. I'm in the middle of changing it, but as it stands, this crashes the game.
"SFire" doesn't work still, but the game crashes as soon as the loaded amount of snowballs hits 10, so the game basically crashes when going through "FireCheck" or another sequence, as far as I know.
stateName[0] = "Activate";
stateWaitForTimeout[0] = true;
stateTimeoutValue[0] = 0.25;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateScript[1] = "onReady";
stateTransitionOnTriggerDown[1] = "Choice";
stateAllowImageChange[1] = true;
stateSequence[1] = "Ready";
stateName[2] = "Choice";
stateWaitForTimeout[2] = false;
stateTimeoutValue[2] = 0.25;
stateSound[2] = SnowgunStartSound;
stateTransitionOnTriggerUp[2] = "SFire";
stateTransitionOnTimeout[2] = "Prime";
stateName[3] = "Prime";
stateScript[3] = "onPrime";
stateWaitForTimeout[3] = true;
stateAllowImageChange[3] = false;
stateTimeoutValue[3] = 0.06;
stateSound[3] = SnowgunLoopSound;
stateSequence[3] = "Close";
stateTransitionOnTimeout[3] = "Check";
stateTransitionOnTriggerUp[3] = "Initiate";
stateName[4] = "Fire";
stateScript[4] = "onFire";
stateTimeoutValue[4] = 0.08;
stateAllowImageChange[4] = false;
stateWaitForTimeout[4] = true;
stateEmitter[4] = SnowgunMuzzleEmitter;
stateEmitterNode[4] = "muzzleNode";
stateEmitterTime[4] = 0.05;
stateTransitionOnNotLoaded[4] = "Ready";
stateTransitionOnLoaded[4] = "Check";
stateName[5] = "SFire";
stateScript[5] = "onSFire";
stateAllowImageChange[5] = true;
stateTimeoutValue[5] = 0.10;
stateSequence[5] = "PullOpen";
stateWaitForTimeout[5] = true;
stateEmitter[5] = SnowgunMuzzleEmitter;
stateEmitterNode[5] = "muzzleNode";
stateEmitterTime[5] = 0.1;
stateTransitionOnTriggerUp[5] = "Ready";
stateName[6] = "Check";
stateWaitForTimeout[6] = false;
stateSound[6] = SnowgunLoopSound;
stateTimeoutValue[6] = 0.01;
stateTransitionOnLoaded[6] = "FireCheck";
stateTransitionOnTimeout[6] = "Prime";
stateName[7] = "Initiate";
stateScript[7] = "onInitiate";
stateWaitForTimeout[7] = true;
stateSound[7] = SnowgunLoopSound;
stateTimeoutValue[7] = 0.01;
stateTransitionOnLoaded[7] = "FireCheck";
stateTransitionOnNotLoaded[7] = "Prime";
stateName[8] = "FireCheck";
stateScript[8] = "onFireCheck";
stateWaitForTimeout[8] = true;
stateSound[8] = SnowgunLoopSound;
stateTimeoutValue[8] = 0.01;
stateTransitionOnLoaded[8] = "Fire";
stateTransitionOnNotLoaded[8] = "Ready";
};
function SnowgunImage::onReady(%this,%obj,%slot)
{
%obj.snowballs[%obj.currTool] = 0;
%obj.setImageLoaded(0,0);
}
function SnowgunImage::onPrime(%this,%obj,%slot)
{
if(%obj.snowballs[%obj.currTool] >= 10)
{
%obj.snowballs[%obj.currTool] = 10;
%obj.setImageLoaded(0,1);
}
else
{
%obj.snowballs[%obj.currTool]++;
serverPlay3D(SnowgunChargeSound, %obj.getPosition());
%obj.playThread(0, rotcw);
%obj.playThread(2, rotccw);
}
}
function SnowgunImage::onInitiate(%this,%obj,%slot)
{
if(%obj.snowballs[%obj.currTool] > 0)
{
%obj.setImageLoaded(0,1);
}
else
{
%obj.setImageLoaded(0,0);
}
}
function SnowgunImage::onFireCheck(%this,%obj,%slot)
{
if(%obj.snowballs[%obj.currTool] > 0)
{
%obj.setImageLoaded(0,1);
}
else
{
%obj.setImageLoaded(0,0);
}
}
function SnowgunImage::onFire(%this,%obj,%slot)
{
%obj.playThread(0, shiftRight);
%obj.playThread(2, shiftLeft);
serverPlay3D(SnowgunFireSound, %obj.getPosition());
%projectile = %this.Projectile;
%spread = 0.003;
%shellcount = 1;
for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);
%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
if(%obj.snowballs[%obj.currTool] > 0)
{
%obj.setImageLoaded(0,1);
%obj.snowballs[%obj.currTool]--;
}
else
{
%obj.setImageLoaded(0,0);
}
}
function SnowgunImage::onSFire(%this,%obj,%slot)
{
%obj.playThread(0, shiftRight);
%obj.playThread(2, shiftLeft);
serverPlay3D(SnowgunFireSound, %obj.getPosition());
%projectile = %this.Projectile;
%spread = 0.0006;
%shellcount = 1;
for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, (%projectile.muzzleVelocity*1.3));
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);
%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
}