Home   Help Search Login Register  

Author Topic: Kill Detection  (Read 1143 times)

0 Members and 1 Guest are viewing this topic.

idleness

  • Guest
Kill Detection
« on: 19 Sep 2005, 03:26:01 »
hi guys,

i was wondering if anyone has a good algorithm for kill detection, whenever someone is killed, i'd like a hint popup saying "player1 killed player2"

i've been thinking playing around with this and it works MOST of the time with like less than 10 units on the map. i'm afraid that when i have many more units, the incidence of this working would fall further. Also, i'm unable to detect kills from grenades.

can someone pls help?

Offline bdfy85

  • Contributing Member
  • **
Re:Kill Detection
« Reply #1 on: 19 Sep 2005, 03:29:26 »
Use EventHadler
"killed" (addable to men or vehicles) :
_this select 0 : who's dead ;
_this select 1 : whodunnit (say, the killer) ;
Liberation Mod scripts&balance

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Kill Detection
« Reply #2 on: 19 Sep 2005, 03:48:31 »
so to do what you want:
trigger, covering entire map:
anybody present
on activation:
{_x addeventhandler ["killed", hint format ["%1 killed %2",(name (_this select 1)),(name (_this select 0))]} foreach units thislist

tadaaa

idleness

  • Guest
Re:Kill Detection
« Reply #3 on: 19 Sep 2005, 05:14:07 »
it doesn't work, do i have to add annything to the init fields of my men?

however it did work when i put:

this addeventhandler ["killed", {hint format ["%1 killed %2",(name(_this select 1)), (name(_this select 0))]}]

into all my men's init fields.

THANKS for ur help!!!
« Last Edit: 19 Sep 2005, 06:13:04 by idleness »

bored_onion

  • Guest
Re:Kill Detection
« Reply #4 on: 19 Sep 2005, 18:52:41 »
use the foreach command to attach it to every dude in a trigger. something like:

Code: [Select]
"_x" addeventhandler ["killed", {hint format ["%1 killed %2",(name(_this select 1)), (name(_this select 0))]}] foreach units thislist
stick it in the on activation of a trigger set to activate from "anybody present." syntax nowhere guaranteed and is probably wrong. you may need to fiddle.

Offline bdfy85

  • Contributing Member
  • **
Re:Kill Detection
« Reply #5 on: 19 Sep 2005, 20:12:01 »
{_x addeventhandler ["killed", hint format ["%1 killed %2",(name (_this select 1)),(name (_this select 0))]} foreach (list trigername)
trigername - name of your triger covering map
Liberation Mod scripts&balance

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Kill Detection
« Reply #6 on: 20 Sep 2005, 04:30:01 »
lol bdfy you made the same mistake as me!

{_x addeventhandler ["killed", {hint format ["%1 killed %2",(name (_this select 1)),(name (_this select 0))}]} foreach (list trigername)

forgot the extra curly brackets on the eventhandler command (i always do :P)

idleness

  • Guest
Re:Kill Detection
« Reply #7 on: 20 Sep 2005, 10:41:16 »
...e (_this select 0))}]} foreach .....

and trigger forgot a "]". lol took me so long to discover y it wasn't working!!!

aniway final got it running =)

THANKS GUYS !!!!!!!!!
« Last Edit: 20 Sep 2005, 10:42:29 by idleness »

Offline Blanco

  • Former Staff
  • ****
Re:Kill Detection
« Reply #8 on: 20 Sep 2005, 11:34:22 »
Don't forget to solve the topic, please. (that's the green button at the bottom (left) of your screen)  ;)

« Last Edit: 20 Sep 2005, 11:35:50 by Blanco »
Search or search or search before you ask.