Jump to content

Recommended Posts

UUCLkhM.jpg

 

Download:

MIL_SleepingAI - Dropbox/Armaholic

Demo SP Mission - Dropbox

 

Description:

Uses beds and other user-defined objects to have AI start a mission sleeping on them.
AI can then be left asleep or woken up on command.

 

Features:

- SP/MP

- Predefined support for:

    - Vanilla sleeping bags.

    - Vanilla sleeping mats.

    - Vanilla shooting mats.

    - LoW stretchers.

    - The vanilla bed.

- Ability to define other objects as beds.

 

To use:

- Copy the folder MIL_sleepingAI to your mission folder.

- Place a sleeping bag, mat, bed or other custom object into the mission.

- Position a unit near their required bed. They must be within 5m of the object to work.

- Run this command where the unit is local before the mission starts (e.g. initServer.sqf if created on the server, or init.sqf for SP):

nul = [_units,_otherBeds] execVM "MIL_SleepingAI\initSleepingAI.sqf";

_units - array - list of objects to start asleep.
_otherBeds - array (embedded) - optional. Default - [].
                              - list of other object classnames ,their [x,y,z] offsets and direction adjustments (solution to units laying perpendicular to objects).
                              - offset and angle adjustment MUST be defined, and should be tested and adjusted for best positioning of AI.

Examples:

nul = [units group1] execVM "MIL_SleepingAI\initSleepingAI.sqf";
_otherBeds = [
	["Land_Stretcher_01_F",[0,0,0],0],      //AI will be at 0 degrees to object's "north axis"
	["Land_WoodenTable_large_F",[0,0,0],90] //AI will be at 90 degrees to object's "north axis"
];
nul = [units group1,_otherBeds] execVM "MIL_SleepingAI\initSleepingAI.sqf";

 

- To wake the AI up, run this command:

nul = [_unit,_pos,_enableMoving] spawn MIL_fnc_WakeUp;

_unit - object - name given to the sleeping unit.
_pos - string - stance that the unit is to be in, example:
              - "Up", "Middle", "Down", "NotProne" (uses either "Up" or "Middle"), "Auto" (normally the default AI setting).
              - optional. Default - "Auto"
_enableMoving - boolean - allow AI to move from bed once woken up.
                        - optional. Default - false.
                        - NOTE - to get AI moving at a later stage, use:
                               - _unit enableAI "PATH"

Examples:

nul = [unit1] spawn MIL_fnc_WakeUp; //setUnitPos "Auto" is used.
{nul = [_x,"NotProne"] spawn MIL_fnc_WakeUp;} forEach (units group1);
nul = [unit2,"Auto",true] spawn MIL_fnc_WakeUp;

 

Media:

Demo (38s):

 

 

If anyone finds any problems please let me know.

 

Thank you.

 

Change log:

Spoiler

v2.1:

Added - Option to set rotation of AI on an object to account for the possibility that an object's "north point" would mean that the AI would end up sleeping perpendicular to (across) the object (Updated "To Use" and "Examples" in OP).

Added - Shooting mats and LoW stretchers to predefined bedding (Updated "Features" in OP).

 

v2:

Re-release.

 

Edited by beno_83au
Update v2.1
  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Ahhh yes, this is an older one from back while i was still learning the different aspects of arma scripting. As coincidence would have it though, i went to use this about a week ago in a new mission and revamped the whole thing, including proper MP compatability (i don't think i understood locality enough back then). 

 

I'm at work right now but I'll look at sorting a fresh download out tonight if i don't get home too late. 

  • Like 1

Share this post


Link to post
Share on other sites

Update.

 

v2:

Rebuild of the original function.

Please see OP for info.

  • Like 2

Share this post


Link to post
Share on other sites

OI, WAKE UP! BOOM, YOU'RE DEAD. :rofl:

  • Like 1
  • Haha 2

Share this post


Link to post
Share on other sites

A quick update/request. It seems (obvious now, I guess) that some objects will cause an AI to orientate themselves perpendicular to a custom (user selected) object. No doubt this is due to the object's N/S/E/W orientation not being intuitive. So if anyone comes across any of these objects before I update it, can you please let me know what object? Mainly for curiosity's sake.

Share this post


Link to post
Share on other sites

Update.

 

v2.1:

Added - Option to set rotation of AI on an object to account for the possibility that an object's "north point" would mean that the AI would end up sleeping perpendicular to (across) the object (Updated "To Use" and "Examples" in OP).

Added - Shooting mats and LoW stretchers to predefined bedding (Updated "Features" in OP).

  • Like 1

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

×