OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Zombie on 15 Dec 2002, 13:05:13
-
Is it possible to detect and remove units on the map that are not player controlled? When someone leaves a MP game early then their control switches to AI and it runs around doing dumb AI things, also occasionally in an MP game the other team from mine says they disabled AI but the didn't. I think some sort of global trigger would do the trick but can't come up with the syntax.
-
I have just the sxcript for you...
1) Create a gamelogic call "server"
2) Create a gamelogic called "aijail", and put it somewhere far far away from the action (an island is good)
Execute this script for each group in the game.
For example, if your groups are named "westgroup" and "eastgroup", you would execute the scripts like so:
westgroup exec "thisscript.sqs"
eastgroup exec "thisscript.sqs"
;#Script by toadlife - (toadlife@toadlife.net)
requiredversion "1.85"
?!(local server):exit
~5
#aicheck
{if ((local _x) && (local server) && !(_x == player)) then {[_x] join grpnull;unassignvehicle _x;[_x] ordergetin false;_x setpos (getpos aijail);_x stop true} foreach units _this
~5
goto "aicheck"
What this script will do is check every member oif the group to see if it's an AI unit. If they are AI, they will be removed from their vehicle (if they are in one), removed from their group, moved to the gamelogic called "aijail" and ordered to halt.
-
This is the same script, except it removes AI units only if they are the leader of their group.
;#Script by toadlife - (toadlife@toadlife.net)
?!(local server):exit
~5
#aicheck
{if ((_x == leader _this) && (local _x) && (local server) && !(_x == player)) then {[_x] join grpnull;unassignvehicle _x;[_x] ordergetin false;_x setpos (getpos aijail);_x stop true} foreach units _this
~5
goto "aicheck"
-
Thanks for the idea, that should give me a good starting point for the syntax, because I have 1.46, maybe Santa Wife will come through with the upgrade! This will fix many headaches I have been having with MP games
-
OK, I'm at wits end here. I tried the script exactly as you gave it and it won't wok, so I am tryin this one now and it won't work either! It is exec'd by a global repeating trigger activated by anybody:
;;adapted from a script by toadlife, toadlife@toadlife.com
;;by zombie, swcc_zombie@cox.net
?!(local server):goto "end"
_x = _this select 0
?(_x == player):goto "end"
~5
#airemover
_x join grpnull
_x setpos getmarkerpos "aijail"
~5
hint "so far so good"
goto "airemover"
#end
hint "this was a player"
exit
Any ideas? Remember I have 1.46