Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Lines to add to Decorate
- Select:
- TNT1 A 0 ACS_ExecuteAlways(800,0,###) // Set the WeaponID with digits corresponding to
- // SlotNumber|TierNumber|VarNumber
- SPRI A 1 A_Raise
- Goto Select+1
- .
- .
- .
- Fire:
- .
- .
- .
- SPRF A 0 ACS_ExecuteAlways(840,0,x,y,z) // Call this when the weapon fires, it's for the recoil.
- . // x = Strength, y = Recoil Time, z = Recov Time
- . // 6,3,8 = 768 ±64 Recoil that kicks up in 3 tics,
- . // with a 16 tic recovery.
- // Define Script names to numbers
- #define SET_WEAPONID 800
- #define CALL_RECOV_RATIO 820
- #define RECOIL_ICD 840
- #define PLAYER_MAX 64
- // Global Vars to add in ACS
- int WeaponID[PLAYER_MAX];
- int RecoilRecoveryRatios[8][4][5] = // Set these values to > 1 if you want the recovery to be greater
- { // than the recoil, and < 1 for the opposite effect.
- {
- { 1.0,1.0,1.0,1.0,1.0,}, // Slot 1
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- },
- {
- { 1.0,1.0,1.0,1.0,1.0,}, // Slot 2
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- },
- {
- { 1.0,1.0,1.0,1.0,1.0,}, // Slot 3
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- },
- {
- { 1.0,1.0,1.0,1.0,1.0,}, // Slot 4
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- },
- {
- { 1.0,1.0,1.0,1.0,1.0,}, // Slot 5
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- },
- {
- { 1.0,1.0,1.0,1.0,1.0,}, // Slot 6
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- },
- {
- { 1.0,1.0,1.0,1.0,1.0,}, // Slot 7
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- },
- {
- { 1.0,1.0,1.0,1.0,1.0,}, // Slot 8
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- { 1.0,1.0,1.0,1.0,1.0,},
- }
- };
- // The Actual Script
- script SET_WEAPONID (int x)
- {
- WeaponID[PlayerNumber()] = x;
- }
- script CALL_RECOV_RATIO (void) // This retrieves the value from the array.
- {
- int SlotNumber = (WeaponID[PlayerNumber()] / 100) - 1;
- int TierNumber = ((WeaponID[PlayerNumber()] % 100) / 10) - 1;
- int VarNumber = (WeaponID[PlayerNumber()] % 10) - 1;
- SetResultValue(RecoilRecoveryRatios[SlotNumber][TierNumber][VarNumber]);
- }
- /* The main recoil script */
- script RECOIL_ICD (int Amplitude, int TransLength, int DecayLength) clientside
- {
- int RecPitch = (Amplitude * 128) + Random(-64,64);
- int SubPitch = 0;
- int ModPitch = 0;
- int PTDivisor = RecPitch * 2 / (TransLength * (TransLength + 1));
- int PTMod = RecPitch * 2 % (TransLength * (TransLength + 1));
- int DecRecov = ACS_ExecuteWithResult(820);
- int DecPitch = (RecPitch * DecRecov) >> 16;
- int PRDivisor = DecPitch / (DecayLength * (DecayLength + 1));
- int PRMod = DecPitch % (DecayLength * (DecayLength + 1));
- // int ActualDecay = 0; // For Debugging
- // int ActualPitch = 0; // For Debugging
- for (int a = 0; a < TransLength; a++) // Recoil Transient
- {
- ModPitch += (PTMod * (TransLength - a));
- SubPitch = ModPitch / (TransLength * (TransLength + 1));
- ModPitch = ModPitch % (TransLength * (TransLength + 1));
- SetActorPitch(0, GetActorPitch(0) - (PTDivisor * (TransLength - a) + SubPitch));
- // ActualPitch += (PTDivisor * (TransLength - a) + SubPitch); // For Debugging
- SubPitch = 0;
- Delay(1);
- }
- Delay(1);
- for (int b = 0; b < DecayLength; b++) // Recovery.
- {
- ModPitch += (PRMod * (b + 1));
- SubPitch = ModPitch / (DecayLength * (DecayLength + 1));
- ModPitch = ModPitch % (DecayLength * (DecayLength + 1));
- SetActorPitch(0, GetActorPitch(0) + (PRDivisor * (b + 1) + SubPitch));
- // ActualDecay += (PRDivisor * (b + 1) + SubPitch); // For Debugging
- SubPitch = 0;
- Delay(1);
- }
- for (int c = 0; c < DecayLength; c++)
- {
- ModPitch += (PRMod * (DecayLength - c));
- SubPitch = ModPitch / (DecayLength * (DecayLength + 1));
- ModPitch = ModPitch % (DecayLength * (DecayLength + 1));
- SetActorPitch(0, GetActorPitch(0) + (PRDivisor * (DecayLength - c) + SubPitch));
- // ActualDecay += (PRDivisor * (DecayLength - c) + SubPitch); // For Debugging
- SubPitch = 0;
- Delay(1);
- }
- /* For Debugging */
- // Hudmessage(s:"Recoil : ", i:RecPitch, s:" (", i:ActualPitch, s:") , Decay : ", i:DecPitch, s:" (", i:ActualDecay, s:")";
- // HUDMSG_FADEOUT,1,CR_WHITE,0.5,0.9,1.0,1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement