Jump to content
LSValmont

Aliens into Agents Project

Recommended Posts

I am working on turning @maxjoiner xenomorphs into agents so they can be faster, deadlier and also use up to 3 times less system resources!

 

Later Max will be able to use this Agent Ai for his other mods such as the crocodile, the predator etc.

 

@maxjoiner What I need to know is the name of the alien animations for:

- Walking

- Jogging

- Running

- Attacking

- Any other relevant animation state.

  • Like 1

Share this post


Link to post
Share on other sites

Worthy project.  Getting the official list from max would be ideal, but maybe you can run a loop monitoring animationState and record the unique animation names encountered in an array and output to log.

  • Like 1

Share this post


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

Worthy project.  Getting the official list from max would be ideal, but maybe you can run a loop monitoring animationState and record the unique animation names encountered in an array and output to log.

 

Yeah but I am lazy 😃

 

  • Like 1
  • Haha 2

Share this post


Link to post
Share on other sites

Alright I was not lazy and figured the animations myself (Making @johnnyboy and @GEORGE FLOROS GR proud!)

 

Beta version 1 of Xeno Agents is up: DEMO MISSION LINK: https://drive.google.com/file/d/1_x1j5HSJBHNOLMiwJPioKNkl_uVcAN5-/view?usp=sharing

 

REQUIREMENT of the MAX_ALIENS mod of course: https://steamcommunity.com/workshop/filedetails/?id=1450865805

 

You will notice that these agent aliens behave more like in the movies:

 

- They are faster and deadlier but die from a few shots. (Just like in the movies so no more slow and bullet sponge aliens!)

- They attack in packs and circle around their preys avoiding being easy targets.

- They can only attack if they can see their preys (scent tracking for future versions)

- Their movement patterns are more erratic (again making them harder targets)

- They can outrun anything and will predict the future location of targets that are in the move so they intercept better!

- They can make Ai units run away in fear when they see the aliens charging. 

- They can make ai units drop their weapons/equipment when attacked.

- They won't attack vehicles but that can be easily added in the future if Max likes the implementation.

- The agent aliens don't need a virtual target attached so they use even less resources than my vDogs. (You can now have 60 agent aliens and they will consume what 20 regular unit aliens consume in terms of system resources)

- The agent aliens don't use group slots like regular aliens do so that frees up group slots for the mission maker to have more regular units.

- They are missing sounds since I had to use the "player aliens" because the default Ai Aliens in the mod have a FSM/Script preventing them from working correctly as agents.

- Probably @maxjoiner can add a version of the aliens without that FSM/Script so that they can work as agents and have sounds.

- I do also plan on adding a small health regen to the xenos after they eat a fresh dead corpse!

 

PS: This first version features "Feral Xenomorphs", basically territorial xenos who will guard a location fearlessly. I plan on doing some Hunter xenos next, who will basically track down players first by scent (delayed) but once they get visual contact they charge!

 

Note: This is by no means a fully fledged script and more a sort of proof of concept for @maxjoiner so that optimized and deadly agent aliens can replace the resource consuming regular unit aliens in future versions of his mod.

 

Anyways, enjoy the first beta!

  • Like 2

Share this post


Link to post
Share on other sites

Also, I need to do some brainstorming with the creative minds here.

 

How could we make the xenos able to scale walls?

 

I was thinking some sort of urban rappelling inversed.  Detecting a wall in front of the alien with linesInterctWith and then do a sort of urban rappelling that starts from the ground instead of the ceiling of a wall/building and makes the alien go up.

 

If anyone has any idea I am all ears 😉 

  • Like 1

Share this post


Link to post
Share on other sites

This all sounds awesome bruddah.  JBOY_Dog has scent tracking where units to be tracked leave a scent trail, and dogs follow it.  Feel free to steal any code there.  I can point you at the exact scripts.

 

And for scaling, I have tree climbing scripts for human AI that might be a good start.   It plays climbing animation on unit, and uses setVelocityTransformation within a missionEventHandler to move the unit up or down until reaches destination.  Is there a good Alien animation for climbing?

 

Climb up:

Spoiler

// JBOY_climbUp.sqf
/*
 _treeProxy = _dude getVariable "nearTreeProxy";
 _tree = _treeProxy getVariable "tree";
 _pallet = _treeProxy getVariable "pallet";
 _d = [player,_pallet,_tree] execvm "JBOY\JBOY_climbUp.sqf";
 */
if (!isServer)  exitwith {};
params["_dude","_pallet","_tree"];
//systemchat format ["%1",_this];
_dude setVariable ["hasClimbAction","",true]; // 
_treeProxy = (missionNameSpace getVariable "jboySniperTreeProxies") select ((missionNameSpace getVariable "jboySniperTrees") find _tree);
_treeProxy setVariable["climber",_dude,true];
sleep 1;
_dude enableCollisionWith _tree;
_dude enableCollisionWith _tree;

