OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: CopyrightPhilly on 29 Aug 2004, 16:23:15

Title: Detect player ID, Detect if unit is AI or a player, Event Handler Reload?
Post by: CopyrightPhilly on 29 Aug 2004, 16:23:15
hi

got 3 questions...

Question 1:
Is there anyway to detect a player ID number by scipt?

Question 2:
How to detect if a unit is AI or player? (MP)

Question 3:
Is there an event handler for reload?

cheers, Philly
Title: Re:Detect player ID, Detect if unit is AI or a player, Event Handler Reload?
Post by: dmakatra on 29 Aug 2004, 18:28:45
Q 1: Dunno.
Q 2: Try deletevehicle unitname, if he still is there, it's a player allright.
Q 3: Don't think so.

:beat: *Gets Shot* :beat:
Title: Re:Detect player ID, Detect if unit is AI or a player, Event Handler Reload?
Post by: h- on 29 Aug 2004, 18:36:50
2. in MP every human player will return the command player true...
    ? dude != player: hint "dude is AI" (example... If the unit is not player, it is AI...)
Title: Re:Detect player ID, Detect if unit is AI or a player, Event Handler Reload?
Post by: LCD on 29 Aug 2004, 19:22:13
@ 1.

use the group command 4 that i think thats the easiest way (if it actually work ;))

name the group

now "units group" give u array

now u check wich 1 of da ppl in da array is da player.... nd add 1 2 da number

LCD OUT
Title: Re:Detect player ID, Detect if unit is AI or a player, Event Handler Reload?
Post by: General Barron on 29 Aug 2004, 23:18:24
@3

You can check how many bullets are in a units weapon with the 'ammo' command. So (at least with AI), this number will drop from, say 30 with a full m16 mag, down to 3, then 2, then 1, then 0 and back up to 30 once he reloads. So if you made a script that went like this, it would give you the effect you're looking for:

Code: [Select]
_unit = _this select 0
#loop
_rounds = _unit ammo (primaryweapon _unit)
~1
? _rounds < _unit ammo (primaryweapon _unit) : goto "reloaded"
?alive _unit : goto "loop"
exit

#reloaded
 bla bla blah
goto "loop"

And just for reference, there is a tut in the ed depot that lists all the EHs, what they do and what their parameters are.