As I return to blockland I want to make something to brush up on my old add-on making skills. I simply wanted to take the normal gun, edit the model a bit and add an ammo, headshot support, and iron sight. But I already ran into a problem that I should know the answer to. Last time I made some sort of animated item, all I had to do was change the "stateTimeoutValue" code segment to change the animation speed (the animations name is reload), but all it does now is wait 1.7 seconds after I fire, then plays the animation slowly. Was there some sort of a change in the blockland engine since I last played in V16 or am I just doing something wrong?
//AmmoGun.cs
AddDamageType("AmmoGun", '<bitmap:add-ons/Weapon_Gun/CI_gun> %1', '%2 <bitmap:add-ons/Weapon_Gun/CI_gun> %1',0.2,1);
datablock ProjectileData(AmmoGunProjectile)
{
projectileShapeName = "add-ons/Weapon_Gun/bullet.dts";
directDamage = 30;
directDamageType = $DamageType::AmmoGun;
radiusDamageType = $DamageType::AmmoGun;
brickExplosionRadius = 0;
brickExplosionImpact = true;
brickExplosionForce = 10;
brickExplosionMaxVolume = 1;
brickExplosionMaxVolumeFloating = 2;
impactImpulse = 400;
verticalImpulse = 400;
explosion = gunExplosion;
particleEmitter = "";
muzzleVelocity = 90;
velInheritFactor = 1;
armingDelay = 00;
lifetime = 4000;
fadeDelay = 3500;
bounceElasticity = 0.5;
bounceFriction = 0.20;
isBallistic = false;
gravityMod = 0.0;
hasLight = false;
lightRadius = 3.0;
lightColor = "0 0 0.5";
};
datablock ItemData(AmmoGunItem)
{
category = "Weapon";
className = "Weapon";
shapeFile = "Add-Ons/Weapon_Gun/pistol.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
uiName = "Ammo Gun";
iconName = "add-ons/Weapon_Gun/icon_gun";
doColorShift = true;
colorShiftColor = "0.25 0.25 0.25 1.000";
image = AmmoGunImage;
canDrop = true;
};
datablock ShapeBaseImageData(AmmoGunImage)
{
shapeFile = "./AmmoGun.dts";
emap = true;
mountPoint = 0;
offset = "0 0 0";
eyeOffset = 0; //"0.7 1.2 -0.5";
rotation = eulerToMatrix( "0 0 0" );
correctMuzzleVector = true;
className = "WeaponImage";
item = BowItem;
ammo = " ";
projectile = AmmoGunProjectile;
projectileType = Projectile;
casing = gunShellDebris;
shellExitDir = "1.0 -1.3 1.0";
shellExitOffset = "0 0 0";
shellExitVariance = 15.0;
shellVelocity = 7.0;
melee = false;
armReady = true;
doColorShift = false;
colorShiftColor = "0.400 0.196 0 1.000";
//casing = " ";
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.15;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateSequence[1] = "Ready";
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] = gunShot1Sound;
stateEjectShell[2] = true;
stateName[3] = "Smoke";
stateEmitter[3] = gunSmokeEmitter;
stateEmitterTime[3] = 0.05;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3] = 0.01;
stateTransitionOnTimeout[3] = "Reload";
stateName[4] = "Reload";
stateSequence[4] = "Reload";
stateTransitionOnTimeout[4] = "Wait";
stateTimeoutValue[2] = 1.7;
stateSequence[4] = "Reload";
stateName[5] = "Wait";
stateTransitionOnTriggerUp[5] = "Ready";
};
function AmmoGunImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(1, shiftUp);
Parent::onFire(%this,%obj,%slot);
}
function AmmoGunImage::onMount(%this, %obj, %slot)
{
Parent::onMount(%this, %obj, %slot);
%obj.playThread(2, armreadyboth);
%obj.hideNode("lhand");
%obj.hideNode("rhand");
%obj.hideNode("lhook");
%obj.hideNode("rhook");
}
function AmmoGunImage::onUnMount(%this, %obj, %slot)
{
Parent::onUnMount(%this, %obj, %slot);
if(isObject(%obj.client))
{
%obj.client.applyBodyParts();
%obj.client.applyBodyColors();
}
else
{
%obj.unHideNode("lhand");
%obj.unHideNode("lhook");
}
}
Just throwing in a picture so you have an idea as to what my goal is:
