Jump to content

Recommended Posts

Thanks for that Variable, looks exactly the same implementation.  

 

Well its still by far the best system around at the moment.  So will keep testing and a few more play sessions...

 

Silly that we still have to rely on talented community members to make these scripts, even after BI's "attempt" at a revive system, which is shocking.

  • Like 1

Share this post


Link to post
Share on other sites

So, I've got a custom mission, and everything with the AI works perfectly in SP, however, I have a "recruit AI" system built in and this script doesn't apply to the newly recruited units in within the mission. It works on pre-placed units though.
 
Here's a sample of a script for recruiting a medic:

 

_exit = false;
if (!isFormationLeader player) then {
    systemChat "OFFICER: Only team leader can recruit AI for your team.";
    _exit = true;
};
if (_exit) exitWith {};

vActiveRecruitsAI = 0;
{ if (!isPlayer _x) then { vActiveRecruitsAI = vActiveRecruitsAI + 1; } } forEach units group player;

if (!(vActiveRecruitsAI < vMaxRecruitsAI)) then {
    systemChat format [ "OFFICER: You can only recruit %1 AI soldiers.", vMaxRecruitsAI ];
    _exit = true;
};

if (_exit) exitWith {};

_spawnpos = [ (getMarkerPos "recruit_west" select 0), (getMarkerPos "recruit_west" select 1), 1 ];
_unit = group player createUnit ["B_T_medic_F", _spawnpos, [], 1, "PRIVATE"];
_unit setPosATL _spawnpos;
_unit setSkill 1;

vActiveRecruitsAI = vActiveRecruitsAI + 1;
publicVariable "vActiveRecruitsAI";
 
This is one for a rifleman:
 
_exit = false;
if (!isFormationLeader player) then {
    systemChat "OFFICER: Only team leader can recruit AI for your team.";
    _exit = true;
};
if (_exit) exitWith {};

vActiveRecruitsAI = 0;
{ if (!isPlayer _x) then { vActiveRecruitsAI = vActiveRecruitsAI + 1; } } forEach units group player;

if (!(vActiveRecruitsAI < vMaxRecruitsAI)) then {
    systemChat format [ "OFFICER: You can only recruit %1 AI soldiers.", vMaxRecruitsAI ];
    _exit = true;
};

if (_exit) exitWith {};

_spawnpos = [ (getMarkerPos "recruit_west" select 0), (getMarkerPos "recruit_west" select 1), 1 ];
_unit = group player createUnit ["B_T_Soldier_F", _spawnpos, [], 1, "PRIVATE"];
_unit setPosATL _spawnpos;
_unit setSkill 1;

vActiveRecruitsAI = vActiveRecruitsAI + 1;
publicVariable "vActiveRecruitsAI";
 
What could I add so that the revive and healing scripts work for these newly recruited units?

Share this post


Link to post
Share on other sites


_spawnpos = [ (getMarkerPos "recruit_west" select 0), (getMarkerPos "recruit_west" select 1), 1 ];

_unit = group player createUnit ["B_T_Soldier_F", _spawnpos, [], 1, "PRIVATE"];

_unit setPosATL _spawnpos;

_unit setSkill 1;

[_unit] call compile preprocessFileLineNumbers (TCB_AIS_PATH+"init_ais.sqf");

vActiveRecruitsAI = vActiveRecruitsAI + 1;

publicVariable "vActiveRecruitsAI";

Share this post


Link to post
Share on other sites

Hi folks,

             I just found this script as I was looking for something along like ACE 3 but more SP friendly. While this is working great for me, I am unable to switch units among playable units. Is there a way to allow this while having this script active? 

            I understand that in the readme that it states that switch unit will not work, hence it is disabled but any chance someone found a way to rectify?

Share this post


Link to post
Share on other sites

Thanks for this awsome revive system.

One problem i'm facing is that i'm trying to get it to work with Spyder Addon Recruit module.

There is a code box where i can type what to execute upon recruiting a unit (i can refer to it as _this) so i type down:
 

[_this] call compile preprocessFileLineNumbers (TCB_AIS_PATH+"init_ais.sqf");

It works if i host it through MP but it doesn't work if i host the mission with TADST.

From the logs i see this error:
 

Error in expression <ais_exit";
if (isDedicated && {isPlayer _unit}) exitWith {};				
if (!isDedicate>
  Error position: <_unit}) exitWith {};				
