Forum Jump :

Author Message


Posts: 20
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2009-08-07 22:02        
     
I'm in need of help adding a few onPlayerDisconnected lines into my init.sqf file.

I have a few playable units with AI attached to them. When these players disconnect, I need the AI to be killed.

Basically;
onPlayerDisconnected west01; west01a setdamage 1; west01b setdamage 1; west01c setdamage 1;

onPlayerDisconnected east01; east01a setdamage 1; east01b setdamage 1; east01c setdamage 1;

Just not sure the proper structure for these.


Author Message


Posts: 189
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 28
In-game name:

 
#2 Posted at 2009-08-07 22:27        
     
it would be:
onPlayerDisconnected = "{if (!isPlayer _x) then {_x setDammage 1}} foreach units group player";

But why not just use in Description.ext:
disabledAI = 1;


Advertisement


Author Message


Posts: 20
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2009-08-07 22:34        
     
DaChevs : it would be:
onPlayerDisconnected = "{if (!isPlayer _x) then {_x setDammage 1}} foreach units group player";
Thanks for this. One question. My mission is a multiplayer mission, so there is more than one group. Will this effect the AI in the player that is disconnecting... or every "player" on the server? Don't want all the players having their AI die when one person disconnects.

EDIT:
Just tested the script as it is in my init.sqf and had a friend join the dedicated server, then made him disconnect after his squad spawned. They didn't get killed as I'm wanting them to do.



DaChevs : But why not just use in Description.ext:
disabledAI = 1;
The AI are spawned by a script, not placed in the editor.

Thanks again.

This post was edited by doomachu (2009-08-07 23:11, ago)


Author Message


Posts: 189
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 28
In-game name:

 
#4 Posted at 2009-08-08 23:16        
     
hmmm, ok try:
onPlayerDisconnected = "
if (!isPlayer west01) then { {_x setDammage 1} foreach [west01a,west01b,west01c] };
if (!isPlayer east01) then { {_x setDammage 1} foreach [east01a,east01b,east01c] }; ";


Author Message


Posts: 20
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2009-08-09 16:01        
     
Tried placing that in the init.sqf and it didn't seem to work. I double checked the names of my players/AI and it all matched up.

Thanks for the help so far though!


Author Message


Posts: 189
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 28
In-game name:

 
#6 Posted at 2009-08-09 21:13        
     
not sure then...looks like there is some set condition of the onplayerdisconnected.