Jump to content
Sign in to follow this  
Bish

Add Action to "arrest" sb

Recommended Posts

Hey guys. I just have a quick question concerning arresting enemies.

So the basic idea is to create a realistic example of a modern combat mission, that's why my mission includes an IED. The IED just explodes if its spotter (AI) is alive. In real life, if you see someone conspicious or think you might have a suspect, you don't just shoot them, but you investigate them and eventually arrest them. So I basically just wanna add 2 new options to the action menu for people looking at the spotter.

The first one should be "Investigate". All I want is a message popping up saying he is wearing the trigger for a bomb.

The second one should be "arrest". What I want to happen is just simply the spotter despawning. Is that possible in any way?

I've tried it but the why I do it it won't work, so can anybody quickly explain how to solve these problems?

Share this post


Link to post
Share on other sites

Update: I rewrote this to work better in post #9.

Add the following to your suspect's init:

this addAction ["Interrogate","civ_i.sqf"];

civ_i.sqf:

// grab a value for the suspect
_suspect = _this select 0;

// Alert the soldier
hint "You find a trigger device on this suspect!";

// Remove all actions from the suspect
_action = _suspect addAction["foo", "foo.sqf"];
while {_action >= 0} do	{
_suspect removeAction _action;
_action = _action - 1;
};

// Add an action to the suspect to arrest him
_suspect addAction ["Arrest","civ_a.sqf"];

civ_a.sqf:

// Grab a value for the suspect
_suspect = _this select 0;

// Alert the soldier
hint "You arrest the suspect!";

// Delete the suspect
deleteVehicle _suspect;

Edited by kylania

Share this post


Link to post
Share on other sites

I've also got a solution.

Create a civ and name him

civ

you can change the unit type just keep the name.

Place this in the players Init

act1 = player addaction ["investigate","investigate.sqf","Bomb",1,false,true,"","_this == _target"];

Then save this script as "investigate.sqf"

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: TODO: Author Name
//////////////////////////////////////////////////////////////////
// act1 = player addaction ["investigate","investigate.sqf","Bomb",1,false,true,"","_this == _target"];
//////////////////////////////////////////////////////////////////

_suspect = cursorTarget;
_flag1 = _this select 3;
_dist  = player distance _suspect;

if (_dist <3) then
{ 

if ((_suspect == civ) and (_flag1=="Bomb")and (_dist <3)) then
 {
hint "He's Got A Bomb";
player removeAction act2; // Remove multiple acctions	
act2 = player addaction ["Arrest","Investigate.sqf","Arrest",1,false,true,"","_this == _target"];
}
else	
{
Hint "No Bomb Found";
player removeAction act2; // Remove multiple acctions
};
///////////////////////////////////////////////////////////////////////////

if ((_suspect == civ) and (_flag1=="Arrest")) then
{
hint "Your nicked";
player removeAction act2;
	_suspect action ["Surrender",_suspect];
	Sleep 2;
	deleteVehicle _suspect;
};
}
else	
{
Hint "You Need To Be Much Closer";
player removeAction act2; // Remove multiple acctions
};

};

---------- Post added at 02:01 AM ---------- Previous post was at 12:16 AM ----------

This little script will place the suspect in one of three locations at random.

Someone else asked for this along with an arrest script so I thought it better to keep it together.

Place this in the suspects init

nul=[this,logic1,logic2,logic3] execVM "RndPlace.sqf";

Create three game logics and name them logic1,logic2 and logic3 and place them where you want the suspect to be.

Then save the following as a script "rndplace.sqf"

// nul=[unit,logic1,logic2,logic3] execVM "rndplace.sqs";

_suspect = _this select 0;
_pos1    = _this select 1;
_pos2    = _this select 2;
_pos3    = _this select 3;

_rnd = round ( Random 2)+1;

if (_rnd==1) then
{
_suspect setpos getpos _pos1;
};
if (_rnd==2) then
{
_suspect setpos getpos _pos2;
};
if (_rnd==3) then
{
_suspect setpos getpos _pos3;
};

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Awesome guys! You both helped me a lot and saved me a lot of trouble :)

Thank you!

Share this post


Link to post
Share on other sites
I've also got a solution.

Create a civ and name him

civ

you can change the unit type just keep the name.

Place this in the players Init

act1 = player addaction ["investigate","investigate.sqf","Bomb",1,false,true,"","_this == _target"];

Then save this script as "investigate.sqf"

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: TODO: Author Name
//////////////////////////////////////////////////////////////////
// act1 = player addaction ["investigate","investigate.sqf","Bomb",1,false,true,"","_this == _target"];
//////////////////////////////////////////////////////////////////

_suspect = cursorTarget;
_flag1 = _this select 3;
_dist  = player distance _suspect;