if (!isDedicate>
  Error Undefined variable in expression: _unit
File mpmissions\__cur_mp.Stratis\ais_injury\init_ais.sqf, line 3
Error in expression <(tcb_ais_bloodParticle) then {
execFSM (TCB_AIS_PATH+"fsm\pulse.fsm");
};

if (i>
  Error position: <TCB_AIS_PATH+"fsm\pulse.fsm");
};

if (i>
  Error Undefined variable in expression: tcb_ais_path
File mpmissions\__cur_mp.Stratis\ais_injury\init_ais.sqf, line 141
Error in expression <c_handleDamage2}];
};

[_unit] execFSM (TCB_AIS_PATH+"fsm\ais.fsm");


if (tcb_a>
  Error position: <TCB_AIS_PATH+"fsm\ais.fsm");


if (tcb_a>
  Error Undefined variable in expression: tcb_ais_path
File mpmissions\__cur_mp.Stratis\ais_injury\init_ais.sqf, line 137

Any advice?

Share this post


Link to post
Share on other sites
"One problem i'm facing is that i'm trying to get it to work with Spyder Addon Recruit module."

 

 

I have already faced that.

The problem is that the code init from ai are executed at the moment where  the ai unit is still  owned by server.

The workaround is:

 

 

fn_add_codeLine.sqf

// init from Spyder module : _this spawn INS_fnc_add_codeLine;
params ["_unit", "_unitsP", "_unitsLeader", "_clientID"];

waitUntil {alive _unit && count (units (group _unit)) > 1};

_unitsP = units (group _unit);

if (!isPlayer (leader _unit)) then {

	_unitsLeader = [];
	
	{	
		if (isPlayer _x) then {
				
			_unitsLeader pushback _x;
			
		};
	} forEach _unitsP;
	
	[(group _unit),(_unitsLeader select 0)] remoteExec ["selectLeader", (_unitsLeader select 0), false];

};
sleep 3;
_clientID = owner (leader _unit);
(group _unit) setGroupOwner _clientID;
_unit remoteExec ["INS_fnc_handle_AIS", _clientID, false];

fn_handle_AIS.sqf

params ["_unit"];

[_unit] joinSilent grpNull;
[_unit] joinSilent (group player);
[_unit] call compile preprocessFileLineNumbers (TCB_AIS_PATH+"init_ais.sqf");

Share this post


Link to post
Share on other sites

Davidoss do you mind guiding me a bit because i seem lost?

 

I do create those 2 .sqf files.

 

Do i have to put them on the root directory of my mission? Maybe inside another folder?

 

For now i have created them and left them in the root directory of the mission, i placed the call (_this call fnc_add_codeLine) inside the Spyder module but i'm getting an error.

Thanks for your time.

Share this post


Link to post
Share on other sites

Woow you need to make it as functions. Check this Adding a Function

Anyway there are many ways to create functions for mission.

 

Traditional way is to use description.ext and define CfgFunctions

.

In that case your functions will be visible in functions browser,

 

or you can just compile into any variable using compileFinal or use

 [] call compile preprocessFileLineNumbers "file.sqf" 

to load it into memory.

 

Which method  is for you more familiar?

 

The first file  should be compiled  server side only, the second could be just global.

Share this post


Link to post
Share on other sites

Davidoss i'm sorry i don't get it. Still getting error.

 

Here is what i did:

 

1) Placed both fnc_add_codeLine.sqf, fnc_handle_AIS.sqf in root directory of my mission.

 

2) My description.ext looks like this:
 

class CfgFunctions {
	#include "ais_injury\cfgFunctionsAIS.hpp"
	
	class myTag
	{
		class myCategory
		{
			class fnc_add_codeLine {};
		};
	};
	
	class myTag2
	{
		class myCategory2
		{
			class fnc_handle_AIS {};
		};
	};
};

3) In the module code box i added 

_this call fnc_add_codeLine

I also tried to alter the names of the .sqf files like "fn_xxx" and place just "xxx" in CfgFunctions class and other tries i can't remember.

 

I know i do something wrong but i don't know much. That's what i understood from the links you gave me.

Share this post


Link to post
Share on other sites

Obviously there are no correct patch to file.
 
For example i will show you my setup of cfgFunctions
 
