Jump to content
Sign in to follow this  
Bon

AI Recruitment

Recommended Posts

I keep getting the error "Resource RecruitUnitsDailog not found", I have the recruitment and common .hpp files in my description, but I still get the error, the action is coming up ingame.

this is my description

I should mention that other scripts being run are Reezo's IED script and UPSMON

MS

Check this.

the bon_recruit_units\dialog\ is a folder structure that should also be in your missions folder.

Take the bon_recruit_units folder that comes with the download (in the desert mission BON created in the download) and paste the folder into your mission folder.

The error message is saying you are telling me to look inside the mission for a folder called #include "bon_recruit_units\dialog\common.hpp"

That is FOLDER\FOLDER\filename

If you already have that folder, verify that the spelling is EXACTLY the same as in your Description file.

Let us know how you make out. MS

Share this post


Link to post
Share on other sites

Yeah they are definetely right, I was thinking more that I had called the .hpp files wrong and was hopinbg someone could correct that.

Share this post


Link to post
Share on other sites

Have a minor issue.

Recruitable units appear & act just alright, the only problem is that classes like "Assistant MG" or "Assistant AT" appear without backpack,

so they are not any different than usual riflemen.

When I place the same vehicle classes in the editor for testing purposes ("US_Soldier_AAR_EP1", "US_Soldier_AAT_EP1", etc.) -

they appear fully with backpacks just fine.

Please advise if someone has encountered the same issue & the possible solution for that.

--

Aware of this post, which can provide a way of customizing the loadouts to a specific taste,

but I was wondering if the above mentioned behaviour is normal.

Share this post


Link to post
Share on other sites
Recruitable units appear & act just alright, the only problem is that classes like "Assistant MG" or "Assistant AT" appear without backpack,

so they are not any different than usual riflemen.

When I place the same vehicle classes in the editor for testing purposes ("US_Soldier_AAR_EP1", "US_Soldier_AAT_EP1", etc.) -

they appear fully with backpacks just fine.

So placing a unit in the editor there happens more than creating a unit, like using the respective "createUnit" script command.

This is very interesting.

And it sucks.

Share this post


Link to post
Share on other sites

Well, as the script itself is written very well - it's very easy to make a clean adjustment in init_newunit.sqf as suggested.

Mine looks like this:

//add backpacks to specific units
switch (true) do
{
case (_unit isKindOf "US_Soldier_AAR_EP1"): // Assistant MG (M249)
{
	removeBackpack _unit; // not needed most probably, but just in case
	_unit addBackpack "US_Assault_Pack_AmmoSAW_EP1";
};
...

Share this post


Link to post
Share on other sites
Cool. Thank you!

To go a step further, what I hope to do is maybe have specific lines for specific units? So I'm going to try to figure out correct syntax, maybe something like...

if (_unit == Soldier_GL_M16A2_PMC) then 
{
removeBackpack _unit;
      _unit addBackpack "CZ_Backpack_EP1";

.... 
};

if (_unit == 

.... 

Did you ever get this to work with any individual unit, as in to replace units with custom load-outs?

1nsider, is your script working?

Share this post


Link to post
Share on other sites
1nsider, is your script working?

With OA units - surely it does.

Though it's not much of my script, bon made all that - I've just tweaked a very small part based on recommendations in this topic.

Share this post


Link to post
Share on other sites

For a couple days, I have played with this when I could, but I cannot get it to work. Just to stick to basics, I have...

switch (true) do
{
case (_unit isKindOf "US_Delta_Force_Assault_EP1"):
{
	removeBackpack _unit;
	_unit addBackpack "US_Patrol_Pack_EP1";
};

Anyone want to jump in and help?

BTW, this works...

removeBackpack _unit;
_unit addBackpack "US_Patrol_Pack_EP1";
(unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",8];

but all units spawn with the same backpacks and items. (And, when I recruit an MG, I do not want a pack on him.)

Share this post


Link to post
Share on other sites

switch (true) do
{
case (_unit isKindOf "US_Delta_Force_Assault_EP1"):
{
	removeBackpack _unit;
	_unit addBackpack "US_Patrol_Pack_EP1";
};

You may have just forgotten the last closing curly bracket. In this case (or anyway), start your game with the additional startparameter -showscripterrors so that such syntax errors are displayed ingame.

Try it this way:

switch (typeof _unit) do
{
case "US_Delta_Force_Assault_EP1" :
{
	removeBackpack _unit;
	_unit addBackpack "US_Patrol_Pack_EP1";
};

case "US_Soldier_AAR_EP1" :
{
	removeBackpack _unit;
	_unit addBackpack "US_Assault_Pack_AmmoSAW_EP1";
};

       // and so on....
};

Share this post


Link to post
Share on other sites

Yeah, I have not had time to mess with Arma 2 lately, and forgot to 'turn on' script errors. I have not tried your example, but that will probably do the trick. (Also, I had just copied and pasted what 1nsider had posted and did not notice that, either.)

Thank you. (And I will try 'it' later.)

Share this post


Link to post
Share on other sites
(Also, I had just copied and pasted what 1nsider had posted and did not notice that, either.)

Sry, mate, I haven't thought about making the code look properly - just was trying to illustrate the idea.

By the way, those AI soldiers cannot use their backpacks, as you probably know.

So I've made one more trick with them.

Seems like game engine does not track the inventory slots available for AI guys and you can actually put a lot of stuff in 'em, even without a backpack.

So something, like that

...
 {_unit addMagazine "30Rnd_556x45_Stanag"} forEach [1,2,3,4,5,6,7,8,9,11,12];
 {_unit addMagazine "HandGrenade_West"} forEach [1,2,3,4,5,6];
...

would actually work (notice the amount of mags - it all gets added to the usual unit loadout & we're adding the stuff not into the backpack here, but to the main inventory).

But backpack helps to keep it realistic in a visual way + it's a very useful tool for other human players in game.

I've stocked AI specops guys backpacks with satchels for example, so whenever I take them on the mission with me -

I can be sure that I'll have explosives easily reachable. Also this kind of a 'bug' comes very useful when you try to use AI medics with ACE WOUNDS system.

Share this post


Link to post
Share on other sites

Yeah, 1nsider, I was not complaining, I just did not notice. Anyway, something like this works (for those who are looking, like I was)...

switch (typeof _unit) do
{
case "US_Delta_Force_TL_EP1":
{
	removeAllWeapons _unit;
	{_unit addMagazine "HandGrenade_West"} forEach [1];
	{_unit addMagazine "20Rnd_762x51_B_SCAR"} forEach [1,2,3,4,5,6,7,8,9,10,11];
	{_unit addMagazine "1Rnd_HE_M203"} forEach [1,2,3,4,5,6,7,8];

	_unit addWeapon "SCAR_H_STD_EGLM_Spect";

	removeBackpack _unit;
	_unit addBackpack "US_Patrol_Pack_EP1";
	(unitBackpack _unit) addMagazineCargo ["20Rnd_762x51_B_SCAR",4];
	(unitBackpack _unit) addMagazineCargo ["1Rnd_HE_M203",4];

	_unit addWeapon "NVGoggles";
	_unit addWeapon "Binocular_Vector";
};
};

Thanks, again. :) (EDIT: Yes, that 'bug' has been around a looong time.)

Edited by CyOp

Share this post


Link to post
Share on other sites

is there a way to dismiss all the AI you have recruited at once? deleteGroup perhaps?

_groupname = group player;

deleteGroup _groupname;
hint "Your AI has been dismissed";

I tried that via an addaction, but it dosnt work.

Share this post


Link to post
Share on other sites

They can join a null group

named units

[unitname,othername] joinSilent grpNull  

or for the whole group

 {[_x] joinsilent grpNull} foreach units player

player can also be the name of the group

Edited by F2k Sel

Share this post


Link to post
Share on other sites

You want to apply the "dismiss" on all recruits in means of deleting all AI units in your group, just do:

{
  if(not isPlayer _x) then {deleteVehicle _x};
} foreach units group player;

hint "Your AI has been dismissed";

Share this post


Link to post
Share on other sites

Is there a way to use this dialog to make already existing units join your group?

Like if you e.g. have 10 people at your disposal which are around in the base and you can select who you want to take with you for certain tasks.

Thanks for the info!

Share this post


Link to post
Share on other sites

Hi,

I've a little problem:

Here is my recruitableunits.sqf file...

bon_recruit_recruitableunits = [

"HEXA_Soldier_ISAF",

"HEXA_Soldier_ISAF_Grenadier",

"HEXA_Soldier_ISAF_Medic",

"HEXA_Soldier_ISAF_Laser",

"HEXA_Soldier_ISAF_Stinger",

"HEXA_Soldier_ISAF_ABL",

"HEXA_Soldier_ISAF_Minimi",

"HEXA_Soldier_ISAF_TeamLeader",

];

But there is nobody in the list in game, I can't recruit! :(

Can someone help me, :confused: ?

Share this post


Link to post
Share on other sites
bon_recruit_recruitableunits = [

"HEXA_Soldier_ISAF",

"HEXA_Soldier_ISAF_Grenadier",

"HEXA_Soldier_ISAF_Medic",

"HEXA_Soldier_ISAF_Laser",

"HEXA_Soldier_ISAF_Stinger",

"HEXA_Soldier_ISAF_ABL",

"HEXA_Soldier_ISAF_Minimi",

"HEXA_Soldier_ISAF_TeamLeader",

];

No comma after the last entry. Delete it and you should be fine.

Share this post


Link to post
Share on other sites

can this be modified so it gives you a maximum of 2 AI units even though there are 5 players already in the squad?

Share this post


Link to post
Share on other sites

init.sqf:

//by Bon_Inf*


BON_RECRUIT_PATH = "bon_recruit_units\";

bon_max_units_allowed = [color="Red"][b]10[/b][/color];


bon_recruit_queue = [];

if(isServer) then{
"bon_recruit_newunit" addPublicVariableEventHandler {
	_newunit = _this select 1;
	[_newunit] execFSM (BON_RECRUIT_PATH+"unit_lifecycle.fsm");
};
};
if(isDedicated) exitWith{};


// Client stuff...

Share this post


Link to post
Share on other sites

Is there a way I can edit the recruitable_units.sqf so a player that is in a Special Forces squad can recruit Special Forces AI for their squad and a USMC player can recruit USMC for their squad?

I under stand how to change the type of units recruited but can not figure out how to split the list up for different types of each unit.

As a second thought it there a way to run more then one of these scripts so each unit type has to go to a different location to recruit?

Share this post


Link to post
Share on other sites
Is there a way I can edit the recruitable_units.sqf so a player that is in a Special Forces squad can recruit Special Forces AI for their squad and a USMC player can recruit USMC for their squad?

Look at this piece of code, I'm sure it'll give you the idea.

//recruitable_units.sqf

_us_squadleader = "US_Soldier_SL_EP1";
_us_specforces = "US_Delta_Force_TL_EP1";


switch (typeOf player) do{
case _us_squadleader : {
	bon_recruit_recruitableunits = [
		"US_Soldier_AA_EP1",
		"US_Soldier_AAT_EP1",
		"US_Soldier_AHAT_EP1",
		"US_Soldier_AAR_EP1",
		"US_Soldier_AMG_EP1",
		"US_Soldier_AT_EP1",
		"US_Soldier_HAT_EP1",
		"US_Soldier_AR_EP1",
		"US_Soldier_Engineer_EP1",
		"US_Soldier_GL_EP1",
		"US_Soldier_MG_EP1",
		"US_Soldier_Marksman_EP1",
		"US_Soldier_Medic_EP1",
		"US_Soldier_EP1",
		"US_Soldier_LAT_EP1",
		"US_Soldier_B_EP1",
		"US_Soldier_SL_EP1"
	];
};

case _us_specforces : {
	bon_recruit_recruitableunits = [
		"US_Delta_Force_AR_EP1",
		"US_Delta_Force_Air_Controller_EP1",
		"US_Delta_Force_MG_EP1",
		"US_Delta_Force_Marksman_EP1",
		"US_Delta_Force_Medic_EP1",
		"US_Delta_Force_EP1",
		"US_Delta_Force_Assault_EP1",
		"US_Delta_Force_M14_EP1",
		"US_Delta_Force_Night_EP1",
		"US_Delta_Force_SD_EP1"
	];
};

default {bon_recruit_recruitableunits = []};
};

As a second thought it there a way to run more then one of these scripts so each unit type has to go to a different location to recruit?

You know that the access to the dialog is provided by an addAction command put into the init of an object. Check the corresponding BIKI article for the commands extended syntax, particularly for the condition parameter.

hf.

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
Sign in to follow this  

×