Puff won't give item to it's owner in multiplayer.
Posted: Mon Oct 13, 2014 8:35 pm
I'm back with a new thread about my DooM Stats mod. I've made a new puff to give an item to the shooter. And when the shooter automatically activates the item, it will execute an ACS script to increment the integer array holding the value of how many shots you've missed.
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:
ACS:
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;
}
}