Jump to content
Purzel

Hostage cinematic situation

Recommended Posts

We´ve got a hostage situation in MP.
 

Three hostagetakers are in a room with a hostage:
One should aim at the hostage, one is a bystander and one is behind a camera.
The hostage is sitting on a chair. (Blufor unit, but setcaptive true)

arma32016122713001891uakl4.jpg

 

Remember: This is a multiplayer-situation, our human team should rescue the hostage, so it has to work on a dedicated server!
and as a bonus there should be the following little cinematic scene:

If the team enters the room

  • terrorist1 (left behind the hostage) should pull its weapon and fire at the hostage (which results in a dead hoastage, if the team eliminates him not fast enough!).
  • terrorist2 (leaning on wall rightsided) should attack the team.
  • terrorist 3 (behind camera) should grab the weapon on the table with the monitor or pull its handgun and attack the team.


I want to create a CQB-situation, which is challenging the team (almost no time, fast and precise aiming)

How can I manage the first tango to holster its weapon and aim not until the team enters the room?
I´ve got a trigger placed running through the room to cover up both entrances.
I already used to try DoWatch and DoTarget on terrorist1, but it fails because of the knowledge how to holster the weapon.


How can I command the other AI-units to aim straighly at the entering team?
Means: Leaving their states from the following code:

 

  • terrorist1 playmove "AmovPercMstpSrasWrflDnon_AmovPercMstpSnonWnonDnon";  
  • [terrorist2,"LEAN","ASIS",{(player distance _this) < 2}] call BIS_fnc_ambientAnimCombat;
  • [terrorist3,"WATCH1","ASIS",{(player distance _this) < 2}] call BIS_fnc_ambientAnimCombat;
     

Unfortunatly the above BIS_fnc_ambientAnimCombat-code needs a rifle, but my terrorist guys 1 & 3 should only have handguns.
-Unfortunatly the building has more than one floor and when I set the BIS_fnc_ambientAnimCombat-value higher than 2 it could release the animation from a floor above or below.
(and this scene is part of a bigger (fast-roping-)mission, which only works on this hotel-building and I cannot put this scene into the first floor or into another building because of the other mission goals.)

Because of a sniper-team on an overwatch-position in an opposite house at least the terrorist2 and terrorist3 AI-units should not just stand still, but use the relaxed ambientCombat-animations
(maybe terrorist1 could talk some terrorist-blabla into the camera while waiting for the players, so the sniper team have to see/report something.)
and only grab their weapons, if the assault-team players entering the room.
 

I don´t want to use the init-lines from the units, a better solution would be a server-sided script, which runs from the beginning.
(because it will cause traffic on every time a user connects and streams the whole init-stuff to all clients

and - it would reset a changed animation-state to the previous state if someone enters the server while entering the room!)


The hostage sits on a chair and if a player is nearby the hostage should stand up and surrender to get handcuffed by the assault-team.
He is bound to the chair by this code:
hostage setcaptive true;
[hostage,"SIT_U1"] call BIS_fnc_ambientAnim;

a trigger checks the distance to the hostage:
Condition:
({(hostage distance _x) < 1} count playableUnits) > 0
On Activation:
if (isServer) then {hostage enableAI "ANIM";[hostage, true] call ACE_captives_fnc_setSurrendered};

but if a playable unit is nearby nothing happens.
What did I miss?


Hints anyone?
Telling me how to change the animation-states correctly would be appreciated..!

Greetings
Purzel

  • Like 1

Share this post


Link to post
Share on other sites
Quote

but if a playable unit is nearby nothing happens.

You need to terminate the ambientAnim.

hostage call BIS_fnc_ambientAnim__terminate

Take note of double _ before terminate.

You do not need hostage enableAI "ANIM"; terminate will do this for you as well as other things like detaching the unit from the gamelogic ambientAnim attaches him to.

Share this post


Link to post
Share on other sites
On 12/27/2016 at 4:00 PM, purzel said:

We´ve got a hostage situation in MP.
 

Three hostagetakers are in a room with a hostage:
One should aim at the hostage, one is a bystander and one is behind a camera.
The hostage is sitting on a chair. (Blufor unit, but setcaptive true)

 

If the team enters the room

  • terrorist1 (left behind the hostage) should pull its weapon and fire at the hostage (which results in a dead hoastage, if the team eliminates him not fast enough!).
  • terrorist2 (leaning on wall rightsided) should attack the team.
  • terrorist 3 (behind camera) should grab the weapon on the table with the monitor or pull its handgun and attack the team.


I want to create a CQB-situation, which is challenging the team (almost no time, fast and precise aiming)

How can I manage the first tango to holster its weapon and aim not until the team enters the room?
I´ve got a trigger placed running through the room to cover up both entrances.
I already used to try DoWatch and DoTarget on terrorist1, but it fails because of the knowledge how to holster the weapon.

 

Nice staging dude.  You can make it work!

 

Regarding holstered pistols, remove rifles (primaryWeapon) from all tangos, and put this in each of their inits:

this setunitpos "UP";                           // Keep tango standing up straight
this action ["SwitchWeapon", this, this, 100];  // Tango holsters pistol
this setBehaviour "CARELESS";                   // Keep tango from reacting until your breach trigger fires

Put this in hostage init:

this setcaptive true; // keep tangos from targeting hostage until breach trigger fires

Add this code to breach trigger when rescue team enters room:

terrorist1 setBehaviour "Combat"; // Besides the obvious effect on behaviour, this also causes tango to pull pistol
hostage setcaptive false;
terrorist1 reveal hostage;
terrorist1 doTarget hostage;
terrorist1 doFire hostage;

terrorist2 setBehaviour "Combat"; // Besides the obvious effect on behaviour, this also causes tango to pull pistol
terrorist2 reveal rescuer1;
terrorist2 doWatch rescuer1;      // rescuer1 should be first one through the door.  Maybe need a script to find closest rescuer instead
terrorist2 doTarget rescuer1;
terrorist1 doFire rescuer1;

That should work for tango 1 and 2.  Tango 3 taking weapon from table is more work, but doable.  You need to:

  • Place a weapon holder on the table, and put rifle of your choice in it.
  • Remove all weapons from tango 3
  • Place a 4th tango in a corner of the map that will never be seen who has the loaded rifle you want tango 3 to have
  • On breach, script tango 3 to:
    • terrorist3 moveTo getpos table1;
    • sleep X or waituntil near table (allow tango 3 to get to table before taking weapon)
    • terrorist3 action ["TakeWeapon", Tango4, "yourRifleClassName"];  // Plays take animation and gives tango 4's rifle to terrorist3
    • delete weapon holder on table so it disappears
    • setBehaviour "COMBAT";

 

Of course you need code for your standing animations, and terminating those animations as Larrow stated.

 

If you want the camera man to look like he's operating the camera, try the static MG gunner animation (the tall MG that you stand behind).

 

It will take some work, but it will be worth it man!  I look forward to seeing it!

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks to all!

I´ll give it a try if I have some time and post the results here....

stay tuned!

Share this post


Link to post
Share on other sites

OK...
Nothing works as desired...
 

start-situation:

 

 

if (isServer) then {
hostage setcaptive true;                              // keep tangos from targeting hostage until breach trigger fires
[hostage,"SIT_SAD1"] call BIS_fnc_ambientAnim;

terrorist1 setunitpos "UP";                           // Keep tango standing up straight
terrorist1 action ["SwitchWeapon", terrorist1, terrorist1, 100];     // Tango holsters pistol
terrorist1 setBehaviour "CARELESS";    
  

terrorist2 setunitpos "UP";                           // Keep tango standing up straight
//terrorist2 action ["SwitchWeapon", terrorist2, terrorist2, 100];     // Tango holsters pistol
terrorist2 setBehaviour "CARELESS";                    // Keep tango from reacting until your breach trigger fires


terrorist3 setunitpos "UP";                           // Keep tango standing up straight
//terrorist3 action ["SwitchWeapon", terrorist3, terrorist3, 100];     // Tango holsters pistol
terrorist3 setBehaviour "CARELESS"; 
   
};

 

hostage-shooting script:
 

