Home   Help Search Login Register  

Author Topic: how to detect shell  (Read 428 times)

0 Members and 1 Guest are viewing this topic.

Offline TonyRanger

  • Members
  • *
  • I'm a llama!
how to detect shell
« on: 11 Jul 2004, 12:58:45 »
we can detect RPG,LAW,missile,grenade etc. by nearestobject[_unitname,_ammotype]
RPG's ammotype is "RPG"
by why I can't detect shell by
nearestobject[_unitname,"shell120"]
is shell120's ammotypename is not "shell120"?
but it's "addeventhandler["fired",{_this exec"check.sqs"}]" tell me this

;check.sqs
_ammotpye=_this select 4
#mian
titletext[format["ammotype is:%1",_ammotpye],"plain"]
exit

I fire a m1a1 and the titletext is"ammotype is:shell120"

 


ponq

  • Guest
Re:how to detect shell
« Reply #1 on: 11 Jul 2004, 16:13:45 »
have a look at a script called Bullet Cam at the editors depot.

The cam catches a shell125 there without probs.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:how to detect shell
« Reply #2 on: 13 Jul 2004, 23:19:43 »
You can put that nearest object check into the fired eventhandler...
That ensures you that the shell is detected because it shoots out from the barrel a 'bit' faster than an RPG or LAW etc...

On low-end systems the shell might escape the nearestObject range before the nearestObject gets called if it's not called from the eventhandler...

As such:
unit addEventHandler ["fired",{[nearestObject [_this select 0, _this select 4]] exec "script.sqs"}]

And in the script you have the shell passed with:
_shell = _this select 0...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.