_ropeBottomObj = _treeProxy getVariable "ropeBottomObj";
_pos = ([_ropeBottomObj, 1.5, ([_ropeBottomObj,_tree] call BIS_fnc_dirTo)+30] call BIS_fnc_relPos);
_pos = [_pos select 0, _pos select 1, 0];
_dude setpos _pos;

//_dude switchMove (selectRandom ["ladderciviluploop","ladderrifleuploop"]);
[_dude, (selectRandom ["ladderciviluploop","ladderrifleuploop"])] remoteExec ["switchMove", 0];

_dude setdir (([_ropeBottomObj, _tree] call BIS_fnc_dirTo));

_pos1 = getPosASL _dude;
_pos2 = _pos1 vectorAdd [0,0,0.75];
_dude setVariable ["jboyTreeProxy", _treeProxy, true];
_dude setVariable ["jboyClimbPos1", _pos1, true];
_dude setVariable ["jboyClimbPos2", _pos2, true];
_dude setVariable ["jboyClimbVectorDir", vectorDir _dude, true];
_dude addEventHandler ["AnimDone", 
{
    _dude = _this select 0;
    _pos2 = _dude getVariable "jboyClimbPos2";
	_pos1 = _pos2; 
	_pos2 = _pos2 vectorAdd [0,0,0.75];
    _dude setVariable ["jboyClimbPos1", _pos1, true];
    _dude setVariable ["jboyClimbPos2", _pos2, true];
}];
_dude setVariable ["jboyDismountObj", _pallet, true];

fnc_jboyAddMissionEventHandler = {
    params ["_args","_fnc"];
    private _thisEventHandler = addMissionEventHandler [
        'EachFrame',
        format [
            '_thisEventHandler call %1',
            _fnc
        ]
    ];
    missionNamespace setVariable ["ncb_gv_ehIdArgs_" + (_thisEventHandler toFixed 0),_args];
    _thisEventHandler
};

fnc_jboyClimbUpEH = {
    // the var is an array that is passed immediately to params
    missionNamespace getVariable ("ncb_gv_ehIdArgs_" + (_thisEventHandler toFixed 0)) params ["_dude","_pallet"];
    _vectorDir =  _dude getVariable "jboyClimbVectorDir";
	if (!alive _dude) then 
	{
		_dude switchMove "";
        detach _dude;
		_dude removeAllEventHandlers "AnimDone";
        removeMissionEventHandler ["EachFrame",_this];
	};
	_treeProxy = _dude getVariable "jboyTreeProxy";
	_pallet = _treeProxy getVariable "pallet";
	_climbHeight = getposatl _pallet select 2; // 23.5
    if (( getposatl _dude select 2)< _climbHeight) then
    {
        _pos1 = _dude getVariable "jboyClimbPos1";
        _pos2 = _dude getVariable "jboyClimbPos2";
        
        //_tree = _treeProxy getVariable "tree";

        _dude setVelocityTransformation 
        [
            _pos1, 
            _pos2, 
            [0,0,5], // current velocity
            [0,0,5], // next velocity
            _vectorDir, //[0,1,0], 
            _vectorDir, //[0,1,0], 
            [0,0,1], 
            [0,0,1],
            moveTime _dude
        ];
    } else
    {
        _dude removeAllEventHandlers "AnimDone";
        removeMissionEventHandler ["EachFrame",_this];
        missionNamespace setVariable ["ncb_gv_ehIdArgs_" + (_thisEventHandler toFixed 0),nil];
        _dude switchMove "";
        _man = (nearestObjects [_pallet, ["Man"], 5]) select 0; 
        _man enableCollisionWith _dude;
        _dude setpos [getpos _pallet select 0, getpos _pallet select 1, (getpos _pallet select 2) +.1];
        _dude attachTo [_pallet,[0,.2,.1]];
		_dude forceSpeed 0;
        detach _dude;
        _d = [_dude] execvm "JBOY\JBOY_climbDownAddAction.sqf";
        _d = [_dude] execvm "JBOY\JBOY_ropeDownAddAction.sqf";
		[_dude,selectRandom ["Ready","Waiting"]] call JBOY_Speak;
     };
};
_id = [[_dude,_pallet],"fnc_jboyClimbUpEH"] call fnc_jboyAddMissionEventHandler;

 

Climb Down:

Spoiler

// JBOY_climbDown.sqf
/*
 _d = [_dude,_tree] execvm "JBOY\JBOY_climbDown.sqf";
 */
if (!isServer)  exitwith {};
params["_dude","_tree"];
_objToClimb = _tree;
_treeProxy = (missionNameSpace getVariable "jboySniperTreeProxies") select ((missionNameSpace getVariable "jboySniperTrees") find _tree);
_treeProxy setVariable["climber",_dude,true];
_pallet = _treeProxy getVariable "pallet";
sleep 1;
_dude enableCollisionWith _objToClimb;
_dude enableCollisionWith _tree;

_ropeTopObj = _treeProxy getVariable "ropeTopObj";
_ropeBottomObj = _treeProxy getVariable "ropeBottomObj";
_pos = ([_ropeTopObj, 1.5, ([_ropeTopObj,_objToClimb] call BIS_fnc_dirTo)+30] call BIS_fnc_relPos);
_pos = [_pos select 0, _pos select 1, (_pos select 2) -2];
_dude setposatl _pos;

