Forum Jump :

Author Message

Terra  



Posts: 2
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2016-04-08 15:13        
     
First of all, hello to the communtiy! *HI*

Secondly, my problem:

A script that is activated via a trigger and another one via a waypoint (On Activation) is activated twice when the mission is started in MP. Therefore I hope someone can help me.

The script, which is activated by a trigger:

// NPCs ani1, ani2
[[ani1,"Acts_AidlPercMstpSlowWrflDnon_warmup_1_out"],"switchMove",true,false] call BIS_fnc_MP; 

// player prota1, prota2
prota1 setpos (getmarkerpos "tel");
// sleep 0.01;
[[prota1,"AcrgPknlMstpSnonWnonDnon_AmovPercMstpSrasWrflDnon_getOutLow"],"switchMove",true,false] call BIS_fnc_MP; 
[[prota2, ""],"switchMove",true,false] call BIS_fnc_MP;

// C onversation
man1 setrandomlip true;
man1 doWatch ani2;
{ _x doWatch man1; } foreach [ani1, ani2];
man1 say3d "begintalkman1";
sleep 9; // dauer begintalkman1
man1 setrandomlip false;
man1 doWatch prota1;

ani2 setrandomlip true;
titleText ["Soldier 2: Whenever it starts to be fun…", "PLAIN DOWN", 0.4];							// -
sleep 4; // dauer greeting3
ani2 setrandomlip false;

sleep 1;

ani1 setrandomlip true;
titleText ["Soldier 1: I hope we can talk again sometime. Bye!", "PLAIN DOWN", 0.4]; 															// -
sleep 4; // dauer greeting4
ani1 setrandomlip false;
{ _x doWatch objNull; } foreach [ani1, ani2];

ani2 enableAI "MOVE";
sleep 2;
ani1 enableAI "MOVE";

The other one activated by the waypoint:

man1 setDir 80;
man1 disableAI "MOVE";
sleep 30;
man1 setrandomlip true;
man1 say3d "talkman1";
sleep 44; // Gesprächslänge
man1 setrandomlip false;
don setrandomlip true;
titleText ["Dimitris: Hello. C told me a bit about you. Looks like we will get along very well with each other.", "PLAIN DOWN", 1];				// -
sleep 10; // dauer text
don setrandomlip false;
man1 setrandomlip true;
man1 say3d "talkman12";
sleep 23;
man1 setrandomlip false;
"mCamp" setMarkerAlpha 1;
"mFac" setMarkerAlpha 1;



man1 addAction ["Fight with Dimitris", {0 = execVM "script\a.sqf";}]; 
man1 addAction ["Strike first", {0 = execVM "script\b.sqf";}];
man1 addAction ["Deliver the truck", {0 = execVM "script\c.sqf";}];
man1 lookat objNull;


The scripts are called by:
[[[],"script\name.sqf"],"BIS_fnc_execVM",true,true] call BIS_fnc_MP;

The audio plays twice and the options are also given twice.

I hope this is all the information necessary otherwise just ask for it. I'm relatively new to doing this kind of stuff so please have mercy with me ;-)

Have a nice day,

Terra


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#2 Posted at 2016-04-08 18:26        
     
Your script is probably called by server and players as far as you trigger is global.
2 solutions:
- make your trigger local (on server) with this scripted way.
or add:
if (!isServer) exitWith {};
before calling the script (or inside the script, at the beginning).

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message

Terra  



Posts: 2
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2016-04-10 16:54        
     
Thanks for the reply.
The first solution seems a little complicated since you'd have to create a trigger with every conditions in an own script (?) and doing this for about 6 scripts seems a bit much. I'm also not sure if I understood everything... *SCRATCH*
The other solution doesn't seem to work because every script I've put
if (!isServer) exitWith {};
in doesn't execute for the other player.
if (!isServer) exitWith {};

// NPCs ani1, ani2
[[ani1,"Acts_AidlPercMstpSlowWrflDnon_warmup_1_out"],"switchMove",true,false] call BIS_fnc_MP; 
 
// player prota1, prota2
prota1 setpos (getmarkerpos "tel");
.
.
.

Thanks though *THUMBS UP*


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#4 Posted at 2016-04-10 21:02        
     
You can't say a script executed on sever only doesn't work for players! That depends on what you're doing inside.
First of all, in MP, all init.sqf, global (edited) triggers, even init field of the units will trigger each times:
- at server start;
- at player's start;
- at every JIP.
That's the reason why:
- JIP "puts the mess" running again all init fields of units, like custom equipments,etc. These units are "reset".
furthermore, if an animation is triggered on server and on JIP PC, the unit will "disappear"!
- you can run X times = nbr of players each activated triggers. On a BLUFOR present, you can fire it with all BLUFOR players.
And the solution is to make all that stuff on server only.

Just verify your trigger conditions and your codes. who fires what/when.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS