Page 1 of 1

Puff won't give item to it's owner in multiplayer.

Posted: Mon Oct 13, 2014 8:35 pm
by Vincent(PDP)
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:

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;
    }
}

RE: Puff won't give item to it's owner in multiplayer.

Posted: Mon Oct 13, 2014 9:03 pm
by Watermelon
Have you tried putting Print(...) throughout the function to see where and why it stops working?

RE: Puff won't give item to it's owner in multiplayer.

Posted: Mon Oct 13, 2014 9:23 pm
by Vincent(PDP)
Watermelon wrote: Have you tried putting Print(...) throughout the function to see where and why it stops working?
Through the ACS, yes and it does only execute once. I believe it's the puff that's the problem when it tries to get the shooter. :L
Also I noticed that when you shoot it won't give you another ShotMiss item if you already have one... And even if you get a new item it won't activate automatically.