Jump to content
Sign in to follow this  
iTicTactical

Hostage Rescue Script

Recommended Posts

Hey all,

Basically I'm looking to secure 2 hostages who are sat down on chairs via the 'addAction' command.

Once the player(s) secure the room they will need to approach both hostages, manually secure them (addAction), the hostages stop their sitting animation and stand up from which point they are silently added to the players' group.

Can someone help with this?

I think I have all I need, I just need to know how to put it all together to get a functioning action. So if someone could provide me with an example script of what I want it would really be appreciated.

Many thanks

Share this post


Link to post
Share on other sites

Thanks for getting back to me so quickly.

My issue with those scripts are that I only need the scripts running off of a pre-placed AI. I don't need a random locator or a specific one because the AI will already be placed (so I wouldn't have a clue what to delete to help me).

I'm still learning scripting for ArmA myself so if there is a simpler version that would be easier for me to implement and learn, I would appreciate it if someone could point me in the right direction.

Also this is for a Singleplayer mission, not online.

Many thanks

Share this post


Link to post
Share on other sites

Well in that case try this, and see if any of the videos or other webpages are of any use.

Share this post


Link to post
Share on other sites
Well in that case try this, and see if any of the videos or other webpages are of any use.

JShock, lol, actually your link was nice, I would like to use that some how or another. But that's down the road.

OP, there are many hostage scripts, but I have not come across anything to your exact need with sitting and standing animations. (I think its because the animations may not always work).

You could always place units in certain positions and make sure you keep them as setCaptive true; I just use the survivor unit, he's ready to go, join silent can be used with trigger, I actually just attach triggers to units therefore if they decide to move the trigger is set to pop once blufor is within a certain distance.

http://www.arma3editor.com/2013/04/16/hostage-rescue/

http://www.kylania.com/ex/?p=11

I help where I can.... if you need anything broken I am your man! Just don't tell JShock

Share this post


Link to post
Share on other sites

Yep, all 3 of those are on the first page of what I linked :p (I know it's a bit dickish to do it, but it pointed in all the right directions).

Share this post


Link to post
Share on other sites

It's easy to take the piss when you know what to do or where to go. Thanks for pointing me to a search engine though...

I've already been and found certain threads via Google, YouTube etc but I wanted some help with something very specific as I'm not completely competent with scripting in ArmA yet and I wouldn't know how to set what I want up properly (hence these editing forums for help...). I haven't seen much related to what I actually want either (in terms of the animations etc). If I wanted to simply capture them via a trigger I would've done that a while ago. I just want a higher level of detail than that.

I'm sure there is a way to do it so unless someone on here knows and is willing to help me, I'll just have to keep looking.

Thanks for the advice though JAndrews

Edited by Dale260

Share this post


Link to post
Share on other sites

Put in init field of each hostage:

this addAction
[
"Secure Hostage",
{
	(_this select 0) removeAction (_this select 2);
	(_this select 0) setUnitPos "UP";
	[(_this select 0)] joinSilent (group (_this select 1));
},
nil,
6,
true,
true,
"",
"_this distance _target < 5"
];

Or if your doing it via the playAction command:

this addAction
[
"Secure Hostage",
{
	(_this select 0) removeAction (_this select 2);
	(_this select 0) playAction "Stand";
	[(_this select 0)] joinSilent (group (_this select 1));
},
nil,
6,
true,
true,
"",
"_this distance _target < 5"
];

Edited by JShock

Share this post


Link to post
Share on other sites

Many thanks.

Seems a lot simpler than the way Kylania posted on their thread. (at least for me anyway)

What's the difference between this;

_per = _this select 0; // Person who had the addAction

_caller = _this select 1; // Person who used the addAction

_act = _this select 2; // ID of the addAction

// Group given in the arguments section (ie: [Hostage]

_per = _this select 3;

// Remove the rescue option

_per removeAction _act;

// Join preselected unit (Hostage) to callers group, silently.

_per joinSilent _caller;

...and what you have just posted?

Does the setUnitPos "UP" force the AI to stand up from an animation if one is implemented? or does it just force them to be upright wherever they go as usual?

Just trying to learn it, thanks

Share this post


Link to post
Share on other sites

I'm attaching the action directly to the hostage, so "(_this select 0)" is the hostage within the code, they have the hostage unit passed in via the arguments parameter for addAction which is accessed via "(_this select 3)". And the only other difference is that I just skipped assigning the object/caller/actionID values to variables.

Does the setUnitPos "UP" force the AI to stand up from an animation if one is implemented? or does it just force them to be upright wherever they go as usual?

I will assume yes, but test it to see, I'm not quite sure, but they should stand up no matter what their current state is, and they should be able to freely move after that.

Share this post


Link to post
Share on other sites

Thanks for explaining.

Unfortunately the AI becomes stuck in the current animation even after they've joined the players' group.

I'm using the following as the sitting animation as it isn't simply a 'frozen image'...

[this, "SIT_SAD1","NONE"] call BIS_fnc_ambientAnim;

I figure I just need a script to trigger once the addAction is activated to release him from the animation? I've tried enbaleSimulation "ANIM" and even playActionNow and switchMove ""; but still no joy.

Now I did find this in the functions viewer;

if (isNull _unit) exitWith

{

//["Function terminated, unit doesn't exist!"] call BIS_fnc_logFormat;

};

if (isNil "_forcedSnapPoint") then

{

["Forced snappoint doesn't exist!"] call BIS_fnc_error;

_forcedSnapPoint = objNull;

};

if ((_unit getVariable ["BIS_fnc_ambientAnim__animset",""]) != "") exitWith

{

["[%1] Trying to play an ambient animation [%3] while another [%2] is already playing!",_unit,_unit getVariable ["BIS_fnc_ambientAnim__animset",""],_animset] call BIS_fnc_logFormat;

/*

_unit call BIS_fnc_ambientAnim__terminate;

_this spawn

{

sleep 1;

_this call BIS_fnc_ambientAnim;

};

*/

};

But what does it mean, is it even the right code for what I need?

I don't even care about a standing up animation anymore. I just want the AI up and free to move when the addAction is activated...

Share this post


Link to post
Share on other sites

You can terminate a ambient anim via

_unit call BIS_fnc_ambientAnim__terminate  

See this post

Share this post


Link to post
Share on other sites

hello I need help,

the trigger is to be activated when the hostaggio not handcuffed then the task is completed.

the problem is what the script to use to activate the trigger?

for the civil Handcuff I used this string

[this, true] call AGM_Captives_fnc_setCaptive;

Share this post


Link to post
Share on other sites
hello I need help,

the trigger is to be activated when the hostaggio not handcuffed then the task is completed.

the problem is what the script to use to activate the trigger?

for the civil Handcuff I used this string

[this, true] call AGM_Captives_fnc_setCaptive;

Ask in the AGM thread: http://forums.bistudio.com/showthread.php?178253-Authentic-Gameplay-Modification

Share this post


Link to post
Share on other sites
agm thread is closed .

Sorry should have checked, forgot they moved to ACE3 :p.

Share this post


Link to post
Share on other sites

I not understand ... which I use script to activate the trigger web the civilian is not handcuffed ?

---------- Post added at 03:46 ---------- Previous post was at 03:43 ----------

I not understand ... which I use script to activate the trigger when the civilian is not handcuffed ?

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  

×