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

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

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

#1

Post by Vincent(PDP) » 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:

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;
    }
}
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

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

#2

Post by Watermelon » Mon Oct 13, 2014 9:03 pm

Have you tried putting Print(...) throughout the function to see where and why it stops working?

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

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

#3

Post by Vincent(PDP) » Mon Oct 13, 2014 9:23 pm

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.
Last edited by Vincent(PDP) on Mon Oct 13, 2014 9:26 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Post Reply