Search the Community
Showing results for tags 'civilian interactions'.
Found 1 result
-
Basic Civilian Interactions *Problem*
Ironman13 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello everyone. I have been struggling to find out why this script is not executing properly on my dedicated server. Unfortunately my LINUX dedicated server host is unwilling to provide me with a server.rpt file that would make my troubleshooting easier I believe. Objective: Create a script that will add two actions to civilians on the map. Code executed in the InitServer.sqf: //add actions to civilians addCivActions = { params ["_unit"]; if (!isNil "_unit" && {_unit isKindOf "Man"}) then { [_unit, ["<t color='#FF0000'>Get Down</t>", { params ["_target"]; _target setUnitPos "DOWN"; removeAllActions _target; [_target] spawn { sleep 10; private _unit = _this select 0; if (alive _unit) then { _unit setUnitPos "UP"; [_unit] remoteExec ["addCivActions", 2]; }; }; }, nil, 6, true, true, "", "", 8]] remoteExec ["addAction", [0, -2] select isDedicated]; [_unit addAction ["<t color='#FF0000'>Stop</t>", { params ["_target"]; _target disableAI "MOVE"; removeAllActions _target; [_target] spawn { sleep 10; private _unit = _this select 0; if (alive _unit) then { _unit enableAI "MOVE"; [_unit] remoteExec ["addCivActions", 2]; }; }; }, nil, 6, true, true, "", "", 8]] remoteExec ["addAction", [0, -2] select isDedicated]; _unit addEventHandler ["Killed", { params ["_unit"]; removeAllActions _unit; }]; _unit setVariable ["actionsAdded", true]; }; }; // Function to check all civilians and add actions if not already added checkForCivilians = { { if (side _x == civilian && {!(_x getVariable ["actionsAdded", false])}) then { [_x] call addCivActions; }; } forEach allUnits; }; // Schedule the check to run periodically on the server [] spawn { while {true} do { call checkForCivilians; sleep 8; // Adjust the interval as needed }; }; Problem: I am not asking for someone else to re-write my script but I am sure you can tell I am a novice at scripting at best. If there is a simpler solution to achieve what I want I am all ears. Keep in mind the solution must work on a dedicated server and I dont want civilians running around with multiple of the same commands. addAction only executes locally, remoteExec is suppose to supplement the limiting nature of locality..... that is about as far as my understanding goes currently. Been stuck with this problem for 2 weeks. I have tried executing it as a script outside of Initserver.sqf. I have tried calling the function at the point of civilians spawning. I have tried other things that didn't work too, I am at my wits end especially after asking my friend to throw it on his server and seeing it execute flawlessly..... He literally copy and pasted my code, only difference is he executed the code from the advanced developer tools mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2369477168 while I have a file in my mission folder.- 6 replies
-
- civ interactions
- civilian interactions
- (and 4 more)