Home   Help Search Login Register  

Author Topic: Disconnecting / Quitters  (Read 1425 times)

0 Members and 1 Guest are viewing this topic.

LightWalker

  • Guest
Disconnecting / Quitters
« on: 21 Apr 2004, 17:03:16 »
Strongly finding a way to move players that disconnect during a MP-mission to a group that doesnt take part in the mission, using the [UNITID] join aigroup command. How to determine when a player is disconnected and turned into an AI?

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Disconnecting / Quitters
« Reply #1 on: 21 Apr 2004, 17:41:21 »
hmm...if you don't need these units anymore, why not just delete them?

;deletedisconnected.sqs

_unit = _this select 0

#loop
~1
deletevehicle _unit
#goto "loop"


then just put in the init line of each playable unit:

[this] exec "deletedisconnected.sqs"

As OFP wont delete Human controlled units, the script would delete a unit which is no longer under human control.

Warning: this is untested, make a test mission first to test if it works...but out of my mind it should  ;D

LightWalker

  • Guest
Re:Disconnecting / Quitters
« Reply #2 on: 21 Apr 2004, 19:09:14 »
Tried this, it doesnt remove them.
Thats why I wanted the disconnected player / AI moved to another group.
Thanks anyway though.

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Disconnecting / Quitters
« Reply #3 on: 21 Apr 2004, 22:07:10 »
Off course you won't success doing it this way

It's because the unit won't get deleted after the first RESPAWN.

You need to exit the script, once the unit is dead, and start the
script again, after respawning.

P.S: I'm not sure, if it will work when doing it the correct way,
as i seem to remember these units will still keep their player's
names, and this could cause that the game still thinks it's a player

not tested that yet, but at least you should give the correct method a chance first  :)

~S~ CD
« Last Edit: 21 Apr 2004, 22:10:03 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Disconnecting / Quitters
« Reply #4 on: 22 Apr 2004, 15:20:31 »
what you will probably need to do is update the playable unit arrays after every respawn


This is how to do it

1) Create a gamelogic and name it SERVER

2) Add the following to the init.sqs
Code: [Select]
tx_PlayableArray = [W1,W2,W3,..... etc etc etc]
tx_updateArray = objnull
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
[]exec ArrayUpdate.sqs

3) Create script ArrayUpdate.sqs
Code: [Select]
?!(local Server):exit
~ (Random 2)
;;Playerarray_update.sqs
;;Maintains PlayerArray integrity, use it for whatever you want
#START
@ (not isnull tx_updateArray)
#UPDATE
tx_PlayableArray = tx_PlayableArray + [tx_updateArray]
tx_updateArray = objnull
{deletevehicle _x} forEach tx_PlayableArray
goto "START"

4) Create script Playerkilled.sqs
Code: [Select]
player removeAllEventHandlers "Killed"
@alive player
tx_updateArray = player; PublicVariable "tx_updateArray"
player addEventHandler ["killed", {_this exec "playerkilled.sqs"}]
exit



in theory every time somebody is killed, the update script will self clean any ai units (Untested), however i know the array update system works because i use it a lot

NB>>> note the use of a tag "tx_" before any global variable, this is to help reduce conflicts when addons are also being run alongside the scripts
« Last Edit: 22 Apr 2004, 15:23:59 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123