Jump to content

GalacticTwinkles

Member
  • Content Count

    10
  • Joined

  • Last visited

  • Medals

Posts posted by GalacticTwinkles


  1. Both your hostage and this function are not jip compatible if I am not missing anything. You should make sure the action also appears for JIP players.

    Not too familiar with making functions JIP compatible, sadly. I mostly just make scripts for my missions so I haven't looked into it. Wouldn't know where to start, really. :/


  2.  

    Nice and easy. Thanks

     

    Here an example how to get it working using scripted units:

     

    hostage.sqf:

    fnc_release = {
    
    // Set AI Hostage Script
    // By Galactic Twinkles
    // Define Captive
    _captive = _this select 0;
    // Select random animation
    _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05","Acts_ExecutionVictim_Loop"];
    
    // Set Captive Settings
    _captive setCaptive true;
    // Remove Items
    removeAllWeapons _captive;
    removeBackpack _captive;
    removeVest _captive;
    removeAllAssignedItems _captive;
    _captive switchMove _anim; // SwitchMove to random animation
    // Set unit as hurt if it's the Execution animation
    if (_anim == "Acts_ExecutionVictim_Loop") then {
        _captive setDamage .5;
    };
    _captive disableAI "MOVE"; // Disable AI Movement
    _captive disableAI "AUTOTARGET"; // Disable AI Autotarget
    _captive disableAI "ANIM"; // Disable AI Behavioural Scripts
    _captive allowFleeing 0; // Disable AI Fleeing
    _captive setBehaviour "Careless"; // Set Behaviour to Careless because, you know, ARMA AI.
    
    // Add Hold Action to Free Hostage
    [
    /* 0 object */                        _captive,
    /* 1 action title */                "Free Hostage",
    /* 2 idle icon */                "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa",
    /* 3 progress icon */                "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa",
    /* 4 condition to show */            "true",
    /* 5 condition for action */            "true",
    /* 6 code executed on start */            {},
    /* 7 code executed per tick */            {},
    /* 8 code executed on completion */          {
                                    if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then {
                                    _this select 0 playMove "Acts_ExecutionVictim_Unbow";
                                } else {
                                    _this select 0 switchMove "Acts_AidlPsitMstpSsurWnonDnon_out";
                                };
                                _complMessage = selectRandom ["I thought I was gonna die in here!","Thank you so much man.","I think I shit my pants...","Can I hug you?","I'M ALIVE.","Where the hell am I?"];
                                ["Hostage", _complMessage] remoteExec ["BIS_fnc_showSubtitle"];
                                sleep 5.5;
                                (_this select 0) enableAI "MOVE";
                                (_this select 0) enableAI "AUTOTARGET";
                                (_this select 0) enableAI "ANIM";
                                (_this select 0) setBehaviour "SAFE";
                                [(_this select 0)] joinSilent player;
                                [(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove"];
    
                            },
    /* 9 code executed on interruption */       {
                            _intrMessage = selectRandom ["Hey! I don't wanna die here!","Don't leave me here man! Please!","THEY'RE EATING PEOPLE. GET ME OUT OF HERE.","*Mumbles* Shit shit shit..."];
                            ["Hostage", _intrMessage] remoteExec ["BIS_fnc_showSubtitle"];
                            },
    /* 10 arguments */                [_anim],
    /* 11 action duration */            3,
    /* 12 priority */                0,
    /* 13 remove on completion */            true,
    /* 14 show unconscious */            false
    ] remoteExec ["bis_fnc_holdActionAdd"];
    
    };
    //init.sqf
    [] call compile preprocessFileLineNumbers "hostage.sqf";
    
    
    //some script
    _hostageGroup = [getMarkerPos "hpos", CIVILIAN,
     
    [
    	"C_man_p_shorts_1_F",
    	"C_man_p_beggar_F",
    	"C_Man_casual_4_F",
    	"C_man_sport_2_F",
    	"C_journalist_F",
    	"C_Driver_3_F"
    ]
    ,[],[],[],[],[],180] call BIS_fnc_spawnGroup;
    
    {[_x] spawn fnc_release} forEach (units _hostageGroup);
    

    Awesome! I don't script in units much, but I'm sure this will be helpful to others who do!

     

    ...And if I ever need it in the future. :D


  3. When the action is completed the intel is spawned in your briefing or intel tab (can't remember what it was called) but the laptop is not deleted.

     

    A diary record would cause an entry to show up under the briefing section, but only for the player that "recovers" the intel. You could put this for the on completion code:

    {(_this select 1) createDiaryRecord ["Diary", ["Title of Entry", "Details of entry here."]]}
    

    I copied and pasted your code and put that in and it worked for me. There's lots of formatting options for createDiaryRecord as well. You can put images in even.

     

    Hope this is what you're looking for!


  4. Neat example.

     

    You could easily replace the switch and _number = floor random lines with this:

    _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05"];
    _captive switchMove _anim;

    and remove the sleep 0.001, since it's absolutely not necessary to have a sleep in here, this function can be called without any performance impact.

     

    Cheers

    Ah! SelectRandom! I could not think of or find that command for the life of me at the time, so I just went with a switch. I'll update it now.

     

    Thanks!

    • Like 2

  5. Hey guys!

     
    First script I've ever put up on the forums, but as far as I know no one has posted a hostage script using the new HoldAction function. I needed it for a mission and figured it may be helpful to some!
     
    I'm not sure if it works in MP yet, 2 AM so I haven't gotten to test.Tested and working in MP! For me anyway. Any bugs or blatant mis-coding, let me know!
     
    Features:

    • Random hostage animation.
    • AI joins player group after release.
    • Uses Arma 3 Hostage Icons.
    • Multiplayer Compatible (JIP should work too)
    • Random interruption and completion dialogue from hostage.
    • Nothing too fancy! Just simple.

    INSTRUCTIONS/CODE:

    Just put the following in the init box of the unit you want to be a hostage:

    null = [this] execVM "hostageScript.sqf";
    

    And either create an SQF and copy and paste the below code or put the downloaded SQF in your mission folder.

     

    SCRIPT:

    // Set AI Hostage Script 
    // By Galactic Twinkles
    // Define Captive
    _captive = _this select 0;
    // Select random animation
    _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05","Acts_ExecutionVictim_Loop"];
    
    // Set Captive Settings
    _captive setCaptive true;
    // Remove Items
    removeAllWeapons _captive;
    removeBackpack _captive;
    removeVest _captive;
    removeAllAssignedItems _captive;
    _captive switchMove _anim; // SwitchMove to random animation
    // Set unit as hurt if it's the Execution animation
    if (_anim == "Acts_ExecutionVictim_Loop") then {
    	_captive setDamage .5;
    };
    _captive disableAI "MOVE"; // Disable AI Movement
    _captive disableAI "AUTOTARGET"; // Disable AI Autotarget
    _captive disableAI "ANIM"; // Disable AI Behavioural Scripts
    _captive allowFleeing 0; // Disable AI Fleeing
    _captive setBehaviour "Careless"; // Set Behaviour to Careless because, you know, ARMA AI.
    
    // Add Hold Action to Free Hostage
    [
    /* 0 object */				        _captive,
    /* 1 action title */				"Free Hostage",
    /* 2 idle icon */				"\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa",
    /* 3 progress icon */				"\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa",
    /* 4 condition to show */			"true",
    /* 5 condition for action */			"true",
    /* 6 code executed on start */			{},
    /* 7 code executed per tick */			{},
    /* 8 code executed on completion */      	{
    						        if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then {
    								_this select 0 playMove "Acts_ExecutionVictim_Unbow";
    							} else {
    								_this select 0 switchMove "Acts_AidlPsitMstpSsurWnonDnon_out";
    							};
    							_complMessage = selectRandom ["I thought I was gonna die in here!","Thank you so much man.","I think I shit my pants...","Can I hug you?","I'M ALIVE.","Where the hell am I?"];
    							["Hostage", _complMessage] remoteExec ["BIS_fnc_showSubtitle"];
    							sleep 5.5;
    							(_this select 0) enableAI "MOVE";
    							(_this select 0) enableAI "AUTOTARGET";
    							(_this select 0) enableAI "ANIM";
    							(_this select 0) setBehaviour "SAFE";
    							[(_this select 0)] joinSilent player;
    							[(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove",[0,-2] select isDedicated,true];
    
    						},
    /* 9 code executed on interruption */       {
    						_intrMessage = selectRandom ["Hey! I don't wanna die here!","Don't leave me here man! Please!","THEY'RE EATING PEOPLE. GET ME OUT OF HERE.","*Mumbles* Shit shit shit..."];
    						["Hostage", _intrMessage] remoteExec ["BIS_fnc_showSubtitle"];
    					    },
    /* 10 arguments */			    [_anim],
    /* 11 action duration */		    3,
    /* 12 priority */			    0,
    /* 13 remove on completion */		    true,
    /* 14 show unconscious */		    false
    ] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true];

     

    For use on units spawned via script, see @davidoss's wonderful example right here.

     

    Changelogs:

    Ver. 0.1:

    • Added execution loop animation.
    • Set unit as hurt if using execution loop animation.
    • Added random interruption dialogue from the hostage.
    • Added random completion dialogue from the hostage.
    • Updated a few settings to make functionality work in MP, as far as I can tell it's all good.

     

    Ver. 0.0:

    Created.

    For those who just want a download link:

    DOWNLOAD HERE

    (Google Drive)

    • Like 11
    • Thanks 2

  6.  

    Yeah, seems to be the case.  You can replace it with code and run a function to make the pic, but even than it seems to need to be PAA format.

     

    This works fine:

    /* 2 idle icon */						"sounds\symbol.paa",
    

     

    Thanks for figuring this out...it had me stumped for a while.

     

    What size graphics are you using for your icons? Mine all seem to show up way too big.

     

    Thanks in advance!

×