Blockland Forums > Modification Help
Reloading does not work
Pages: (1/1)
_Dark_:
I am having dear trouble with reloading. I've searched solutions, looked at Support_AmmoGuns, basically a lot. I am not familiar since this is my first time using ammo.
--- Quote ---datablock AudioProfile(vectorFireSound)
{
filename = "./Vectorfire.wav";
description = AudioClosest3d;
preload = true;
};
datablock ParticleData(vectorFlashParticle)
{
dragCoefficient = 0;
gravityCoefficient = 0;
inheritedVelFactor = 1;
constantAcceleration = 0;
lifetimeMS = 30;
lifetimeVarianceMS = 0;
textureName = "base/data/particles/cloud";
spinSpeed = 50;
spinRandomMin = -500;
spinRandomMax = 500;
colors[0] = "1 1 1 1";
colors[1] = "0.4 0.4 0.4 0.5";
colors[2] = "0.2 0.2 0.2 0";
sizes[0] = 0.1;
sizes[1] = 0.2;
sizes[2] = 0;
times[9] = 0;
times[1] = 0.3;
times[2] = 1;
useInvAlpha = false;
};
datablock ParticleEmitterData(vectorFlashEmitter)
{
uiName = "";
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 50;
velocityVariance = 0;
ejectionOffset = 0;
thetaMin = 0;
thetaMax = 10;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "vectorFlashParticle";
};
datablock ParticleData(vectorSmokeParticle)
{
dragCoefficient = 3;
gravityCoefficient = -0.5;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 525;
lifetimeVarianceMS = 55;
textureName = "base/data/particles/star1"; //this was a fail but ended up being a cool spark effect
spinSpeed = 10.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0] = "1 1 0.0 0.9";
colors[1] = "0.9 0.0 0.0 0.0";
sizes[0] = 0.15;
sizes[1] = 0.15;
useInvAlpha = false;
};
datablock ParticleEmitterData(vectorSmokeEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 90;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "vectorSmokeParticle";
uiName = "Vector Smoke";
};
datablock ExplosionData(VectorExplosion)
{
lifeTimeMS = 50;
emitter[0] = vectorSmokeEmitter;
faceViewer = true;
explosionScale = "1 1 1";
shakeCamera = true;
camShakeFreq = "5 5 5";
camShakeAmp = "1 1 1";
camShakeDuration = 0.5;
camShakeRadius = 1;
};
//### Projectile
AddDamageType("vector",'<bitmap:Add-ons/Weapon_Tacticalweps/CI_vector> %1','%2 <bitmap:Add-ons/Weapon_Tacticalweps/CI_vector> %1',0.2,1);
datablock ProjectileData(VectorProjectile)
{
projectileShapeName = "Add-ons/Weapon_Gun/bullet.dts";
directDamage = 16;
directDamageType = $DamageType::vector;
// radiusDamageType = $DamageType::vector;
brickExplosionRadius = 0;
brickExplosionImpact = true; //destroy a brick if we hit it directly?
brickExplosionForce = 10;
brickExplosionMaxVolume = 1; //max volume of bricks that we can destroy
brickExplosionMaxVolumeFloati ng = 2; //max volume of bricks that we can destroy if they aren't connected to the ground
impactImpulse = 0;
verticalImpulse = 0;
explosion = VectorExplosion;
particleEmitter = ""; //bulletTrailEmitter;
muzzleVelocity = 90;
velInheritFactor = 1;
armingDelay = 00;
lifetime = 4000;
fadeDelay = 3500;
bounceElasticity = 0.0;
bounceFriction = 0.0;
isBallistic = false;
gravityMod = 0.3;
hasLight = false;
lightRadius = 3.0;
lightColor = "0 0 0.5";
uiName = "Vector Bullet";
};
//### Item
datablock ItemData(vectorItem)
{
uiName = "TDi Vector Supressed"; //I be showin this to ma server
iconName = "";
image = vectorImage;
category = Weapon;
className = Weapon;
shapeFile = "./Vector.dts";
mass = 1;
density = 0.2;
elasticity = 0;
friction = 0.6;
emap = true;
doColorShift = true;
colorShiftColor = "1 1 1 1";
canDrop = true;
maxAmmo = 30; //Vector y must u be shooting only once ;c
canReload = 1;
};
//### Item Image
datablock shapeBaseImageData(vectorImage)
{
shapeFile = "./Vector.dts";
emap = true;
correctMuzzleVector = true;
className = "WeaponImage";
item = bowItem;
ammo = "";
casing = gunShellDebris;
shellExitDir = "0.0 -5.0 -10.0";
shellExitOffset = "0 -10 -5";
shellExitVariance = 15.0;
shellVelocity = 1.0;
melee = false;
doReaction = false;
armReady = true;
doColorShift = true;
colorShiftColor = "1 1 1 1";
className = "WeaponImage";
// Projectile && Ammo.
item = VectorItem;
ammo = " ";
projectile = VectorProjectile;
projectileType = Projectile;
casing = gunShellDebris;
shellExitDir = "1.0 -0.1 1.0";
shellExitOffset = "0 0 0";
shellExitVariance = 10.0;
shellVelocity = 5.0;
stateName[0]= "Activate";
stateTimeoutValue[0]= 0.3;
stateWaitForTimeout[0]= true;
stateTransitionOnTimeout[0]= "LoadCheckA";
stateSound[0]= weaponSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateTimeoutValue[1]= 0.01;
stateTransitionOnNoAmmo[1]= "Reload";
stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "FireLoadCheckA";
stateTimeoutValue[2] = 0.06;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2]= "Fire";
stateScript[2]= "onFire";
stateWaitForTimeout[2]= true;
stateEmitter[2]= VectorFlashEmitter;
stateEmitterTime[2]= 0.06;
stateEmitterNode[2]= "muzzleNode";
stateSound[2]= vectorfireSound;
stateName[4] = "LoadCheckA";
stateScript[4] = "onLoadCheck";
stateTimeoutValue[4] = 0.01;
stateTransitionOnTimeout[4] = "LoadCheckB";
stateName[5] = "LoadCheckB";
stateTransitionOnAmmo[5] = "Ready";
stateTransitionOnNoAmmo[5] = "Reload";
stateName[6] = "Reload";
stateTimeoutValue[6] = 0.6;
stateScript[6] = "onReloadStart";
stateTransitionOnTimeout[6] = "Wait";
stateWaitForTimeout[6] = true;
stateSound[6] = Block_MoveBrick_Sound;
stateName[7] = "Wait";
stateTimeoutValue[7] = 0.4;
stateScript[7] = "onReloaded";
stateTransitionOnTimeout[7] = "Ready";
stateSound[7] = Block_PlantBrick_Sound;
stateName[8] = "FireLoadCheckA";
stateScript[8] = "onLoadCheck";
stateTimeoutValue[8] = 0.01;
stateTransitionOnTimeout[8] = "FireLoadCheckB";
stateName[9] = "FireLoadCheckB";
stateTransitionOnAmmo[9] = "Smoke";
stateTransitionOnNoAmmo[9] = "ReloadSmoke";
stateName[10] = "Smoke";
stateEmitter[10] = gunSmokeEmitter;
stateEmitterTime[10] = 0.3;
stateEmitterNode[10] = "muzzleNode";
stateTimeoutValue[10] = 0.2;
stateTransitionOnTimeout[10] = "Ready";
stateTransitionOnTriggerDown[10] = "Fire";
stateName[11] = "ReloadSmoke";
stateEmitter[11] = gunSmokeEmitter;
stateEmitterTime[11] = 0.3;
stateEmitterNode[11] = "muzzleNode";
stateTimeoutValue[11] = 0.2;
stateTransitionOnTimeout[11] = "Reload";
};
function vectorImage::onFire(%this,%obj,%slot)
{
Parent::onFire(%this,%obj,%slot);
%obj.playThread(2, plant);
%obj.toolAmmo[%obj.currTool]--;
}
function vectorImage::onReloadStart(%this,%obj,%slot)
{
%obj.playThread(2, shiftLeft);
}
function vectorImage::onReloaded(%this,%obj,%slot)
{
%obj.playThread(2, shiftAway);
%obj.toolAmmo[%obj.currTool] = %this.item.maxAmmo;
%obj.setImageAmmo(%slot,1);
}
function vectorImage::onUnMount(%this,%obj,%slot)
{
%obj.playThread(2, root);
}
function vectorImage::onFire(%this,%obj,%slot)
{
%projectile = %this.projectile;
%spread = 0.0010;
%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);
}
return %p;
}
function vectorImage::onFire2(%this,%obj,%slot)
{
%projectile = %this.projectile;
%spread = 0.0014;
%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);
}
return %p;
}
--- End quote ---
Sorry if my code is to messy for you
_Dark_:
Come on guys I want to get this done so I can start on more weapons in Tactical Weapons :c
Destiny/Zack0Wack0:
I'm assuming you're using Space Guy's ammo support script, so are you even executing it?
_Dark_:
--- Quote from: Destiny/Zack0Wack0 on November 14, 2011, 01:18:31 AM ---I'm assuming you're using Space Guy's ammo support script, so are you even executing it?
--- End quote ---
Yes I am executing.
Munkey:
You have two functions for OnFire, you are overwriting the ammo part of the first one. You also have a OnFire2 which I don't see why you need it.
Pages: (1/1)