Home   Help Search Login Register  

Author Topic: Removing AI soldiers  (Read 1213 times)

0 Members and 1 Guest are viewing this topic.

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Removing AI soldiers
« 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.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Removing AI soldiers
« Reply #1 on: 16 Dec 2002, 01:55:09 »
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"

Code: [Select]
;#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.
« Last Edit: 16 Dec 2002, 01:58:02 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Removing AI soldiers
« Reply #2 on: 16 Dec 2002, 02:00:08 »
This is the same script, except it removes AI units only if they are the leader of their group.

Code: [Select]
;#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"
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:Removing AI soldiers
« Reply #3 on: 16 Dec 2002, 10:50:54 »
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

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:Removing AI soldiers
« Reply #4 on: 17 Dec 2002, 11:35:14 »
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