if (isServer) then {
hostage call BIS_fnc_ambientAnim__terminate;
detach hostage;
hostage setcaptive false;

terrorist1 setBehaviour "Combat";      // Besides the obvious effect on behaviour, this also causes tango to pull pistol
terrorist1 reveal hostage;
terrorist1 doTarget hostage;
terrorist1 doFire hostage;

};

 

attack entry-team script:
 

if (isServer) then {

NearestEnemy2 = terrorist2 findNearestEnemy hostage;
NearestEnemy3 = terrorist3 findNearestEnemy hostage;

terrorist2 setBehaviour "Combat";      // Besides the obvious effect on behaviour, this also causes tango to pull pistol
terrorist2 reveal NearestEnemy2;
terrorist2 doWatch NearestEnemy2;          // rescuer1 should be first one through the door.  Maybe need a script to find closest rescuer instead
terrorist2 doTarget NearestEnemy2;
terrorist2 doFire NearestEnemy2;  

terrorist3 setBehaviour "Combat";      // Besides the obvious effect on behaviour, this also causes tango to pull pistol
terrorist3 reveal NearestEnemy3;
terrorist3 doWatch NearestEnemy3;          // rescuer1 should be first one through the door.  Maybe need a script to find closest rescuer instead
terrorist3 doTarget NearestEnemy3;
terrorist3 doFire NearestEnemy3; 

};

 

Problems:

The hostage isn´t de-attached from the chair after glueing it there with "[hostage,"SIT_SAD1"] call BIS_fnc_ambientAnim;"...
Larrow told me to detach it with:
"hostage call BIS_fnc_ambientAnim__terminate;"
Unfortunatly this is not working... even not with "detach hostage;"

 

Tango1 and 2 don´t shoot at anything.
Instead Tango1 (who should kill the hostage) follows the player with its gun, but is not firing at all (not at both: hostage or player)
Tango3 shoots at player.

 

 

Question:
Whats wrong?

Share this post


Link to post
Share on other sites

I dont see you selectWeapon anywhere. You move them away but do not instruct any AI to select weapons back?

Share this post


Link to post
Share on other sites

Getting AI to behave always requires experimentation.  Here's a few suggestions:

 

1. Get hostage out of chair.

 

Another method for this would be to use switchMove to put him in a sitting animation, and switchmove to get out of chair.  If your current animations aren't working try a truck passenger animation for sitting in chair (I've done that before).

 

2. Get Tangos to shoot at hostage.

Work on one thing at a time.  Do "player setCaptive true" so nobody shoots at player so you can observe just the target captive AI behaviour.  Trigger your breach code.  Now the only enemy of tangos is hostage.  Do they target and fire on him?  If so, your code is working, but AI is reacting too slow.  Did you put the tangos in a specific animation?  If so you may need to switchmove "" on them to get them out of that animation.  Try setting skills higher for tangos to improve their reaction time.  Once you get targeting of hostage working, then set player back to setcaptive false, and work on reaction to entry team/player.

 

3.  Look at the differences between these two commands:  BIS_fnc_ambientAnim and BIS_fnc_ambientAnimCombat

 

Here's a comment BlueFire posted on the wiki:  "If the unit should react to combat use BIS_fnc_ambientAnimCombat instead".

Sounds like ambientAnim was intended for cutscenes and not live action perhaps.  Try the combat version.

 

A complex scene like this won't be easy (could take hours to get right), but I think its doable.

 

You may also want to try some disableAI commands on tangos (like 'FSM', 'PATH', etc.).  Maybe that will restrict AI's thinking to shooting entry team...rather than where to move to next.

Share this post


Link to post
Share on other sites
Just now, killzone_kid said:

I dont see you selectWeapon anywhere. You move them away but do not instruct any AI to select weapons back?

In my experience, when AI has a holstered weapon, switching them to behaviour COMBAT causes them to draw the handgun.

Share this post


Link to post
Share on other sites

