Home   Help Search Login Register  

Author Topic: Detect player ID, Detect if unit is AI or a player, Event Handler Reload?  (Read 492 times)

0 Members and 1 Guest are viewing this topic.

CopyrightPhilly

  • Guest
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

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
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:

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
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...)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
@ 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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
@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.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!