Home   Help Search Login Register  

Author Topic: Specific Unit Death  (Read 998 times)

0 Members and 1 Guest are viewing this topic.

Mad Monk

  • Guest
Specific Unit Death
« on: 23 Jan 2005, 01:13:35 »
Hello,

I'm making a semi-living military base. Whenever you walk by the soldiers guarding the Majors office, they salute to you and then return to being at attention. Unfortunately, when you kill them they die but continue to remain at attention. I know that if I use switchmove "null" then they will die, but I don't know how to tell the trigger that they are dead. Can I say something like "guard1's health is zero so activate trigger stop salute"? Also, how do I make a trigger initialize by default in the beginning of the game?

I've never used scripts before, so if I need a script to do this could you explain a little bit about how to execute and use scripts?

Thanks a lot,

Mad Monk



Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Specific Unit Death
« Reply #1 on: 23 Jan 2005, 01:21:16 »
1)  To make a trigger fire when the mission starts:

Condition:   true

Except as a rule don't bother, just put the line of code you want executed in your init.sqs.


2)   Trigger
Condition:   not alive loon1
On Activation:   loon1 switchMove "null"

Alternatively, group the trigger to the unit to get new options in the Activation box.


3)   If the number of units in question is relatively small, then doing it like this will triggers will be fine.   If it is large, then a script might be better.     The time honoured way to learn scripting is to read snYpir's A Friendly Intro to Code Snippets;  Johan Gustafsson's Scripting Guide and both the online and unofficial versions of the command reference.     There are simple working scripts in the Tutorial Mission.    All in the Ed Depot.


Syntax not guaranteed.   Oh, and

Welcome to the forum!

« Last Edit: 23 Jan 2005, 01:22:14 by macguba »
Plenty of reviewed ArmA missions for you to play

Mad Monk

  • Guest
Re:Specific Unit Death
« Reply #2 on: 23 Jan 2005, 03:09:51 »
Thanks for the help!

One last question...

So now I have soldiers that salute when I near them and go back to attention when I am far away, but if I kill them and then return to the trigger activation zone they pop back into attention despite that they're dead. Is there a command to turn off or disable a trigger after a different trigger has been activated?


Homefry31464

  • Guest
Re:Specific Unit Death
« Reply #3 on: 23 Jan 2005, 04:39:52 »
Make the condition in the saluting trigger a variable, in this example we shall call the variable variablename.  In the init.sqs file, put:

variablename = true

In the other trigger (the one detecting the guard's death), also place in the activation line (seperated with an ;):
variablename = false

Obviously, change variablename to whatever you wish...

Hope this helps.

Mad Monk

  • Guest
Re:Specific Unit Death
« Reply #4 on: 23 Jan 2005, 07:05:08 »
Is there anyway to set a trigger to false or delete a trigger in an on activation line?

Mad Monk

  • Guest
Re:Specific Unit Death
« Reply #5 on: 23 Jan 2005, 09:13:21 »
I figured out an easy way to delete triggers. You can delete them with the deletevehicle command. Thanks for everyones replies!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Specific Unit Death
« Reply #6 on: 23 Jan 2005, 12:01:46 »
On how they behave when they are dead if there are a lot of them you might find it better to give each of them a "killed" event handler rather than a trigger.   Triggers use comuting power.