Home   Help Search Login Register  

Author Topic: Detecting type of nearest dead unit  (Read 549 times)

0 Members and 1 Guest are viewing this topic.

Offline KTottE

  • Former Staff
  • ****
Detecting type of nearest dead unit
« on: 25 Jul 2003, 23:34:38 »
Trust me to complicate things :)

Well, what I want/need is this:

Some way of detecting the type (typeOf will do just fine) of the nearest dead unit.

99% of the time he will be killed by me right before I need this to work, so EH's might do the trick, but in some cases the bodies might be left lying around for a while before I need the information.

Do you suppose an array of dead-body types and their position would work?
With the information being passed at death-time by EHs?

Any pointers on how to do it :)
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Detecting type of nearest dead unit
« Reply #1 on: 26 Jul 2003, 00:02:26 »
do array of dead bodies (just make array of all soldiers dere - nd den wen som1dies remove him nd put him in da dead bodies array)

nd den just check 4 distance (simple distance function or loop) nd wen u get da closest use typeoff command on him  ;)

wat r u tryin 2 do nywayz ? i had somin dat uses da same thing (aint released yet  :P) but if u need somin like dis 1 (not telin but ill tel ya if its da same thingy) i may just save u lots of time

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Detecting type of nearest dead unit
« Reply #2 on: 26 Jul 2003, 05:31:49 »
Here is a test mission I made when doing lojack 2. It keeps track of dead bodies and then makes an AI unit pick up a gun from the nearest dead body.

In the mission, kill all of the east dudes (they are set to careless), then use the radio [0,0,1] and the AI guy will run to the nearest dead body and grab his gun.

This should show you how it can be done.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline KTottE

  • Former Staff
  • ****
Re:Detecting type of nearest dead unit
« Reply #3 on: 26 Jul 2003, 08:50:21 »
Nice.
What I'm trying to do is create the famous covert op unit. You know, one that can steal clothes from killed enemies :)
Though I just remembered, you can't define players mid-mission, so this script might (will) only work for AI.
Hmm, bugger...
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"