those files are in

functions\ai_recruitment\fn_add_codeLine.sqf
functions\ai_recruitment\fn_handle_AIS.sqf


description.ext

class CfgFunctions	{
	
	class INS  {
						
		class ai_recruitment  {
		
			class add_codeLine {
				preInit = 0;
				postInit = 0;
				preStart = 0;
				recompile = 0;
				ext = ".sqf";
				headerType = -1;
			};

			class handle_AIS {
				preInit = 0;
				postInit = 0;
				preStart = 0;
				recompile = 0;
				ext = ".sqf";
				headerType = -1;
			};
		};
		
	};
	
	#include "ais_injury\cfgFunctionsAIS.hpp"
};

In that case your functions are knowed as

 

INS_fnc_handle_AIS

INS_fnc_add_codeLine

 

and in spyder module the function should be spawned not called ( need to be run in scheduled environment because of use waituntil and sleep there.)

_this spawn INS_fnc_add_codeLine;

Share this post


Link to post
Share on other sites

Thanks Davidoss!

This seems to do the trick.

Even though i'm getting this error 

Script command setOwner cannot be used for object 'B_soldier_exp_F'. Use setGroupOwner instead.

It runs both in MP and while i host it with TADST.

Thanks again for spending some time in this request.

Share this post


Link to post
Share on other sites

Woow everything grows old.

 

Try change the line

_unit setOwner _clientID;

to

(group _unit) setGroupOwner _clientID;

This whole owner setup is created, to make sure the code initialize AIS are executed in correct moment, after unit locality change.

I write that while testing  because of huge VM load i got desync and sometimes the code was initialized correctly and sometimes not.

This part gives the certainty for that.

Share this post


Link to post
Share on other sites

Yea i noticed there is like 1-2 seconds delay till it takes effect (change ownership) while looking at the RPT monitor.

 

Edit: I changed the above line and now the error is fixed.

Share this post


Link to post
Share on other sites

Is there a post Apex version yet, not able to move or aim when wounded anymore............

Share this post


Link to post
Share on other sites

Had recognized the problem by myself 30 minutes ago...

Will have a eye on it.

 

btw: i had start a complete rewrite. But stay maybe at 20% of all work to do.

 

 

 

regards

  • Like 5

Share this post


Link to post
Share on other sites

Sorry,the wounding system isn´t working since Apex? If you can still heal yourself after getting shot, the movement bug can be worked around so to speak,yes?

Share this post


Link to post
Share on other sites

Thanks Davidoss!

This seems to do the trick.

Even though i'm getting this error 

Script command setOwner cannot be used for object 'B_soldier_exp_F'. Use setGroupOwner instead.

It runs both in MP and while i host it with TADST.

Thanks again for spending some time in this request.

Hello there mates First of all thanks a lot Psycho for this amazing mod! i just cant get to use another since i came across this one.

Im having the same problem you had dax, i tried following davidos guide to add the functions my description.ext looks like this now

respawn = 3;

respawndelay = 10;

disabledAI=0;

joinUnassigned = 0;

enableDebugConsole = 1;

allowFunctionsLog = 1;

author = "Lokerian";

//--------------------------------------------------------------

//------------------------AIS INJURY----------------------------

//--------------------------------------------------------------

class RscTitles {

#include "ais_injury\dialogs\rscTitlesAIS.hpp"

};

class CfgFunctions {

class INS {

class ai_recruitment {

class add_codeLine {

preInit = 0;

postInit = 0;

preStart = 0;

recompile = 0;

ext = ".sqf";

headerType = -1;

};

class handle_AIS {

preInit = 0;

postInit = 0;

preStart = 0;

recompile = 0;

ext = ".sqf";

headerType = -1;

};

};

};

#include "ais_injury\cfgFunctionsAIS.hpp"

};

 

and i have created the two files davidos posted the fnc_add_codeLine.sqf & fnc_handle_AIS.sqf .

I placed in this directory - C:\Users\lorim\Documents\Arma 3 - Other Profiles\Lokerian\mpmissions\Operation%20Sahrani.Sara\ais_injury\func\functions\ai_recruitment

 

and finally i added the code - _this spawn INS_fnc_add_codeLine; to spidy's code box in the recruiter.

I have been at this for over 2 days and im honestly out of ideas or reasons why i could not make it work. my int file also looks like this

