Jump to content
Incontinentia

Getting civilians and independents to turn on each other on dedicated server

Recommended Posts

Hi all,

 

I'm trying to create a scenario where there's a chance that independents will turn on either themselves or civilians or both under certain conditions. The script works flawlessly in SP however on Dedicated it does absolutely nothing. It's part of a much larger script that fires when auto-generated mission tasks are completed. 

if ((100 > (random 100)) && (1 > (INDEPENDENT knowsAbout player))) then {
	if ((side _x) == Independent) then {_x addrating -10000};} foreach allunits;
};
if ((100 > (random 100)) && (2 > (INDEPENDENT knowsAbout player))) then {
	{if ((side _x) == Civilian) then {_x addrating -10000};} foreach allunits; 
player addrating 12000; 
};

Any ideas where I'm going wrong? 

Share this post


Link to post
Share on other sites

Hi all,

 

I'm trying to create a scenario where there's a chance that independents will turn on either themselves or civilians or both under certain conditions. The script works flawlessly in SP however on Dedicated it does absolutely nothing. It's part of a much larger script that fires when auto-generated mission tasks are completed. 

if ((100 > (random 100)) && (1 > (INDEPENDENT knowsAbout player))) then {
	if ((side _x) == Independent) then {_x addrating -10000};} foreach allunits;
};
if ((100 > (random 100)) && (2 > (INDEPENDENT knowsAbout player))) then {
	{if ((side _x) == Civilian) then {_x addrating -10000};} foreach allunits; 
player addrating 12000; 
};

Any ideas where I'm going wrong? 

 

player returns objNull on a dedicated server

Share this post


Link to post
Share on other sites

Thanks for the response! Turns out it still doesn't work even if I remove the player knowsabout check though.

 

I've had some progress and I have managed to get the script to work on Dedi by calling it with BIS_fnc_MP in console. However, it doesn't work when executed by the parent script. 

 

Basically, I've put this in chaos.sqf: 

if (100 > (random 100)) then {
	{if ((side _x) == Independent) then {_x addrating -10000};} foreach allunits;
};


And in the parent script (which is executed on completion of an ALiVE auto-generated task), I've got this little nugget to fire it: 

case "onTaskCompleted": {

    [[[],"intel\chaos.sqf"],"BIS_fnc_execVM"] call BIS_fnc_MP;
};

So why would [[[],"intel\chaos.sqf"],"BIS_fnc_execVM"] call BIS_fnc_MP; work perfectly when executed in the debug console (either locally or on server) and not when called by the parent script?

 

I've also tried [[,"intel\chaos.sqf"],"BIS_fnc_execVM"] call BIS_fnc_MP; with no success. Again, this works fine when executed from the console window though. 

 

Scripting is fairly new to me so apologies if the answer is obvious. It works fine in SP and MP, it's just Dedi which is being a pain in the tits. 

 

EDIT: It works!! The parent script wasn't initialised properly. 

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

×