//_dude switchMove (selectRandom ["laddercivildownloop","ladderrifledownloop"]);
[_dude, selectRandom ["laddercivildownloop","ladderrifledownloop"]] remoteExec ["switchMove", 0];

_dude setdir (([_ropeTopObj, _objToClimb] call BIS_fnc_dirTo)+25);
//_dude setdir (([_pos, _objToClimb] call BIS_fnc_dirTo))-30;

_pos1 = getPosASL _dude;
_pos2 = _pos1 vectorAdd [0,0,-0.75];
_dude setVariable ["jboyTreeProxy", _treeProxy, true];
_dude setVariable ["jboyClimbPos1", _pos1, true];
_dude setVariable ["jboyClimbPos2", _pos2, true];
_dude setVariable ["jboyClimbVectorDir", vectorDir _dude, true];
_dude addEventHandler ["AnimDone", 
{
    _dude = _this select 0;
    _pos2 = _dude getVariable "jboyClimbPos2";
	_pos1 = _pos2; 
	_pos2 = _pos2 vectorAdd [0,0,-0.75];
    if (( getposatl _dude select 2)<6) then
    {
	   _pos2 = _pos2 vectorAdd [0,.1,0]; 
    };
    _dude setVariable ["jboyClimbPos1", _pos1, true];
    _dude setVariable ["jboyClimbPos2", _pos2, true];
}];
_dude setVariable ["jboyDismountObj", _pallet, true];

// Function to call a Mission Event handler that calls a function.  Arguments are passed to the function
// by adding them to a MissionNameSpace variable whose name is a string plus the EH ID.
fnc_jboyAddMissionEventHandler = {
    params ["_args","_fnc"];
    private _thisEventHandler = addMissionEventHandler [
        'EachFrame',
        format [
            '_thisEventHandler call %1',
            _fnc
        ]
    ];
    missionNamespace setVariable ["ncb_gv_ehIdArgs_" + (_thisEventHandler toFixed 0),_args];
    _thisEventHandler
};

fnc_jboyClimbDownEH = {
    // the var is an array that is passed immediately to params
    missionNamespace getVariable ("ncb_gv_ehIdArgs_" + (_thisEventHandler toFixed 0)) params ["_dude","_pallet","_tree","_ropeBottomObj"];
   // hint format ["_dudette=%1,%2",_dude,time];
    _vectorDir =  _dude getVariable "jboyClimbVectorDir";
    _vectorDir =  _dude getVariable "jboyClimbVectorDir";
 
	if (!alive _dude) then 
	{
		_dude switchMove "";
        detach _dude;
		_dude removeAllEventHandlers "AnimDone";
        removeMissionEventHandler ["EachFrame",_this];
        missionNamespace setVariable ["ncb_gv_ehIdArgs_" + (_thisEventHandler toFixed 0),nil];
	};
    if (( getposatl _dude select 2)> .5) then
    {
        _pos1 = _dude getVariable "jboyClimbPos1";
        _pos2 = _dude getVariable "jboyClimbPos2";
        _dude setVelocityTransformation 
        [
            _pos1, 
            _pos2, 
            [0,0,5], // current velocity
            [0,0,5], // next velocity
            _vectorDir, //[0,1,0], 
            _vectorDir, //[0,1,0], 
            [0,0,1], 
            [0,0,1],
            moveTime _dude
        ];
    } else
    {
       diag_log (format["at bottom %1",_dude]);
        _dude removeAllEventHandlers "AnimDone";
        removeMissionEventHandler ["EachFrame",_this];
        missionNamespace setVariable ["ncb_gv_ehIdArgs_" + str _this,nil];
        _dude switchMove "Heli_Attack_01Gunner_AmovPercMstpSlowWrflDnon";
        _dude switchMove "";
        _dude forceSpeed -1;
        _dude moveTo getpos _dude;
     };
};

_id = [[_dude,_pallet,_tree,_ropeBottomObj],"fnc_jboyClimbDownEH"] call fnc_jboyAddMissionEventHandler;

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I just published the scripts for climbing up and down here.  There's a video so you can see how it looks.  I think you want to do something similar for the alien, but maybe just the walking animation and use setVectorDirAndUp so he's walking vertically up a wall.

  • Thanks 1

Share this post


Link to post
Share on other sites
20 hours ago, johnnyboy said:

I just published the scripts for climbing up and down here.  There's a video so you can see how it looks.  I think you want to do something similar for the alien, but maybe just the walking animation and use setVectorDirAndUp so he's walking vertically up a wall.

 

Thank you @johnnyboy! A got the permission from @maxjoiner to do the agent aliens just recently and if they perform better than his current iteration he will released them in the next version.

 

I have no experience using setVectorDirAndUp or AttachTo since I've avoided those for MP but right now I will take anything so that we can have movie like Aliens!

 

Please lend a hand as much as you can!

  • Like 2

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

×