OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: redmenace on 19 Nov 2005, 20:10:30

Title: controlling group hostility?
Post by: redmenace on 19 Nov 2005, 20:10:30
How do you make it so police fire back if fired upon?
Is there a init field command to make a group hostile/hostile if fired upon, even if they are civillians?

thx

Title: Re:controlling group hostility?
Post by: macguba on 19 Nov 2005, 20:17:42
Welcome to the forum!

Usually in these sort of situations the answer is setCaptive true/false commands.    Give us more detail about the situation and we can give a more detailed answer.
Title: Re:controlling group hostility?
Post by: redmenace on 19 Nov 2005, 20:22:13
Well I was fooling around and wanted to make a quick gta-style mission, like just have a bunch of civillians, cars, police, and the player. The only thing is when I shoot the police they don't shoot back. The same thing happens if you are a civillian and you shoot anybody.

So I guess I'm asking how to make police respond if shot at, and also if its possible to make a group of units and sort of make it its own team, which shoots at anyone if they are shot at first.
Title: Re:controlling group hostility?
Post by: macguba on 19 Nov 2005, 22:23:32
In the mission editor, go to the Intel Box (cloud/sun bit, top right hand corner.)   Set the Resistance friendly to nobody.  Whether you are East or West, the police will now shoot at you.  Probably.

However, you doubtless want to be a civvy too.   So use this trick.  It works any way round, and you can use it to make loons in any clothes be on any side you want.

Create the civilian player unit.   Create a West officer and make him a colonel.   Now group the player to the officer.  (Not the other way around.)    Your civvy is now side West and anybody who is enemy to West will shoot at him.

Play around with this.  You'll soon figure out what you want.
Title: Re:controlling group hostility?
Post by: Pilot on 19 Nov 2005, 22:26:26
Quote
Now group the player to the officer.  (Not the other way around.)
What difference does that make?

-Pilot
Title: Re:controlling group hostility?
Post by: macguba on 19 Nov 2005, 22:54:32
There is a risk that the officer would join your group, rather than you joining his (which would mess things up entirely).   If you want to be absolutely sure of getting it right, make the officer higher rank than you and also join him to you.  
Title: Re:controlling group hostility?
Post by: Planck on 19 Nov 2005, 23:12:32
And don't forget to make the officers probability of presence = 0.


Planck
Title: Re:controlling group hostility?
Post by: redmenace on 19 Nov 2005, 23:18:36
thanks for the help, but theres just one more thing, which is that now the police just shoot at you when they see you, but what I need is for them only to shoot when fired at (or preferrably when fired at or near).

thanks
Title: Re:controlling group hostility?
Post by: Pilot on 19 Nov 2005, 23:18:52
@macguba
I always thought that when a lower ranking unit was joined to a higher ranking unit, the higher ranking unit would be leader by default.

Of course, if the player unit is a colonel, then you would be absolutely right.  And I guess it doesn't hurt to be on the safe side.

-Pilot

EDIT:
Quote
thanks for the help, but theres just one more thing, which is that now the police just shoot at you when they see you, but what I need is for them only to shoot when fired at (or preferrably when fired at or near).

thanks
What you could do is add a 'fired' eventhandler to the player unit.  When the player fires, the eventhandler would setcaptive the player false, ex:
put this in the player's init field:
this addeventhandler ["Fired", {_this setcaptive false}]

Be sure to also put the following in the player's init field:
this setcaptive true

EDIT EDIT:
Correction
Title: Re:controlling group hostility?
Post by: macguba on 19 Nov 2005, 23:46:36
@Planck - well spotted.   ;D

@Pilot - yes you're right, its just better to be safe than sorry.

@redmenace, I should explain that setCaptive true means that nobody will shoot at you.   In Pilot's answer, as soon as you fire you become setCaptive false which means that your enemies (ie the police) will shoot at you.

There are further subtleties of how you might handle this depending on exactly what conditions you want.   However, setcaptive true/false is almost certain to the at the heart of it.   Get Pilot's answer working first, before going any further.    There is lots of stuff that will help you in the Editors Depot - have a good look round.