The ACS:
Code: Select all
// Sprint system courtesy of revo794 and MagSigmaX
#include "zcommon.acs"
#library "sprint"
Script "S_Forward" ENTER {
int keyPress = 0;
int pforward = 0;
int pstamina = 0;
While(1) {
pstamina = CheckActorInventory(1000 + PlayerNumber(),"SprintCounter");
pforward = CheckActorInventory(1000 + PlayerNumber(),"Forward");
keyPress = GetPlayerInput(-1, INPUT_BUTTONS);
Delay(1);
if(keyPress & BT_FORWARD && pstamina >> 0) {
GiveActorInventory(1000 + PlayerNumber(),"Forward", 1);
}
else {
TakeActorInventory(1000 + PlayerNumber(),"Forward", 1);
}
}
}
Script "S_Sprint" ENTER {
int keyPress = 0;
int sprint = 0;
int aiming = 0;
int pstamina = 0;
int preload = 0;
int pforward = 0;
//int pslot5 = 0;
int velocity = GetActorVelX(1000 + PlayerNumber());
Thing_ChangeTID(0, 1000 + PlayerNumber());
While(1) {
GiveActorInventory(1000 + PlayerNumber(),"Sprint", 1);
GiveActorInventory(1000 + PlayerNumber(),"SprintCancel", 1);
sprint = CheckActorInventory(1000 + PlayerNumber(),"IsSprinting");
aiming = CheckActorInventory(1000 + PlayerNumber(),"SprintAim");
pstamina = CheckActorInventory(1000 + PlayerNumber(),"SprintCounter");
preload = CheckActorInventory(1000 + PlayerNumber(),"IsReloading");
pforward = CheckActorInventory(1000 + PlayerNumber(),"Forward");
//pslot5 = CheckActorInventory(1000 + PlayerNumber(),"HoldingSlot5Weapon");
keyPress = GetPlayerInput(-1, INPUT_BUTTONS);
Delay(1);
if(sprint==1 && pstamina >> 0) {
if(keyPress != BT_BACK && pforward==1 && preload==0 && aiming==0) {
TakeInventory("DontSprint", 1);
SetActorProperty(1000 + PlayerNumber(), APROP_SPEED, 1.8);
TakeActorInventory(1000 + PlayerNumber(),"SprintCounter", 1);
Delay(5);
//print(s:"\cF\n", d:pforward, s:"\cS\n", d:pstamina ,s:"\cR\n", d:preload, s:"\cI\n", d:sprint, s:"\cA\n", d:aiming);
}
else {
TakeActorInventory(1000 + PlayerNumber(),"Forward", 1);
TakeActorInventory(1000 + PlayerNumber(),"IsSprinting", 1);
GiveActorInventory(1000 + PlayerNumber(),"DontSprint", 1);
SetActorProperty(1000 + PlayerNumber(), APROP_SPEED, 1.0);
TakeActorInventory(1000 + PlayerNumber(),"SprintCounter", 1);
Delay(5);
//print(s:"\cF\n", d:pforward, s:"\cS\n", d:pstamina ,s:"\cR\n", d:preload, s:"\cI\n", d:sprint, s:"\cA\n", d:aiming);
}
}
else if(sprint==1 && pstamina==0){
TakeActorInventory(1000 + PlayerNumber(),"Forward", 1);
TakeActorInventory(1000 + PlayerNumber(),"IsSprinting", 1);
GiveActorInventory(1000 + PlayerNumber(),"DontSprint", 1);
SetActorProperty(1000 + PlayerNumber(), APROP_SPEED, 1.0);
TakeActorInventory(1000 + PlayerNumber(),"SprintCounter", 1);
Delay(5);
//print(s:"\cF\n", d:pforward, s:"\cS\n", d:pstamina ,s:"\cR\n", d:preload, s:"\cI\n", d:sprint, s:"\cA\n", d:aiming);
}
else {
TakeActorInventory(1000 + PlayerNumber(),"Forward", 1);
TakeActorInventory(1000 + PlayerNumber(),"IsSprinting", 1);
GiveActorInventory(1000 + PlayerNumber(),"DontSprint", 1);
Delay(5);
SetActorProperty(1000 + PlayerNumber(), APROP_SPEED, 1.0);
GiveActorInventory(1000 + PlayerNumber(),"SprintCounter", 1);
//print(s:"\cF\n", d:pforward, s:"\cS\n", d:pstamina ,s:"\cR\n", d:preload, s:"\cI\n", d:sprint, s:"\cA\n", d:aiming);
}
}
}
Code: Select all
ACTOR IsSprinting : Inventory
{
-InvBar
+Inventory.IgnoreSkill
Inventory.MaxAmount 1
}
ACTOR SprintAim : Inventory
{
-InvBar
+Inventory.IgnoreSkill
Inventory.MaxAmount 1
}
ACTOR DontSprint : Inventory
{
-InvBar
+Inventory.IgnoreSkill
Inventory.MaxAmount 1
}
ACTOR Forward : Inventory
{
-InvBar
+Inventory.IgnoreSkill
Inventory.MaxAmount 1
}
ACTOR SprintCounter : Inventory
{
-InvBar
+Inventory.IgnoreSkill
Inventory.MaxAmount 40
}
ACTOR Sprint : CustomInventory
{
-InvBar
+Inventory.IgnoreSkill
Inventory.MaxAmount 1
Inventory.Amount 1
States
{
Use:
TNT1 A 0 A_GiveInventory("IsSprinting",1)
TNT1 A 0 A_GiveInventory("SprintCancel",1)
Fail
}
}
ACTOR SprintCancel : CustomInventory
{
-InvBar
+Inventory.IgnoreSkill
Inventory.MaxAmount 1
Inventory.Amount 1
States
{
Use:
TNT1 A 0 A_TakeInventory("IsSprinting",1)
TNT1 A 0 A_GiveInventory("Sprint",1)
Fail
}
}
Code: Select all
AddKeySection "Mod Settings" SprintStuff
AddMenuKey "Sprint" +sprinting
Alias +sprinting "use Sprint"
Alias -sprinting "use SprintCancel"
Bind LeftShift sprinting
Code: Select all
Actor M1Aiming : Inventory
{
inventory.maxamount 1
}
Actor M1Reloading : Inventory
{
inventory.maxamount 1
}
Actor M1ReloadingA : Inventory
{
inventory.maxamount 1
}
ACTOR M1Loaded : Ammo
{
Inventory.MaxAmount 8
Inventory.Icon "M1ICO0"
+IGNORESKILL
}
ACTOR M1 : Weapon replaces BFG9000
{
Weapon.SelectionOrder 1902
Weapon.SlotNumber 7
Weapon.AmmoUse 1
Weapon.AmmoGive2 1
Weapon.AmmoType "M1Loaded"
Weapon.AmmoType2 "M1Clip"
Weapon.AmmoUse2 0
Weapon.BobRangeX 0.3
Weapon.BobRangeY 0.5
Weapon.BobStyle InverseSmooth
Weapon.BobSpeed 0.6
AttackSound "sounds/M1/fire"
Inventory.PickupSound "sounds/M1/pickup"
+WEAPON.NOAUTOFIRE
+WEAPON.NOAUTOAIM
+WEAPON.NOALERT
+WEAPON.AMMO_OPTIONAL
+IGNORESKILL
Scale 0.2
Inventory.Pickupmessage "You picked up an M1 Garand rifle."
States
{
Ready:
TNT1 A 0 A_JumpIfInventory("M1Aiming",1, "Ready2")
TNT1 A 0 A_JumpIfInventory("IsSprinting", 1, "Sprinting")
TNT1 A 0 A_JumpIfInventory("M1Loaded",1, "ReadyNoReload")
M1GG A 1 A_WeaponReady (WRF_ALLOWRELOAD)
Loop
ReadyNoSprint:
TNT1 A 0 A_JumpIfInventory("M1Aiming",1, "Ready2")
TNT1 A 0 A_JumpIfInventory("SprintCounter", 1, "Ready")
TNT1 A 0 A_JumpIfInventory("M1Loaded",1, "ReadyNoReload")
M1GG A 1 A_WeaponReady (WRF_ALLOWRELOAD)
Loop
SprintAbort:
M1GG A 1 A_WeaponReady (WRF_ALLOWRELOAD)
Goto Ready
Sprinting:
TNT1 A 0 A_JumpIfInventory("DontSprint",1, "SprintAbort")
TNT1 A 0 A_JumpIfInventory("M1Aiming",1, "Ready2")
M1SP ABCDEF 1
SprintLoop:
//TNT1 A 0 A_TakeInventory("SprintCounter", 1)
M1SR ABCDEFGHIJKLMNO 1
M1SR ONMLKJIHGFEDCB 1
TNT1 A 0 A_JumpIfInventory("IsSprinting", 1, "SprintLoop")
SprintEnd:
TNT1 A 0 A_TakeInventory("IsSprinting", 1)
M1SP FEDCBA 1
Goto Ready
ReadyNoReload:
TNT1 A 0 A_JumpIfInventory("M1Aiming",1, "Ready2")
TNT1 A 0 A_JumpIfInventory("IsSprinting", 1, "Sprinting")
M1GG A 1 A_WeaponReady
Loop
Ready2:
TNT1 A 0 A_JumpIfInventory("IsSprinting",1, "Unaim")
TNT1 A 0 A_JumpIfInventory("M1Loaded",1, "Ready2NoReload")
M1AG A 1 A_WeaponReady (WRF_ALLOWRELOAD)
Loop
Ready2NoReload:
TNT1 A 0 A_JumpIfInventory("IsSprinting",1, "Unaim")
M1AG A 1 A_WeaponReady
Loop
DeselectUnaim:
M1AZ GFEDC 1
TNT1 A 0 A_ZoomFactor(1.0)
M1AZ BA 1
TNT1 A 0 A_Takeinventory("M1Aiming",1)
TNT1 A 0 A_Takeinventory("SprintAim",1)
TNT1 A 0 A_Takeinventory("M1Reloading",1)
Deselect:
TNT1 A 0 A_JumpIfInventory("M1Aiming",1, "DeselectUnaim")
M1GG A 1 A_Lower
Loop
Select:
M1GG A 1 A_Raise
Loop
Fire:
TNT1 A 0 A_JumpIfInventory("IsSprinting",1, "Sprinting")
TNT1 A 0 A_JumpIfInventory("M1PingCounter",7,"FirePing")
TNT1 A 0 A_JumpIfInventory("M1Aiming",1,"FireAiming")
TNT1 A 0 A_JumpIfNoAmmo("Dryfire")
TNT1 A 0 A_GiveInventory("M1PingCounter", 1)
TNT1 A 0 A_GunFlash
M1GF A 1 A_FireBullets (1, 1, -1, random(50,75), "BulletPuff")
M1GF B 1 A_AlertMonsters
M1GF B 0 A_SetPitch(pitch - 6.5)
M1GF C 1 A_SetPitch(pitch - 4.0)
M1GF D 1 A_SetPitch(pitch - 2.0)
M1GF E 1 A_SetPitch(pitch - 1.0)
M1GF F 1 A_SetPitch(pitch - 0.75)
M1GF G 1 A_WeaponReady
M1GF G 0 A_SetPitch(pitch - 0.5)
M1GF H 1 A_WeaponReady
M1GF H 0 A_SetPitch(pitch - 0.25)
M1GF I 1 A_WeaponReady
M1GF I 0 A_SetPitch(pitch + 0.25)
M1GF J 1 A_WeaponReady
M1GF J 0 A_SetPitch(pitch + 0.5)
M1GF K 1 A_WeaponReady
M1GF K 0 A_SetPitch(pitch + 1.0)
M1GF L 1 A_WeaponReady
M1GF L 0 A_SetPitch(pitch + 2.0)
Goto Ready
FireAiming:
TNT1 A 0 A_JumpIfInventory("IsSprinting",1, "Unaim")
TNT1 A 0 A_JumpIfInventory("M1PingCounter",7,"FireAimingPing")
TNT1 A 0 A_JumpIfNoAmmo("DryfireAiming")
TNT1 A 0 A_GiveInventory("M1PingCounter", 1)
TNT1 A 0 A_GunFlash
M1AF A 1 A_FireBullets (0.25, 0.25, -1, random(50,75), "BulletPuff")
M1AF B 1 A_AlertMonsters
M1AF B 0 A_SetPitch(pitch - 4.5)
M1AF C 1 A_SetPitch(pitch - 2.5)
M1AF D 1 A_SetPitch(pitch - 1.0)
M1AF E 1 A_SetPitch(pitch - 0.5)
M1AF F 1 A_SetPitch(pitch - 1.0)
M1AF G 1 A_WeaponReady
M1AF G 0 A_SetPitch(pitch - 0.5)
M1AF H 1 A_WeaponReady
M1AF H 0 A_SetPitch(pitch - 0.25)
M1AF I 1 A_WeaponReady
M1AF I 0 A_SetPitch(pitch + 0.25)
M1AF J 1 A_WeaponReady
M1AF J 0 A_SetPitch(pitch + 0.5)
M1AF K 1 A_WeaponReady
M1AF K 0 A_SetPitch(pitch + 1.0)
M1AF L 1 A_WeaponReady
M1AF L 0 A_SetPitch(pitch + 2.0)
Goto Ready
FirePing:
TNT1 A 0 A_JumpIfInventory("M1Aiming",1,"FireAimingPing")
TNT1 A 0 A_JumpIfNoAmmo("Dryfire")
TNT1 A 0 A_TakeInventory("M1PingCounter", 999)
TNT1 A 0 A_GunFlash
TNT1 A 0 A_PlaySound("sounds/M1/ping", 6)
M1GF A 1 A_FireBullets (1, 1, -1, random(50,75), "BulletPuff")
M1GF B 1 A_AlertMonsters
M1GF B 0 A_SetPitch(pitch - 8.0)
M1GF C 1 A_SetPitch(pitch - 4.0)
M1GF D 1 A_SetPitch(pitch - 2.0)
M1GF E 1 A_SetPitch(pitch - 1.0)
M1GF F 1 A_SetPitch(pitch - 0.75)
M1GF G 1 A_WeaponReady
M1GF G 0 A_SetPitch(pitch - 0.5)
M1GF H 1 A_WeaponReady
M1GF H 0 A_SetPitch(pitch - 0.25)
M1GF I 1 A_WeaponReady
M1GF I 0 A_SetPitch(pitch + 0.25)
M1GF J 1 A_WeaponReady
M1GF J 0 A_SetPitch(pitch + 0.5)
M1GF K 1 A_WeaponReady
M1GF K 0 A_SetPitch(pitch + 1.0)
M1GF L 1 A_WeaponReady
M1GF L 0 A_SetPitch(pitch + 2.0)
Goto Ready
FireAimingPing:
TNT1 A 0 A_JumpIfNoAmmo("DryfireAiming")
TNT1 A 0 A_GunFlash
TNT1 A 0 A_TakeInventory("M1PingCounter", 999)
TNT1 A 0 A_PlaySound("sounds/M1/ping", 6)
M1AF A 1 A_FireBullets (0.25, 0.25, -1, random(50,75), "BulletPuff")
M1AF B 1 A_AlertMonsters
M1AF B 0 A_SetPitch(pitch - 5.5)
M1AF C 1 A_SetPitch(pitch - 2.5)
M1AF D 1 A_SetPitch(pitch - 1.0)
M1AF E 1 A_SetPitch(pitch - 0.5)
M1AF F 1 A_SetPitch(pitch - 1.0)
M1AF G 1 A_WeaponReady
M1AF G 0 A_SetPitch(pitch - 0.5)
M1AF H 1 A_WeaponReady
M1AF H 0 A_SetPitch(pitch - 0.25)
M1AF I 1 A_WeaponReady
M1AF I 0 A_SetPitch(pitch + 0.25)
M1AF J 1 A_WeaponReady
M1AF J 0 A_SetPitch(pitch + 0.5)
M1AF K 1 A_WeaponReady
M1AF K 0 A_SetPitch(pitch + 1.0)
M1AF L 1 A_WeaponReady
M1AF L 0 A_SetPitch(pitch + 2.0)
Goto Ready
AltFire:
TNT1 A 0 A_JumpIfInventory("M1Aiming",1,"Unaim")
TNT1 A 0 A_Giveinventory("SprintAim",1)
TNT1 A 0 A_Giveinventory("M1Aiming",1)
M1AZ AB 1
TNT1 A 0 A_ZoomFactor(3.0)
M1AZ CDEFG 1
Goto Ready2
DryfireAiming:
TNT1 A 0 A_PlaySound("sounds/M1/dryfire")
M1AF JIK 1
ReloadAiming:
TNT1 A 0 A_JumpIfInventory("M1Loaded", 8, 2)
TNT1 A 0 A_JumpIfInventory("M1Clip", 1, "ReloadContinue")
M1AG A 1 A_WeaponReady(WRF_NOFIRE)
Goto Ready2
Dryfire:
TNT1 A 0 A_PlaySound("sounds/M1/dryfire")
M1GF HIJ 1
Reload:
TNT1 A 0 A_JumpIfInventory("M1Aiming",1,"ReloadAiming")
TNT1 A 0 A_JumpIfInventory("M1Loaded", 8, 2)
TNT1 A 0 A_JumpIfInventory("M1Clip", 1, "ReloadContinue")
M1GG A 1 A_WeaponReady(WRF_NOFIRE)
Goto Ready
ReloadContinue:
TNT1 A 0 A_Giveinventory("IsReloading",1)
TNT1 A 0 A_Giveinventory("M1Reloading",1)
TNT1 A 0 A_JumpIfInventory("M1Aiming",1,"Unaim")
TNT1 A 0 A_TakeInventory("M1PingCounter", 999)
M1GR ABCDEFGHIJKLMNOPQRSTUVWXY 1
M1GR Z 1 A_PlaySound("sounds/M1/reload")
M1GS ABCDEFGHIJKLMNOPQRS 1
ReloadLoop:
TNT1 A 0 A_TakeInventory("M1Clip", 1)
TNT1 A 0 A_GiveInventory("M1Loaded", 8)
Goto ReloadFinish
ReloadFinish:
M1GS TUVWXYZ 2
M1GT ABCDEFGHIJKLMNOPQRSTUVWXYZ 1
M1GU ABCDE 1
TNT1 A 0 A_Takeinventory("M1Reloading",1)
TNT1 A 0 A_Takeinventory("IsReloading",1)
Goto Ready
Unaim:
M1AZ GFEDC 1
TNT1 A 0 A_ZoomFactor(1.0)
M1AZ BA 1
TNT1 A 0 A_Takeinventory("M1Aiming",1)
TNT1 A 0 A_Takeinventory("SprintAim",1)
TNT1 A 0 A_JumpIfInventory("M1Reloading",1,"Reload")
TNT1 A 0 A_JumpIfInventory("IsSprinting",1,"Sprinting")
Goto Ready
Flash:
TNT1 A 1 Bright A_Light2
TNT1 A 1 Bright A_Light1
Goto LightDone
TNT1 A 1 Bright A_Light2
TNT1 A 1 Bright A_Light1
Goto LightDone
Spawn:
M1GP A -1
Stop
}
}