OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Rocko Bonaparte on 14 Dec 2004, 05:38:46

Title: Detect if unit is AI or human
Post by: Rocko Bonaparte on 14 Dec 2004, 05:38:46
How could I determine if a unit is AI-controlled or human-controlled in a multiplayer setting?
Title: Re:Detect if unit is AI or human
Post by: penguinman on 14 Dec 2004, 06:15:52
get this one to the multiplayer board
Title: Re:Detect if unit is AI or human
Post by: nominesine on 14 Dec 2004, 08:00:35
?myUnit !=player

Is true if unit is AI-controlled.

?myUnit ==player

Is true if unit is under human controll.
Title: Re:Detect if unit is AI or human
Post by: Rocko Bonaparte on 14 Dec 2004, 21:12:08
get this one to the multiplayer board
Hrm... I guess I'll cross-post is now:

http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=20909;start=%200#lastPost

?myUnit !=player won't work in a multiplayer environment. This is a multiplayer server script, and hence there is more than one player.  This will only identify with the server's player, if there is one.  Anyhow, it's been moved over to Multiplayer.
Title: Re:Detect if unit is AI or human
Post by: Tyger on 14 Dec 2004, 22:02:55
um, someone correct me if im wrong but im pretty sure that the value player is different for every CP on the server.

that mean you can check to see if a player is on the west side and then play a sound:
Code: [Select]
? (side player == west) : playmusic "RTrack10"
Title: Re:Detect if unit is AI or human
Post by: nominesine on 16 Dec 2004, 17:06:23
I've used "player" in MP-missions several times, to delete all units not under player control. Never encountered any problems with it. Player seems to be a unique term to every machine, not just the server.
Title: Re:Detect if unit is AI or human
Post by: nominesine on 16 Dec 2004, 17:08:59
?myUnit !=player won't work in a multiplayer environment. This is a multiplayer server script, and hence there is more than one player.  This will only identify with the server's player, if there is one.

I put ?myUnit !=player in a trigger, not a script, btw