//by psycho

["%1 --- Executing TcB AIS init.sqf",diag_ticktime] call BIS_fnc_logFormat;

enableSaving [false,false];

enableTeamswitch false; // TcB AIS wont support teamswitch

// TcB AIS Wounding System --------------------------------------------------------------------------

if (!isDedicated) then {

TCB_AIS_PATH = "ais_injury\";

[] spawn {

{[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach (if (isMultiplayer) then {playableUnits} else {switchableUnits}); // execute for every playable unit

//{[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach (units group player); // only own group - you cant help strange group members

//{[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach [p1,p2,p3,p4,p5]; // only some defined units

};

};

// --------------------------------------------------------------------------------------------------------------

 

Please if anyone could guide me to make the script work ona dedicated server i will be most grateful 

Share this post


Link to post
Share on other sites

Had recognized the problem by myself 30 minutes ago...

Will have a eye on it.

 

btw: i had start a complete rewrite. But stay maybe at 20% of all work to do.

 

 

 

regards

 

Hi Re the not moving problem;

 

I found if you set the Rambo factor higher you can sometimes move & fire, but not always. eg;

 

As in "tcb_ais_rambofactor             =     2;                 // A higher value means more damage tolerance. Set to 2 for double damage tolerance. Set to 0.5 for half etc. 1 equates to Vanilla."

 

So could it not be something to do with Apex changing the default "Vanilla damage tolerance" can it be set higher than 2 without causing problems?

Share this post


Link to post
Share on other sites

Hello there mates First of all thanks a lot Psycho for this amazing mod! i just cant get to use another since i came across this one.

Im having the same problem you had dax, i tried following davidos guide to add the functions my description.ext looks like this now

respawn = 3;

respawndelay = 10;

disabledAI=0;

joinUnassigned = 0;

enableDebugConsole = 1;

allowFunctionsLog = 1;

author = "Lokerian";

//--------------------------------------------------------------

//------------------------AIS INJURY----------------------------

//--------------------------------------------------------------

class RscTitles {

#include "ais_injury\dialogs\rscTitlesAIS.hpp"

};

class CfgFunctions {

class INS {

class ai_recruitment {

class add_codeLine {

preInit = 0;

postInit = 0;

preStart = 0;

recompile = 0;

ext = ".sqf";

headerType = -1;

};

class handle_AIS {

preInit = 0;

postInit = 0;

preStart = 0;

recompile = 0;

ext = ".sqf";

headerType = -1;

};

};

};

#include "ais_injury\cfgFunctionsAIS.hpp"

};

 

and i have created the two files davidos posted the fnc_add_codeLine.sqf & fnc_handle_AIS.sqf .

I placed in this directory - C:\Users\lorim\Documents\Arma 3 - Other Profiles\Lokerian\mpmissions\Operation%20Sahrani.Sara\ais_injury\func\functions\ai_recruitment

 

and finally i added the code - _this spawn INS_fnc_add_codeLine; to spidy's code box in the recruiter.

I have been at this for over 2 days and im honestly out of ideas or reasons why i could not make it work. my int file also looks like this

//by psycho

["%1 --- Executing TcB AIS init.sqf",diag_ticktime] call BIS_fnc_logFormat;

enableSaving [false,false];

enableTeamswitch false; // TcB AIS wont support teamswitch

// TcB AIS Wounding System --------------------------------------------------------------------------

if (!isDedicated) then {

TCB_AIS_PATH = "ais_injury\";

[] spawn {

{[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach (if (isMultiplayer) then {playableUnits} else {switchableUnits}); // execute for every playable unit

//{[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach (units group player); // only own group - you cant help strange group members

//{[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach [p1,p2,p3,p4,p5]; // only some defined units

};

};

// --------------------------------------------------------------------------------------------------------------

 

Please if anyone could guide me to make the script work ona dedicated server i will be most grateful 

 

We run the  Psycho revive in most of our missions on a Dedicated server which work fine, even Post Apex (apart from the not moving bug)

 

We have found its easier to have a separate sqf  called initrevive.sqf

 

with just; the following in it;

 

//by psycho

["%1 --- Executing TcB AIS init.sqf",diag_ticktime] call BIS_fnc_logFormat;

enableSaving [false,false];

enableTeamswitch false;

// TcB AIS Wounding System --------------------------------------------------------------------------

if (!isDedicated) then {

    TCB_AIS_PATH = "ais_injury\";

    {[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach (if (isMultiplayer) then {playableUnits} else {switchableUnits});        // execute for every playable unit

    

    //{[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach (units group player);                                                    // only own group - you cant help strange group members

    

    //{[_x] call compile preprocessFile (TCB_AIS_PATH+"init_ais.sqf")} forEach [p1,p2,p3,p4,p5];                                                        // only some defined units

};

 

 

Then in the main init.sqf, simply put  the line        execVM "initRevive.sqf";        It seems to prevents any conflicts with any other CfgFunctions etc that might be in the mission, which does sometimes happen in some missions, "keep it simple" always the best.

 

You must also of course have in the     Description.exe      the usual;       (As well as the ais_injury folder & contents, in the mission folder, obviously! edit the ais_setup in there to whatever you want)

 

//--------------------------------------------------------------

//------------------------AIS INJURY----------------------------

//--------------------------------------------------------------

class RscTitles {

    #include "ais_injury\dialogs\rscTitlesAIS.hpp"

};

class CfgFunctions {

    #include "ais_injury\cfgFunctionsAIS.hpp"

};

//--------------------------------------------------------------

 

 

Psycho revive    Is not run on our dedicated server as a Mod/Addon, (don't know if that's what you are trying to do?)  it's just put in whatever mission the mission maker wants to use it for, as described above. It works for us :)

 

Hope this helps.

Share this post


Link to post
Share on other sites

...and i have created the two files davidos posted the fnc_add_codeLine.sqf & fnc_handle_AIS.sqf .

I placed in this directory - C:\Users\lorim\Documents\Arma 3 - Other Profiles\Lokerian\mpmissions\Operation%20Sahrani.Sara\ais_injury\func\functions\ai_recruitment

 

Wrong files path

 

For that cfgFunctions class it should be:

C:\Users\lorim\Documents\Arma 3 - Other Profiles\Lokerian\mpmissions\Operation%20Sahrani.Sara\functions\ai_recruitment

@Psychobastard

 

(IMHO)

Your A3 wounding system is the best revive/heal script ever made for arma3.

The basic difference is that only this gives something more that grass view or black screen after player get shot.

Very immerse and your work on this should definitely go on.

Thank you!

Share this post


Link to post
Share on other sites

...

So could it not be something to do with Apex changing the default "Vanilla damage tolerance" can it be set higher than 2 without causing problems?

 

The higher value maybe end up in non-natural damage tollerance. That mean you eat a bunch of projectiles before you go injured.

But you can try it out how it works and look for you by increasing this value.

 

 

regards

Share this post


Link to post
Share on other sites

OK I'll try increasing one number at a time see how it works out. Thanks for reply. :)

 

 

==========================

 

Later;

 

No thought it might be too good to be true,

Just setting it at 3 gave you a skin like a Rhinoceros, taking lots of hits but when you do eventually do go down still not able to move, in the 5 times I tried it, at least?. Setting it at 2 need to be the max for any sort of realisim.

So back to you Psycho, hope you can find a fix, being able to crawl behind cover or away from a burning vehicle when injured was a real bonus.

Share this post


Link to post
Share on other sites

Thank you both Davidos and Jgaz for trying to help me.

Though i should mention that even after putting the files in the right place they still have no effect, i get no errors in the missions but neither do they actually work, not in mp neither on Dedicated (im using spidyblack modules, and im recruiting with his module, if i run mp server i can easily make the ai come and heal me and all running the call command like in the int, on the code box of spidy but with the addcodeline file and the extra line im supposed to add into the code box nothing happens.)

If you got any more ideas im all ears, i really want to make this work its really the only thing from allowing me to complete the mission making. so any help is so much apreciated.


(jgaz) i tried using your code as well only that this time i placed the _this execVM "initRevive.sqf"; in the line code of spidyblack add on, worked in mp didnt work on dedicated. :/

Share this post


Link to post
Share on other sites

Sounds like a spidyblack add on conflict.......

 

Have you tried the mission without that addon, to confirm that it is, or it's not the problem?

 

WTF! is spidyblack add on,? I just googled that &  spidyblack modules & nothing at all came up?

 

Is it worth running?

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

×