Jump to content
Sign in to follow this  
Coolinator

How to make this addaction available to all players in dedicated server?

Recommended Posts

I played my new mission in dedicated, and this first task is about planting charges under enemy boats, the addaction seems wont work for the other players?

i add this for each enemy boats inits line:

this addAction ["Put a charge (Note: only use once then stay away from target at least 20 meters apart, then countdown timer will automatically start.)","sabotage.sqf"];

This is the script, sabotage.sqf:

/////////////////////////////////////////////////
/////////////////////////////////////////////////
/////                                      /////
/////                                      /////
/////         Sabotage script              /////
/////               By                     /////
/////                                      /////
/////              MALAK                   /////
/////                                      /////
/////  thanks to Keine                     /////
/////////////////////////////////////////////////
/////////////////////////////////////////////////
_object = _this select 0;
player playMove "advepercmstpsnonwrfldnon_putdown";

sleep 15;
_timeleft = 20;

while {true} do {

// 5 minutes counter
hintsilent format ["Charge Explode in :%1", [((_timeleft)/60)+.01,"HH:MM"] call bis_fnc_timetostring];

if (_timeleft < 1) exitWith{};
 _timeleft = _timeleft -1;
sleep 1;


};
"M_Mo_82mm_AT" createvehicle getpos _object;
{_x setdamage 1} foreach crew _object + [_object];

Share this post


Link to post
Share on other sites
Are you talking JIP players?

JIP stands for Joined in players? right? then yes :)

Share this post


Link to post
Share on other sites

Well technically no lol. It stands for join in progress, but you've got the idea. :). Does the action appear for the JIP players? Or does the code just not work for JIPs? Some more specifics would be nice.

Share this post


Link to post
Share on other sites

But... where is the problem. Do the JIP clients receive the action? Does the code just not work? .. I do know at the very least the hint would need to be broadcasted to all clients.

[
   ["omg hello"], 
   "hint"
] call bis_fnc_mp;

Edited by Iceman77

Share this post


Link to post
Share on other sites
But... where is the problem. Do the JIP clients receive the action? Does the code just not work? .. I do know the hint would ned to be broadcasted.

You're right, some more explaining is needed.

"X doesn't/won't work" doesn't cut it, ever.

Share this post


Link to post
Share on other sites

Well, if it so comes to using fnc_MP, here is an example :p:

[[[this], "sabotage.sqf"], "BIS_fnc_execVM", nil, false, true] call BIS_fnc_MP;

Edited by JShock

Share this post


Link to post
Share on other sites
You're right, some more explaining is needed.

"X doesn't/won't work" doesn't cut it, ever.

Yeah you are right. Because when your typical noob come here and says "it wont work" that could mean any number of things...

Share this post


Link to post
Share on other sites

Guys give me some time to test it again in dedicated server, then i will reply back to this thread soon as possible to tell you the results, i will try to be more specific next time lol. Sorry about that >_< and yes iceman is right im a noob lol, forgive me T_T

Share this post


Link to post
Share on other sites

Yes sorry. I meant "Newbie". Noob just sounds so harsh when I came back and re-read it.

Share this post


Link to post
Share on other sites

I would say avoid using persitance perameter at all cost and always script around or alternatavly if possible especially for thing like addactions.

the perssistance param compounds by number of players foreach player evey time somone JIPs. Say you have 5 players in lobby and sart at same time. Server spawns 100 items and gives then addactions using Bis_fnc_Mp with persistance.

There is no noticeable performance /bandwidth cost thus far, but by the 3rd or 4th JIP, when he JIPs the server may be dishing out 8 megabit/s upload bandwidth and make server freeze or crash. Just my experience. I coded around having server maintain array of object and PVing array when done. Identify JIPs by

if (!isServer && isNull player) then {isJIP=true;} else {isJIP=false;};

at the top of init.sqf and further down

if (isJIP) then {[] spawn {[] execVM "scripts\JIPactions.sqf"};};

