[ACS] Behavior of Giveinventory in multiplayer

Discuss all aspects related to modding Zandronum here.
Post Reply
skaarjman
 
Posts: 34
Joined: Thu Nov 30, 2017 9:53 pm

[ACS] Behavior of Giveinventory in multiplayer

#1

Post by skaarjman » Wed Dec 13, 2017 8:59 pm

I am trying to give player a shotgun with this NET script:

Code: Select all

GiveActorInventory(256, "Shotgun",1);
Player TID is changed with enter script:

Code: Select all

Thing_ChangeTID(0,256+Playernumber());
Now, nor GiveActorInventory, nor GiveInventory (executed from clientside by server) gives the shotgun !
What am I missing ?

I've ended up with

Code: Select all

Script 1000 (Void) NET
{
	SpawnForced ("Shotgun",getactorx(256),getactory(256),getactorz(256),0,0);
	consoleCommand("+forward");
	delay(3);
	consoleCommand("-forward");
}
But it's really tedious for such a simple task. Is there are any other way to give player item in multiplayer by script ?

User avatar
Ivan
Addicted to Zandronum
Posts: 2219
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

[ACS] Re: Behavior of Giveinventory in multiplayer

#2

Post by Ivan » Wed Dec 13, 2017 9:40 pm

You should never give any inventory that would otherwise affect the gamesim through clientside scripts. If server must give something to a player, and it is the client who triggers it, you have options:

1. Give an inventory to the player from server side that triggers a script.
2. RequestScriptPuke. (From clientside to serverside script request)
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

skaarjman
 
Posts: 34
Joined: Thu Nov 30, 2017 9:53 pm

[ACS] Re: Behavior of Giveinventory in multiplayer

#3

Post by skaarjman » Wed Dec 13, 2017 9:53 pm

Sort of what I thought, just needed to set the activator for a script, otherwise it gives item for all players.
Thanks

Post Reply