Home   Help Search Login Register  

Author Topic: Notice if s.o. dies of all units  (Read 418 times)

0 Members and 1 Guest are viewing this topic.

Kampfkobold

  • Guest
Notice if s.o. dies of all units
« on: 11 Jan 2005, 15:04:40 »
Hello!

I'm not very advanced in scripting so thats my the solution I have.

Can you give me the code for:

I want to create a sidechat, for example "One Man Down!" if any kind of soldier dies of the enemies troops.

Thank you,
Kampfkobold

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:Notice if s.o. dies of all units
« Reply #1 on: 11 Jan 2005, 16:41:03 »
Well, the game already has this function (AI shouting: "Soldier is history" et cetera). But here's another (simple) way to do it:

In the init line of the enemy units, write: this addEventHandler ["killed",{confirmedKill=true"}]

Then make a trigger and set it to repeatedly
CONDITION: confirmedKill
ON ACTIVATION: leader player sideChat "I got him!"; confirmedKill=false

Or if you want to make it a bit more uncertain, change the init line to this addEventHandler ["hit",{confirmedKill=true"}]

And make the trigger look like this
CONDITION: confirmedKill
ON ACTIVATION: leader player sideChat "I got him! I think he's dead."; confirmedKill=false

That's a very easy way to do it. It's fairly easy to add corresponding soundfiles to this trigger based communicationssystem. The downside is that it will be the leader of your group who calls out every hit.

But if you study the evenHandler section of the comref carefully you will see that the eventHandler function also returns information about who hit/killed every unit. Thus it's possible to make a script that makes the soldier delivering the killing blow call out every hit. But it takes a little more scripting to do, and it really doesn't add that much to game play. Good luck!

Syntax is not completely guaranteed, btw. But I think the eventHandlers look like that. Check the comref to be sure.
« Last Edit: 11 Jan 2005, 16:44:12 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!