Jump to content
Sign in to follow this  
keimosabe

trigger to check for dead civilians

Recommended Posts

In the mission I'm currently working on, I'd like to add a little difficulty for the players in that when they get into a firefight, they cannot kill civilians. SO my question is two fold...

The normal trigger to check for dead people is !alive [name]. I would assume that civilians are a CLASS so how can you modify that to check to see if any of a certain CLASS are dead? Is that even possible.

And then lastly, if the above IS possible and you can point me in the right direction code wise, then is it possible to make it so that 5 civilians can die before mission fail.

some type of count that increments by one every time the !alive "civilian" (or whatever goes there) detects a new dead civilian. I can do the code that will alert players that another civvie is dead but I'm useless on the code to do the count. If you can do it and can just supply me with the code for the first count, I can take it from there.

And as usual... thanks in advance guys. I have actually stopped playing Dragon Age:Origins due to all the fun I'm having with the editor now....:eek:

**edit: I found where all the classes are and it seems that each civilian is assigned a different CLASS but they are all assigned to the same SIDE "civilian". So, can I make a trigger that looks for !alive [sIDE]?

Edited by keimosabe
on the right track

Share this post


Link to post
Share on other sites

Oh man, thanks for that link. That is DEFINITELY a step in the right direction. My only question left is "how do you name a group?" Am I missing something simple here? Is the NAME of the group the NAME of that group in the group selection (f2). And if I GROUP more civilians than comes with that group when it's initially made, will they become part of that group NAME as well?

---------- Post added at 02:56 PM ---------- Previous post was at 02:23 PM ----------

in working with that mod, it seems that the casualties cap is linked in with the rest of the actual stuff and I haven't yet figured out how to pull JUST the casualties cap out of it. I'll keep working on it and thanks again for the link

Edited by keimosabe
getting closer....

Share this post


Link to post
Share on other sites

@keimosabe:

Let us know when you crack it mate, I'm keen on implementing something like this in my own SP missions. Very very few armies fight to the last man and the last bullet, I really want to model firefights where the AI decides "enough is enough" and starts to pull out.

Share this post


Link to post
Share on other sites

All I do which I found somewhere in these forums is either.

Create a trigger

Civilian Present once

Condition this and isserver

Activation

GRIM_CivKilled = 0; publicVariable "GRIM_CivKilled"; {_x addeventhandler ["killed", {GRIM_CivKilled = GRIM_CivKilled + 1; publicVariable "GRIM_CivKilled"}]; } foreach thislist;

Make sure there are no animals in the trigger area, an this will add an event handler to each civilian that when killed adds 1 to the public variable GRIM_CivKilled. Easist way to add to a whole town of civs.

As well you could just add this to individual civilian init lines.

this addeventhandler ["killed", {GRIM_CivKilled = GRIM_CivKilled + 1; publicVariable "GRIM_CivKilled"}];

Easist way to add to individual civs.

Both will work in the same mission as long as they are applied to seperate groups.

Then create another trigger none present once

Condition GRIM_CivKilled > 5

Activation tskObj8 setTaskState "FAILED"

In this case I have it as after more than five civilians have been killed it registers the task as a fail.

You could put anything in the activation to register the failure, I use the tasks system, where I setup the task as being a sucess for the startof the mission and it will only change to a fail here.

You could also set multiple levels of failure with more triggers that are set to different numbers killed, starting with a handslap, right up to informed you are to be court marsheled and hung for your crimes against humanity.

From the variables pos credit to someone named GRIM?

Share this post


Link to post
Share on other sites

Anyway to expand on this? I would like to set in my mission, that if a player kills say 3 civilians, then that player will be killed. Set a penalty for killing civilians.

If that is too hard to code, then make it so if 3 civilians get killed then the whole team gets killed and has to respawn. I would like something to deter killing civilians but I don't really want to kill the whole mission becuase one player decides to shoot the civilians.

Nomadd

Share this post


Link to post
Share on other sites

Hey blakece, thanks for that heads up man. I'll definitely try that in my mission and see how it goes. Thanks a lot man.

Share this post


Link to post
Share on other sites
Hey blakece, thanks for that heads up man. I'll definitely try that in my mission and see how it goes. Thanks a lot man.

No worries, just re-read my post, if you are only using the line in individual civilians, remember to initilize the

GRIM_CivKilled = 0;

somewhere like in init.sqf

Still couldn't find where I originaly found this atm, for giving due credit.

Share this post


Link to post
Share on other sites

Hi,

I'm trying to put this

"hint format['Civil tué par %1',_this select 1]

in this

GRIM_CivKilled = 0;
publicVariable "GRIM_CivKilled"; 
{_x addeventhandler ["killed", {if(side (_this select 1) == west) then {GRIM_CivKilled = GRIM_CivKilled + 1; publicVariable "GRIM_CivKilled"}}]; } foreach thislist;

but it doesn't work ?

Where am I mistaken ?

Thanks. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×