if (_dist <3) then
{ 

if ((_suspect == civ) and (_flag1=="Bomb")and (_dist <3)) then
 {
hint "He's Got A Bomb";
player removeAction act2; // Remove multiple acctions	
act2 = player addaction ["Arrest","Investigate.sqf","Arrest",1,false,true,"","_this == _target"];
}
else	
{
Hint "No Bomb Found";
player removeAction act2; // Remove multiple acctions
};
///////////////////////////////////////////////////////////////////////////

if ((_suspect == civ) and (_flag1=="Arrest")) then
{
hint "Your nicked";
player removeAction act2;
	_suspect action ["Surrender",_suspect];
	Sleep 2;
	deleteVehicle _suspect;
};
}
else	
{
Hint "You Need To Be Much Closer";
player removeAction act2; // Remove multiple acctions
};

};
[/quote]

Hmm.. Very nice.
This could solve an issue I've been cooking with my wip mission.

It's a larger scale attack mission but one of goals is to capture enemy commander alive.
In one of my ArmA1 missions ("Justice for All") I used triggers which detected damage rate on targets so that when certain amount of punishment was given they dropped their weapons and surrendered.

Does this work the same if I add the action to the target's init?
[code]act1 = suspect addaction ["Hands up","surrender.sqf","Bomb",1,false,true,"","_this == _target"];

Of course there is no bomb in this case but instead I need the condition to be that he is without weapons

!(suspect hasWeapon "XX")

and player is closer than 2 meters.

He won't be deleted either but left standing there with hands above his head.

I can use the wounded condition in a trigger forcing him to drop weapons but how could I add it here scriptwise?

@Bish: Sorry for loaning your topic..:D

Share this post


Link to post
Share on other sites

I don't think it will work that way round.

kylania's script does have the trigger placed on the suspect.

I'm not really clear why you would want to change it though, as long as you name the commander civ it will work. I only called it civ as I was using a civillian for testing.

I'm not at my right PC now so I can't look at until this evening.

Oh the bomb isn't really a bomb it's just a flag so I know what's what.

it would be something like this may be if

((_suspect == civ) and (_flag1=="Bomb") and (!(suspect hasWeapon "XX"))and (_dist <3)) then

syntax maybe messed up but it's an idea.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

yeah , you're right.

(Not by home PC either at moment)

I could actually do it the way I've dealt with repairs in same mission.

Some of the tanks have set "repair vehicle" action defined in init.sqf and in the script I've used

 player isKindOf "USMC_xxxx"

condition so only engineers can repair them.

I could maybe tweak this the same way, except enabling the action for all west unit types.

I'll give it a go later when back home.

Share this post


Link to post
Share on other sites

I just had a few mins to try something out placing the action in the suspects init.

act1 = suspect addaction ["Hands up","surrender.sqf","Bomb",1,false,true,"","_this == _target"];

As I thought it won't work for two reasons.

Suspect and "_this == _target" however a slight change and it does seem to work.

act1 = civ addaction ["Hands up","surrender.sqf","Bomb",1,false,true,""];

You only get the options when you encounter the unit named civ.

Share this post


Link to post
Share on other sites

A friend of mine wanted to use this in his mission, so I rewrote my approach with some inspiration from F2k Sel's approach.

The direction from my friend was "I want every civilian to be interrogate able but only one to be arrestable."

So in every civilian's init I put this. It limits it to 3m range "approx face to face". Outside that range you don't see the option. Also once interrogated that civilian is not questionable again.

this addAction ["Interrogate","civ_i.sqf",[[color="Orange"][b]false[/b][/color]],1,false,true,"","(_target distance _this) < 3"];

The orange false there controls if they are innocent or guilty. Change that to true if it's the one you want arrested.

Here's the rewritten scripts:

civ_i.sqf:

// grab a value for the suspect and check for guilt flag
_suspect = _this select 0;
_bomber = (_this select 3) select 0;

// Remove all actions from the suspect
_action = _suspect addAction["foo", "foo.sqf"];
while {_action >= 0} do	{
_suspect removeAction _action;
_action = _action - 1;
};

// Quick animation, I really need to find a better Action for this, talking or something.
_suspect playAction "gestureNod";
sleep 3;

// If he's NOT the bomber, just quit.
if (!_bomber) exitwith {hint "You realize this guy is of no use to you."};

// He is the bomber, so lets get all up in ur bidness!
// This animation is a little long, but definitely looks like someone over explaining something.
_suspect playAction "SceneCommanderTalk";
sleep 5;

// Add an action to the suspect to arrest him
hint "This guy is obviously up to something...  Arrest him!";
_suspect addAction ["Arrest","civ_a.sqf"];

civ_a.sqf:

// Grab a value for the suspect
_suspect = _this select 0;

// Remove all actions from the suspect
_action = _suspect addAction["foo", "foo.sqf"];
while {_action >= 0} do	{
_suspect removeAction _action;
_action = _action - 1;
};

// Stop the current animation and surrender
_suspect switchmove "";
_suspect playActionNow "Surrender";
sleep 3;

