Author Topic: Multiplayer Scripting problems!  (Read 337 times)

0 Members and 1 Guest are viewing this topic.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Multiplayer Scripting problems!
« on: 24 Aug 2010, 12:38:29 »

I've been learning the MP scripting for a while....

And I've got some problems :

NOTE : Ignore errors in the scripts(such as missing semicolons).
All scripts are just examples.

Problem 1 :

In my zombie script ,
Code: [Select]
If (isServer) then
zombie setBehaviour "SAFE";
zombie setSpeedMode "LIMITED";

_selectedSound = ZSounds select (random (count ZSounds) - 0.5));
zombie say _selectedSound;


And as you can see, the sounds will not be played, because the SAY command is local.
How do I make it so that all players (clients) hear the sound in this situation?

Problem 2 :

Code: [Select]
if (isServer) then

Hz_Shoot = TRUE;
Hz_Flee = TRUE;

if (not (IsServer)) exitWith {};

while {alive vicim} do
   if (Hz_Shoot) then
   victim dofire zombie;
   sleep 1;

As you can see, both zombie_init.sqf and shoot.sqf are only running on the server.

Question : Do i need to use PublicVariable for the variables,Hz_Shoot and Hz_Flee?

Problem 3 :
Question : How do i run a script for all clients from a scope that is only running for the server?

For example :

if (isServer) then
   nil = [] execVM "script.sqf";

What I want to do is, script.sqf to be executed on ALL machines.

Other questions :

Where can i find which eventhandler is local and which is global?

Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline i0n0s

  • Moderator
  • *****
Re: Multiplayer Scripting problems!
« Reply #1 on: 24 Aug 2010, 13:32:47 »
To 1:
Use publicvariable to execute the say on all computers.

To 2:

To 3:
What do you exactly want to achieve with the script?
Because you can simple start it within the init.sqf

Code: [Select]
nil = [] execVM "script.sqf";Never ever do 'nil = ...'!

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Multiplayer Scripting problems!
« Reply #2 on: 24 Aug 2010, 16:15:35 »
Use _nul or _dump = ..

to 3) Use PV and PVEH to launch a script on all machines.