| Blockland Forums > Modification Help |
| Support_AmmoReserve - Ammo System |
| << < (5/5) |
| The Titanium:
Well, yeah, but like, do you mean it can work with both using ImageAmmo for both AmmoGuns (Reloading) and AmmoReserve? |
| Space Guy:
If you make the state system cleverly enough, yes. I use setImageAmmo in three places - to go from "ready" to "reloading" when you press the Light, from "fire" or "smoke" etc. to a check if you're out of ammo and in the middle of a single-shells reload to check if the gun is full yet. If you added another few before the reloading to check that you do have reserve ammo and somehow disabled reloading with the light if you have no reserve ammo at all, it'll work. |
| The Titanium:
Would this still be possible with a rapid fire weapon? It wouldn't slow it down at all? I've been trying to do the above idea but I seem to be limited to 9 states. Is this normal? Or am I doing something wrong? I think it works now. But I can't get it to fire any faster. --- Code: --- stateName[0] = "Activate"; stateTimeoutValue[0] = 0.15; stateTransitionOnTimeout[0] = "ReserveCheckA"; stateSound[0] = weaponSwitchSound; stateName[1] = "ReserveCheckA"; stateScript[1] = "OnReserveCheck"; stateTimeoutValue[1] = 0.001; stateTransitionOnTimeout[1] = "ReserveCHeckB"; stateName[2] = "ReserveCheckB"; stateTransitionOnAmmo[2] = "LoadCheckA"; stateTransitionOnNoAmmo[2] = "ReadyNoReserve"; stateName[3] = "ReadyNoReserve"; stateScript[3] = "OnReserveCheck"; stateTransitionOnAmmo[3] = "LoadCheckA"; stateTransitionOnTriggerDown[3] = "ReserveCheckA"; stateName[4] = "Ready"; stateTransitionOnNoAmmo[4] = "ReloadStart"; stateTransitionOnTriggerDown[4] = "ReserveCheckAFire"; stateAllowImageChange[4] = true; stateSequence[4] = "Ready"; stateName[5] = "ReserveCheckAFire"; stateScript[5] = "OnReserveCheck"; stateTimeoutValue[5] = 0.001; stateTransitionOnTimeout[5] = "ReserveCheckBFire"; stateName[6] = "ReserveCheckBFire"; stateTransitionOnAmmo[6] = "LoadCheckAFire"; stateTransitionOnNoAmmo[6] = "ReadyNoReserve"; stateName[7] = "LoadCheckAFire"; stateScript[7] = "OnLoadCheck"; stateTransitionOnTimeout[7] = "LoadCheckBFire"; stateName[8] = "LoadCheckBFire"; stateTransitionOnAmmo[8] = "Fire"; stateTransitionOnNoAmmo[8] = "Ready"; stateName[9] = "Fire"; stateTransitionOnTimeout[9] = "Smoke"; stateTimeoutValue[9] = 0.03; stateFire[9] = true; stateAllowImageChange[9] = false; stateScript[9] = "onFire"; stateSequence[9] = "Fire"; stateWaitForTimeout[9] = true; stateEmitter[9] = gunFlashEmitter; stateEmitterTime[9] = 0.05; stateEmitterNode[9] = "muzzleNode"; stateSound[9] = TF2PistolFireSound; stateName[10] = "Smoke"; stateEmitter[10] = gunSmokeEmitter; stateEmitterTime[10] = 0.1; stateTimeoutValue[10] = 0.05; stateTransitionOnTimeout[10] = "Wait"; stateName[11] = "Wait"; stateTimeoutValue[11] = 0.001; //stateScript[11] = "onBounce"; stateTransitionOnTimeout[11] = "ReserveCheckA"; //Torque switches states instantly if there is an ammo/noammo state, regardless of stateWaitForTimeout stateName[12] = "LoadCheckA"; stateScript[12] = "onLoadCheck"; stateTimeoutValue[12] = 0.001; stateTransitionOnTimeout[12] = "LoadCheckB"; stateName[13] = "LoadCheckB"; stateTransitionOnAmmo[13] = "Ready"; stateTransitionOnNoAmmo[13] = "ReloadWait"; stateName[14] = "ReloadWait"; stateTimeoutValue[14] = 0.01; stateScript[14] = ""; stateTransitionOnTimeout[14] = "ReloadStart"; stateWaitForTimeout[14] = true; stateName[15] = "ReloadStart"; stateTimeoutValue[15] = 1; stateScript[15] = "onReloadStart"; stateTransitionOnTimeout[15] = "Reloaded"; stateWaitForTimeout[15] = true; stateSound[15] = Block_MoveBrick_Sound; stateName[16] = "Reloaded"; stateTimeoutValue[16] = 0.25; stateScript[16] = "onReloaded"; stateTransitionOnTimeout[16] = "Ready"; stateSound[16] = Block_PlantBrick_Sound; --- End code --- Reorganized it. --- Code: --- stateName[0] = "Activate"; stateTimeoutValue[0] = 0.15; stateTransitionOnTimeout[0] = "ReserveCheckA"; stateSound[0] = weaponSwitchSound; stateName[1] = "Ready"; stateTransitionOnNoAmmo[1] = "ReloadStart"; stateTransitionOnTriggerDown[1] = "ReserveCheckAFire"; stateAllowImageChange[1] = true; stateSequence[1] = "Ready"; stateName[2] = "Fire"; stateTransitionOnTimeout[2] = "Smoke"; stateTimeoutValue[2] = 0.03; stateFire[2] = true; stateAllowImageChange[2] = false; stateScript[2] = "onFire"; stateSequence[2] = "Fire"; stateWaitForTimeout[2] = true; stateEmitter[2] = gunFlashEmitter; stateEmitterTime[2] = 0.05; stateEmitterNode[2] = "muzzleNode"; stateSound[2] = TF2PistolFireSound; stateName[3] = "Smoke"; stateEmitter[3] = gunSmokeEmitter; stateEmitterTime[3] = 0.1; stateTimeoutValue[3] = 0.05; stateTransitionOnTimeout[3] = "Wait"; stateName[4] = "Wait"; stateTimeoutValue[4] = 0.001; //stateScript[4] = "onBounce"; stateTransitionOnTimeout[4] = "ReserveCheckA"; //Torque switches states instantly if there is an ammo/noammo state, regardless of stateWaitForTimeout stateName[5] = "ReserveCheckA"; stateScript[5] = "OnReserveCheck"; stateTimeoutValue[5] = 0.001; stateTransitionOnTimeout[5] = "ReserveCHeckB"; stateName[6] = "ReserveCheckB"; stateTransitionOnAmmo[6] = "LoadCheckA"; stateTransitionOnNoAmmo[6] = "ReadyNoReserve"; stateName[7] = "ReadyNoReserve"; stateScript[7] = "OnReserveCheck"; stateTransitionOnAmmo[7] = "LoadCheckA"; stateTransitionOnTriggerDown[7] = "ReserveCheckA"; stateName[8] = "ReserveCheckAFire"; stateScript[8] = "OnReserveCheck"; stateTimeoutValue[8] = 0.001; stateTransitionOnTimeout[8] = "ReserveCheckBFire"; stateName[9] = "ReserveCheckBFire"; stateTransitionOnAmmo[9] = "LoadCheckAFire"; stateTransitionOnNoAmmo[9] = "ReadyNoReserve"; stateName[10] = "LoadCheckAFire"; stateScript[10] = "OnLoadCheck"; stateTransitionOnTimeout[10] = "LoadCheckBFire"; stateName[11] = "LoadCheckBFire"; stateTransitionOnAmmo[11] = "Fire"; stateTransitionOnNoAmmo[11] = "Ready"; //Torque switches states instantly if there is an ammo/noammo state, regardless of stateWaitForTimeout stateName[12] = "LoadCheckA"; stateScript[12] = "onLoadCheck"; stateTimeoutValue[12] = 0.001; stateTransitionOnTimeout[12] = "LoadCheckB"; stateName[13] = "LoadCheckB"; stateTransitionOnAmmo[13] = "Ready"; stateTransitionOnNoAmmo[13] = "ReloadWait"; stateName[14] = "ReloadWait"; stateTimeoutValue[14] = 0.01; stateScript[14] = ""; stateTransitionOnTimeout[14] = "ReloadStart"; stateWaitForTimeout[14] = true; stateName[15] = "ReloadStart"; stateTimeoutValue[15] = 1; stateScript[15] = "onReloadStart"; stateTransitionOnTimeout[15] = "Reloaded"; stateWaitForTimeout[15] = true; stateSound[15] = Block_MoveBrick_Sound; stateName[16] = "Reloaded"; stateTimeoutValue[16] = 0.25; stateScript[16] = "onReloaded"; stateTransitionOnTimeout[16] = "Ready"; stateSound[16] = Block_PlantBrick_Sound; --- End code --- --- Code: --- //Check if your weapon has no 'reserve' ammo. Use this to trigger state changes. function WeaponImage::OnReserveCheck(%this,%obj,%slot) { if($AmmoReserve::Disable) %obj.setImageAmmo(%slot,1); if(%obj.toolReserve[%obj.currtool] <= 0) %obj.setImageAmmo(%slot,0); else %obj.setImageAmmo(%slot,1); } //Use this to prevent the weapon from checking if you have 'reserve' ammo when AmmoReserve::Disable is on. function WeaponImage::OnReserveDisableCheck(%this,%obj,%slot) { if($AmmoReserve::Disable) %obj.setImageAmmo(%slot,1); else %obj.setImageAmmo(%slot,0); } --- End code --- |
| The Titanium:
Sorry for bump. |
| TheOmega:
bump |
| Navigation |
| Message Index |
| Previous page |