// Alert the soldier
hint "You send the suspect to holdover.";

// "Teleport" the suspect to holdover, a GameLogic location pre-placed.
_suspect setPos getPos logic1;

As an aside, another feature we have is the ability for Engineers to disarm C4 IEDs.

Explosive Charge's init. Limited to only Engineer class players.

this addAction ["Disarm C4","disarmC4.sqf",[this],1,false,true,"","typeOf _this == ""USMC_SoldierS_Engineer"""];

disarmC4.sqf:

// Who's who...
_bomb = _this select 0;
_eod = _this select 1;

// "disarming" animation
_eod playMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 3.0;
WaitUntil {animationState _eod != "AmovPercMstpSnonWnonDnon_talking"};

deletevehicle _bomb;
_eod commandChat "C4 disarmed!";  // local unless broadcast, wish there was directChat

Share this post


Link to post
Share on other sites

Guys, you made my day, thanks.

I was banging my head against the wall with this.

I was also trying to add a publicVariable into script to use it as condition for task but oddly it's not working..

"NICK" = true;
publicVariable "NICK";

When I get that sorted I'm flying...

Share this post


Link to post
Share on other sites

It maybe because "NICK" would be a string, maybe just NICK = true; but I'm not sure about publicvariables.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

hi all, i was trying the scripts kylania wrote and works great in my pc, but when i try to play it in a MP mission the script doesn't work, and have no idea why.

any idea?

thanks

Share this post


Link to post
Share on other sites

That's weird since it's working in our MP mission? I'll be the first to admit I know jack about MP scripting, but what I posted is the code we're using. Odd. You're using the second post's code right? From post #9?

Share this post


Link to post
Share on other sites

yeah right, 9 one, i think its a server issue, but no idea what could be. if i host the mission doesn't work....

Share this post


Link to post
Share on other sites

I making a coop mission and I want 3 AI opfor enemy officers to be surrendered in our custody at mission start. So i removed their weapons, placed them near my team, but now i just need to get them to be *surrendered* and also make sure the AI in my team don't shoot them at all. eventually a chopper comes to evacuate us and i would need the prisoners to board the chopper and we all fly away and yay some other stuff and mission completed.

how can i make them so the are surrendered and keep my AI team from killing them?

Share this post


Link to post
Share on other sites

Either

this setCaptive true;

or group them with a BLUFOR high rank officer with 0% probability of presence.

Share this post


Link to post
Share on other sites

Hey guys !

I understood perfectly the script and it works ! But I would like to add something different !

I would like that the "suspect" after being arrested , to get in a chopper ... I basically know how to make the chopper arrive at the LZ using the radio calls and how to make it load soldiers etc...

My idea was to change this code :

// "Teleport" the suspect to holdover, a GameLogic location pre-placed.
_suspect setPos getPos logic1;

into a GetIn or load into chopper but unfortunately I dont know the script yet !

Could you help me please ?

Many thanks

Share this post


Link to post
Share on other sites
Could you help me please ?

use

_suspect assignAsCargo vehiclename; [_suspect] orderGetIn true;

Share this post


Link to post
Share on other sites
use
_suspect assignAsCargo vehiclename; [_suspect] orderGetIn true;

Aaaaaaalll riiiiiiiiiiiiiight ! excellent job ! many thanks :)

one more thing to unload the prisoner ? what should I type ?

thanks again

Share this post


Link to post
Share on other sites
to unload the prisoner ? what should I type ?

thanks again

Youre welcome :)

unassignVehicle _suspect; [_suspect] orderGetIn false;

Share this post


Link to post
Share on other sites
Youre welcome :)

unassignVehicle _suspect; [_suspect] orderGetIn false;

where should I type this ? I was thinking in creating a new civ_f.sqf and put only this inside where the suspect will reach the landing zone and something there would call the civ_f.sqf

Am I correct ?

Share this post


Link to post
Share on other sites

yeah that would work, also you can put it in a vehicle present trigger grouped with the vehicle and this in condition:

this AND nameOfSuspectInEditor in vehiclename

on act:

unassignVehicle nameOfSuspectInEditor; [nameOfSuspectInEditor] orderGetIn false;

Share this post


Link to post
Share on other sites

Hi all is there a way of using the arrest script after you have searched and found an illegal item on a civ

I am trying to simulate a harts and minds type mission and require soldiers to find evidence in compounds and search civis and cars on a road block in that area.

For illegal items such as weapons radios bomb making equipment intelligence and if a civi is found carring illegal items to be able to arrest them for later interrogation which might or might not reveal locations on the map

I have got the arrest sorted and a MP landrover to come to location from police station. Then the arrested civ enters MP landie.

I also would like to make the landie drive back to the police station or uk fob for interrorgating and the suspect to go to a holding area till ready to question him

has any 1 got a heads up where to look for a similar script or help adjusting this script thank's all

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  

×