T2 has only an AK-47
T1 & T3 have only handguns (MP-443 from the RHS-mod.
Weapons are drawn.
Wait a few minutes and I will test the triggered thing.
AI is set to maximum... reaction should be fast as possible.

@johnnyboy:
stupid question:
where do I find the animations? Is there a pictured list?

 


 

Share this post


Link to post
Share on other sites
9 minutes ago, purzel said:

where do I find the animations? Is there a pictured list?

Start your mission in the editor and hit Escape.  There is an Animation Viewer option as a button on the bottom somewhere.  In the viewer upper left you see different categories of animations, click on them, and see them played.  When you find one you like write it down or double click on it to get to config and copy the name to clipboard.  It's a hassle to find the one you want.  Try the combat version of ambientAnim first as that might fix this for you, and then you won't need to search for other anims to use switchMove with.

Share this post


Link to post
Share on other sites

OK, I´ve tested it as you said:
hostage was the only Blufor unit. tried to kill him by script (via radio command).
T1 is not shooting at hostage..


to-do-list:
Try to change ambientAnimation to AmbientCombat animation.
(this may nt work for hostage, so I´ll try to fix it with the switch-move animations

Give me some time... I´ll report in a few minutes

Share this post


Link to post
Share on other sites

switchmove and freeing the hostage ist working now.

How can I use a switchmove animation in a loop?
Terrorist1 should stand and animate ...
How do I switch one animation into another?
e.g.:

  1. [terrorist1, "Acts_Executioner_StandingLoop"] remoteExec ["switchMove", 0];        > executioner (tango1) is standing and waiting
  2. [terrorist1, "Acts_Executioner_Kill"] remoteExec ["switchMove", 0];                       >  executioner pulls weapon and shoots hostage
  3. [hostage, "Acts_ExecutionVictim_Kill_End"] remoteExec ["switchMove", 0];          >  hostage is falling dead to side

 

How do I get animation 1 and 2 running after each other?
I would like to show some mistreating-actions (found it in "cutscenes") in between the standing animations, so our spotter/sniper-team has to report the cruelties to the entry-team.
(I know its just eye-candy, but nice)
If I get the execution scene running, I will insert some beating-the-hostage-stuff....

Share this post


Link to post
Share on other sites
1 hour ago, purzel said:

 

How do I get animation 1 and 2 running after each other?
 


like this

bob playMove "Acts_Executioner_StandingLoop"; 
bob playMove "Acts_Executioner_Kill";


I also think you don't need remoteExec with playMove

Share this post


Link to post
Share on other sites

I´m getting it done (slowly!),
between working and family...

AI units are moving when executing code...
hostage slides to right side.

I´ve tried to fix it by a "this stop true"-command... but hostage moves at all... grrr

 

I still have problems to synchronize the slapping and hit-animations of terrorist 2 and hostage...

[terrorist2, "Acts_Executioner_Backhand"] remoteExec ["playMove", 0];

[hostage, "Acts_ExecutionVictim_Forehand"] remoteExec ["playMove", 0];  

 I´m wondering, if cinematic scenes are practicable at all...
I´have still hope, it could work (just because the sniper team has something interesting to watch and report).
 

Is there a possiblitiy to jump to a previous line of the .sqf, so animations will repeat, until sequence is interrupting by entry-team (which starts the hostage-killing-sequence) or until terrorists are dead by snipers?

So I could use a repeating of some animations again and again...

Greetz Purzel

 

  • Like 1

Share this post


Link to post
Share on other sites

Again, I would not recommend using playMove and remoteExec, switchMove and remoteExect is fine though.

You can track some animation progress with moveTime command.

You can also use Animxxxx EHs to sync stuff.

Share this post


Link to post
Share on other sites
5 hours ago, purzel said:

I´m getting it done (slowly!),
between working and family...

AI units are moving when executing code...
hostage slides to right side.

You can do it!  Its worth it man!

 

If units are moving because they are attepting to walk somewhere, then try the following commands:

tango1 forceSpeed 0; // if you want them to move again on breach trigger forcespeed -1
tango1 disableAI "FSM"; // turn off some ai thinking.  They will still shoot at known enemies

If hostage is sliding off of chair for some reason, then attach him to the chair via attachTo.

 

For looping until the breach occurs, use a global variable that is set to false initially, and set to true by breach trigger.

BREACH = false; // Breach trigger should set BREACH to true
while {!BREACH and damage terrorst1 == 0 and damage terrorist2 == 0 and damage terrorist3 == 0} do
{
	// slap the infidel beetch until breach occurs or until any of the tangos are shot
	... code you want to repeat goes here
};

I remember a great Rainbow Six mission where sniper could not see all tangos through window, so breach had to be  coordinated with sniper shot, or the hostage could not be saved.  Good times.

Share this post


Link to post
Share on other sites
Quote

@purzel can you share the scenario once it's done?

 

 

Of course....  :f:

  • Like 1

Share this post


Link to post
Share on other sites

Sorry for not keeping in contact for a while, I was very busy...
hahaha!  :dozingoff:

 

nothingtheless the "breach"-trigger doesn´t start of...
its set to "only Blufor present"... but nothing...
So I can´t check, if all "kill-the-hostage"-stuff is executed...

 

Share this post


Link to post
Share on other sites


This is what I´ve got:

 

- The animation stuff is not easy to handle, animations often shove the owners to another position.

  So I decided to attach the hostage to terrorist2.
  Terrorist2 itself can be attached to a litte item on the ground (e.g. photos, papertowel, matches, etc)

 

- After some animations the units are in another direction as before, so I had to use the setdir-command.
 

- The remote-exec-thing: If I use it the animation will allways be synced to all players.

  If there is a sniper-team (sniper and spotter) both will see the same animation.

  So thats the reason I decided to use the remoteExec-function.

  In SP you could probably go without, but this is made for dedicated MP-server.

 

 


Put the following stuff into your files:
(All .sqf-files are in a folder calles scripts.)

Init.sqf:   (in mission-root-directory, not in the script-folder!!!)
 if (isNil "BREACH") then {variable = false};     // sets the BREACH-variable to "false".
 

Set up your scenario:
3 terrorists, 1 hostage.  (one Tango behind a camera, hostage in front of two Tangos)

Name them hostage, terrorist1, terrorist2, terrorist3.
(t1 is the executioner, t2 is the slapper, t3 is behind camera.)
1 trigger inside the room, behind the the door.

 

 

create a hostagesetup.sqf:

and start it from the init of the hostage:
if (isServer) then {[] execVM "scripts\hostagesetup.sqf";};

 

if (isServer) then {
BREACH = false;
while {!BREACH and damage terrorist1 == 0 and damage terrorist2 == 0 and damage terrorist3 == 0} do
    {
    hostage setcaptive true;
    hostage disableAI "FSM";
    hostage attachTo [terrorist2,[-0.5,1,0]];
    hostage setdir 90;
    hostage setBehaviour "CARELESS";
    hostage forceSpeed 0;
    terrorist1 forceSpeed 0;
    terrorist2 forceSpeed 0;
    terrorist3 forceSpeed 0;
    terrorist1 setunitpos "UP";  
    terrorist2 setunitpos "UP";
    terrorist3 setunitpos "UP";
    terrorist1 disableAI "FSM";
    terrorist2 disableAI "FSM";
    terrorist3 disableAI "FSM";
    terrorist1 setBehaviour "CARELESS";
    terrorist2 setBehaviour "CARELESS";
    terrorist3 setBehaviour "CARELESS";
    [hostage, "Acts_ExecutionVictim_Loop"] remoteExec ["playMove", 0];
    [terrorist1, "Acts_Executioner_StandingLoop"] remoteExec ["playMove", 0];
    [terrorist2, "Acts_Executioner_StandingLoop"] remoteExec ["playMove", 0];
    [terrorist3, "Acts_CivilIdle_1"] remoteExec ["playMove", 0];   

    sleep 25 + (random 15);
    [terrorist1, "Acts_C_in1_briefing"] remoteExec ["playMove", 0];
    sleep 25+ (random 15);
     hostage attachTo [terrorist2,[-0.5,1,0]];
     hostage setdir 90;
    [terrorist2, "Acts_Executioner_Squat"] remoteExec ["playMove", 0];
    [terrorist2, "Acts_Executioner_Squat_End"] remoteExec ["switchMove", 0];
    hostage attachTo [terrorist2,[-0.5,1,0]];
    hostage setdir 90;
    [terrorist1, "Acts_Kore_Introducing"] remoteExec ["playMove", 0];
    sleep 25 + (random 15);
    hostage attachTo [terrorist2,[-0.5,1,0]];
    hostage setdir 90;
    [hostage, "Acts_ExecutionVictim_Forehand"] remoteExec ["playmove", 0];
    [terrorist2, "Acts_Executioner_Backhand"] remoteExec ["switchMove", 0];
    hostage attachTo [terrorist2,[-0.5,1,0]];
    hostage setdir 90;
    [terrorist1, "Acts_starterPistol_loop"] remoteExec ["playMove", 0];
    sleep 30 + (random 15);
 };
 
[] execVM "scripts\geisel1.sqf";
[hostage, true] call ACE_captives_fnc_setHandcuffed;
 };

this will create the scene, where the hostage is slapped from time to time and on tango get on its knees to talk to the hostage from time to time.

animations can be found under "cutscenes"  (ESC -> Animations -> ...)

 

create the trigger on the position inside the room, where you want the entering team to be when the hostage should be shot by the terrorists.:

trigger height should not be -1 (instead use 2m, so one could trigger it from the floor or air above!)
name it entrytrigger

activate by BLUFOR   (or the side, you need)
Trigger-init:
if (isServer) then {BREACH = true;   nul = [] execVM "scripts\hostage1.sqf";   nul = [] execVM "scripts\hostage2.sqf";};

 

create the hostage1.sqf:   (hostage is shot)

if (isServer) then {
while {damage terrorist1 == 0 and damage terrorist2 == 0 and damage terrorist3 == 0} do
    {
    hostage setcaptive false;
    hostage forceSpeed 0;
    terrorist1 forceSpeed -1;
    terrorist2 forceSpeed -1;
    terrorist3 forceSpeed -1;
    terrorist1 enableAI "FSM";
    terrorist2 enableAI "FSM";
    terrorist3 enableAI "FSM";
    terrorist1 setBehaviour "COMBAT";
    terrorist2 setBehaviour "COMBAT";
    terrorist3 setBehaviour "COMBAT";

    terrorist1 reveal hostage;
/*
terrorist1 doWatch hostage;          
terrorist1 doTarget hostage;
*/
    [terrorist1, "Acts_Executioner_Kill"] remoteExec ["switchMove", 0];
    [hostage, "Acts_ExecutionVictim_Kill"] remoteExec ["switchMove", 0];
    [hostage, "Acts_ExecutionVictim_Kill_End"] remoteExec ["playMove", 0];
    
    detach hostage;
    terrorist2 setBehaviour "Combat";     
    terrorist2 reveal hostage;
    terrorist2 doWatch hostage;
    terrorist2 doTarget hostage;
    terrorist1 doFire hostage;
    };
    
};

create hostage2.sqf:  (terrorists attacking entryy-team)
 

if (isServer) then {
while {damage terrorist2 == 0 and damage terrorist3 == 0} do
    {
    NearestEnemy2 = terrorist2 findNearestEnemy entrytrigger;
    NearestEnemy3 = terrorist3 findNearestEnemy entrytrigger;
    
    terrorist2 setBehaviour "Combat";      
    terrorist2 reveal NearestEnemy2;
    terrorist2 doWatch NearestEnemy2;          
    terrorist2 doFire NearestEnemy2;  
    terrorist3 forceSpeed -1;
        
    terrorist3 reveal NearestEnemy3;
    terrorist3 doWatch NearestEnemy3;          
    terrorist3 doTarget NearestEnemy3;
    terrorist3 doFire NearestEnemy3;
    terrorist3 enableAI "FSM";
    terrorist3 setBehaviour "Combat";
    terrorist2 forceSpeed -1;
    terrorist2 enableAI "FSM";
    };
    detach hostage;
};

 

  • Like 2

Share this post


Link to post
Share on other sites

This looks awesome.

 

Would you mind uploading a mission with the above example on Tanoa?

 

I cant wait to try it.

 

Will this work without ACE?

 

Humbly,
Reed

Share this post


Link to post
Share on other sites

Uh,

We´ve got some more mods running,
I´ll try to port it to Tanoa without the mods, but I don´t know how to set a hostage captive and transportable without ACE.
("hostage setcaptive true" is just to make them neutral and not be shot by any AI-unit.)

Maybe someone else could involve here and help you with the hostage -without-ACE-stuff ?
But please give me some time to rebuild the mission, my time is actually very spare...

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

×