JIPactions.sqf has eventhandler and now has that array of objects last PVed then addsaction foreach object. Totally fixed the problem I was having by using persistence param. Persistence param looks good on Biki but in practice it stinks. There are also Event scripts to help achieve the same.

Share this post


Link to post
Share on other sites
I would say avoid using persitance perameter at all cost and always script around or alternatavly if possible especially for thing like addactions.

the perssistance param compounds by number of players foreach player evey time somone JIPs. Say you have 5 players in lobby and sart at same time. Server spawns 100 items and gives then addactions using Bis_fnc_Mp with persistance.

There is no noticeable performance /bandwidth cost thus far, but by the 3rd or 4th JIP, when he JIPs the server may be dishing out 8 megabit/s upload bandwidth and make server freeze or crash. Just my experience. I coded around having server maintain array of object and PVing array when done. Identify JIPs by

if (!isServer && isNull player) then {isJIP=true;} else {isJIP=false;};

at the top of init.sqf and further down

if (isJIP) then {[] spawn {[] execVM "scripts\JIPactions.sqf"};};

JIPactions.sqf has eventhandler and now has that array of objects last PVed then addsaction foreach object. Totally fixed the problem I was having by using persistence param. Persistence param looks good on Biki but in practice it stinks. There are also Event scripts to help achieve the same.

I just tested it actually works was playing with 6 people earlier in dedicated server, the sabotge script works. But do i still need to use the code that you just suggested?

Also, we were faving fun till the last objective, everything went downhill, task did not updated for some reason.. :( and helicopter wont sling load. anyways thanks for your help guys, i really appreciate it :)

Share this post


Link to post
Share on other sites

I'm not saying it doesn't work. maybe you don't need to worry about it if you only use it a few times. There may never be a problem or at least not noticeable. Its just good practice to avoid it and learn alternative methods. As you mission grows and develops you could find yourself using it to much especially if that is the only way you know to do it. The problem I'm talking about can be hard to reproduce because it requires a few people in game at start Then have server addaction BIS_fnc_MP for say 100 objects with slight rest in between, and a few JIPs. Can be best monitored and isolated when serving from dedi and keeping an eye on bandwidth client side and server side by #monitor command. Really want to crash the server a bit sooner then delete those objects and repeat all the above. I can almost guarantee it. It is a known issue and even kylania and Tonic advise and warn against it on the BIKI

---------- Post added at 03:19 AM ---------- Previous post was at 02:47 AM ----------

I haven't actually done a test to see how many times the compounded command executes. It could be interesting, but from my observation it seems it runs once for each player if player is already ingame when it is issued and then again times the number of players in game for first JIP. The next JIP makes it run

as many times as it has already run times the number of players again and so on...

Edited by Jigsor

Share this post


Link to post
Share on other sites
I'm not saying it doesn't work. maybe you don't need to worry about it if you only use it a few times. There may never be a problem or at least not noticeable. Its just good practice to avoid it and learn alternative methods. As you mission grows and develops you could find yourself using it to much especially if that is the only way you know to do it. The problem I'm talking about can be hard to reproduce because it requires a few people in game at start Then have server addaction BIS_fnc_MP for say 100 objects with slight rest in between, and a few JIPs. Can be best monitored and isolated when serving from dedi and keeping an eye on bandwidth client side and server side by #monitor command. Really want to crash the server a bit sooner then delete those objects and repeat all the above. I can almost guarantee it. It is a known issue and even kylania and Tonic advise and warn against it on the BIKI

---------- Post added at 03:19 AM ---------- Previous post was at 02:47 AM ----------

I haven't actually done a test to see how many times the compounded command executes. It could be interesting, but from my observation it seems it runs once for each player if player is already ingame when it is issued and then again times the number of players in game for first JIP. The next JIP makes it run

as many times as it has already run times the number of players again and so on...

ahh okay i see, thnx for the info, well we dont use the addaction a lot of times, just only use it 5 times, so i think its okay :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×