| Blockland Forums > Modification Help |
| AmmoGuns: "Light" key doesn't reload |
| (1/1) |
| takato14:
I recently gave one of my weapons support for Space Guy's Ammoguns script. Suprisingly enough, I was able to get it to work this time (after countless failures). However, the light key doesnt reload the weapon like it should. I used a weapon that already had ammoguns support as a reference, and there is almost no difference between my script and the other, and the other one reloads when you press the light key. I used the same support_Ammoguns.cs that the other addon uses. Ive searched and searched, but I couldnt find the problem. Here is the item datablock and weapon image: --- Code: ---////////// // item // ////////// datablock ItemData(UberrifleItem) { category = "Weapon"; // Mission editor category className = "Weapon"; // For inventory system // Basic Item Properties shapeFile = "./Uber_rifleNoHands.dts"; rotate = false; mass = 1; density = 0.2; elasticity = 0.2; friction = 0.6; emap = true; //gui stuff uiName = "Uber-Rifle"; iconName = "./CI_Uber-Rifle"; doColorShift = true; colorShiftColor = "1 1 1 1"; // Dynamic properties defined by the scripts image = UberrifleImage; canDrop = true; maxAmmo = 10; canReload = 1; }; //////////////// //weapon image// //////////////// datablock ShapeBaseImageData(UberrifleImage) { // Basic Item properties shapeFile = "./Uber_Rifle.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 0"; rotation = eulerToMatrix( "0.0 0.3 360" ); // 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 = BowItem; ammo = " "; projectile = UberrifleProjectile; projectileType = Projectile; casing = UberrifleShellDebris; shellExitDir = "1.0 -1.3 1.0"; shellExitOffset = "0 0 0"; shellExitVariance = 15.0; shellVelocity = 9.5; //melee particles shoot from eye node for consistancy melee = false; //raise your arm up or not armReady = true; minShotTime = 120; //minimum time allowed between shots (needed to prevent equip/dequip exploit) doColorShift = true; colorShiftColor = UberrifleItem.colorShiftColor;//"0.400 0.196 0 1.000"; //casing = "UberrifleShellDebris"; // 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.68; stateTransitionOnTimeout[0] = "LoadCheckA"; StateSequence[0] = "use"; StateSound[0] = "weaponswitchsound"; stateName[1] = "Ready"; stateTransitionOnNoAmmo[1] = "Reload"; stateTransitionOnTriggerDown[1] = "Fire"; stateAllowImageChange[1] = true; stateName[2] = "Fire"; stateTransitionOnTimeout[2] = "Delay"; stateTimeoutValue[2] = 0.00; stateFire[2] = true; stateAllowImageChange[2] = false; stateSequence[2] = "Fire"; stateScript[2] = "onFire"; stateEjectShell[2] = true; stateEmitter[2] = gunFlashEmitter; stateEmitterTime[2] = 0.05; stateEmitterNode[2] = "muzzleNode"; stateWaitForTimeout[2] = true; StateSequence[2] = "fire"; stateSound[2] = uberrifleshot1sound; stateName[3] = "Delay"; stateTransitionOnTimeout[3] = "FireLoadCheckA"; stateTimeoutValue[3] = 0.5; stateEmitter[3] = uberriflesmokeemitter; stateEmitterTime[3] = 0.5; stateEmitterNode[3] = "muzzleNode"; //Torque switches states instantly if there is an ammo/noammo state, regardless of stateWaitForTimeout stateName[4] = "LoadCheckA"; stateScript[4] = "onLoadCheck"; stateTimeoutValue[4] = 0.01; stateTransitionOnTimeout[4] = "LoadCheckB"; stateName[5] = "LoadCheckB"; stateTransitionOnAmmo[5] = "Ready"; stateTransitionOnNoAmmo[5] = "ReloadWait"; stateName[6] = "ReloadWait"; stateTimeoutValue[6] = 0.3; stateTransitionOnTimeout[6] = "Reload"; stateWaitForTimeout[6] = true; stateName[7] = "Reload"; stateTimeoutValue[7] = 1; stateScript[7] = "onReloadStart"; stateTransitionOnTimeout[7] = "ReloadB"; stateWaitForTimeout[7] = true; StateSequence[7] = "reloadstart"; //stateSound[7] = ""; stateName[8] = "ReloadB"; stateTimeoutValue[8] = 1.1; stateTransitionOnTimeout[8] = "Reloaded"; stateWaitForTimeout[8] = true; StateSequence[8] = "reloadend"; //stateSound[8] = ""; stateName[9] = "Reloaded"; stateTimeoutValue[9] = 2; stateScript[9] = "onReloaded"; stateTransitionOnTimeout[9] = "Ready"; stateName[10] = "Smoke"; stateEmitter[10] = uberriflesmokeemitter; stateEmitterTime[10] = 0.3; stateEmitterNode[10] = "muzzleNode"; stateTimeoutValue[10] = 0.2; stateTransitionOnTimeout[10] = "Ready"; stateTransitionOnTriggerDown[10] = "Fire"; stateName[11] = "ReloadSmoke"; stateEmitter[11] = uberriflesmokeemitter; stateEmitterTime[11] = 0.3; stateEmitterNode[11] = "muzzleNode"; stateTimeoutValue[11] = 0.2; stateTransitionOnTimeout[11] = "Reload"; stateName[12] = "FireLoadCheckA"; stateScript[12] = "onLoadCheck"; stateTimeoutValue[12] = 0.01; stateTransitionOnTimeout[12] = "FireLoadCheckB"; stateName[13] = "FireLoadCheckB"; stateTransitionOnAmmo[13] = "Smoke"; stateTransitionOnNoAmmo[13] = "ReloadSmoke"; }; --- End code --- |
| Kiwi:
I think you need this extra code. --- Code: ---function UberrifleImage::onLoadCheck(%this,%obj,%slot) { if(%obj.toolAmmo[%obj.currTool] <= 0) %obj.setImageAmmo(%slot,0); else %obj.setImageAmmo(%slot,1); } --- End code --- |
| Navigation |
| Message Index |