It works perfectly in singleplayer, but in multiplayer the value will only increment the first time you miss. Then it will stop counting your missed shots.
DECORATE:
Code: Select all
ACTOR ShotMiss : CustomInventory
{
+INVENTORY.UNDROPPABLE
+INVENTORY.AUTOACTIVATE
Inventory.MaxAmount 64
States
{
Use:
TNT1 A 0 ACS_ExecuteAlways(512, 0, 0, 0, 0)
Fail
}
}
ACTOR StatCheckPuff : BulletPuff replaces BulletPuff
{
Game Doom
+NOBLOCKMAP
+NOGRAVITY
+ALLOWPARTICLES
+RANDOMIZE
+PUFFGETSOWNER
RenderStyle Translucent
Alpha 0.5
VSpeed 1
Mass 5
States
{
Spawn:
PUFF A 4 Bright
PUFF B 4
// Intentional fall-through
Melee:
PUFF CD 4
Stop
Crash:
PUFF A 4 Bright
PUFF B 2
PUFF B 0 A_GiveToTarget("ShotMiss", 1)
PUFF B 2
PUFF CD 4
Stop
}
}
ACS:
Code: Select all
Script 512 (Int x) CLIENTSIDE
{
If(PlayerNumber() != ConsolePlayerNumber())
{
Terminate;
}
Switch(x)
{
Case 0:
Int itms = CheckInventory("ShotMiss");
For(Int c=0; c<itms; c++) //C++ :3
{
STATValues[STAT_MISSED][PlayerNumber()] ++;
TakeInventory("ShotMiss", 1);
}
If(GameType() == GAME_SINGLE_PLAYER)
{
SaveAllStatsAndSettings();
}
Break;
}
}