Jump to content
Sign in to follow this  
Bon

AI Recruitment

Recommended Posts

My Team razor for this quick grab and go are.

//Code: //Team Razor special forces Generic soldiers
//--http://community.bistudio.com/wiki/ArmA_2:_Infantry
bon_recruit_recruitableunits = [

"FR_AC", 				 			//	FAC Operator
"FR_AR", 				 			//	Heavy Gunner
"FR_Assault_GL",				 	//	Assault Grenadier
"FR_Assault_R",						//	Assault Rifleman
"FR_Commander",						//	Commander
"FR_Corpsman",						//  Corpsman
"FR_GL",							//  Grenadier
"FR_Light",							//  Force Recon Unarmed	
"FR_Marksman",						//  Marksman
"FR_R",								//  Saboteur
"FR_Sapper",						//  Demolitions Specialist
"FR_TL"							// 	Team Leader

];
//---------

Share this post


Link to post
Share on other sites

ACE USMC

//Code: //ACE  USMC
//--http://browser.dev-heaven.net/cfg_vehicles/classlist?=ACE+with+ACEX%3A+1.9+RC3&version=47&commit=Change&options[group_by]=faction&options[sort_by]=name&options[faction]=USMC&options[vehicleclass]=Men
bon_recruit_recruitableunits = [

"ACE_USMC_Soldier_TAR", 				 			//	Automatic Rifleman
"USMC_Soldier", 				 			//		Rifleman
"USMC_Soldier2",				 	//		Rifleman M1014
"USMC_Soldier_AA",						//	AA Specialist
"USMC_Soldier_AR",						//		Automatic Rifleman
"USMC_Soldier_AT",						//  	AT Specialist SMAW
"USMC_Soldier_GL",							//  Grenadier
"USMC_Soldier_HAT",							//  	AT Specialist Javelin
"USMC_Soldier_LAT",						//  	Rifleman M136
"USMC_Soldier_Medic",								//  Corpsman
"USMC_Soldier_MG",						//  Machinegunner
"USMC_SoldierS",							// 	Scout
"USMC_Soldier_TL",							// 		Fire Team Leader
"USMC_SoldierM_Marksman",							// 	Designated Marksman
"USMC_Soldier_SL",							// 		Squad Leader
"USMC_Soldier_Officer",							// 	Officer
"USMC_SoldierS_Spotter",							// 	Spotter
"USMC_SoldierS_SniperH",							// 	Sniper M107
"USMC_SoldierS_Sniper",							// 	Sniper	
"USMC_SoldierS_Engineer"							// 	Engineer	


];

---------- Post added at 02:08 ---------- Previous post was at 01:59 ----------

Bon

Can you put a dismiss option in?

In case you don't want them or want a different team?

Just a thought

Scratch that It is on the F2 (or what ever solder), option 6 and look for dismiss.

Sorry found it while looking to change loadouts.

Edited by Styxx42
Dismiss already there.

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 == 

.... 

R.Flagg

I used this code to help spawn vehicles with this script, I believe you can use it to help place a specific init into specific types and factions of units

if(side player == west) then {
	if(_unittype isKindOf "Man") then {
		[b]***place code here***[/b];
		};
	if(_unittype isKindOf "USMC_Soldier_Base") then {
		[b]***place code here***[/b];
		};
};

if(side player == east) then {
	if(_unittype isKindOf "Man") then {
		[b]***place code here***[/b];
		};
	if(_unittype isKindOf "RU_Soldier_Base") then {
		[b]***place code here***[/b];
		};
};

basically if you want all russian soldiers that are not spetz or MVD to have a certain init then use RU_Soldier_Base or if you want to split them up and have a different init for the AT or the AA variants then use RU_Soldier_AT or RU_Soldier_AA (respectively).

you can find the hierarchy here:

http://community.bistudio.com/wiki/ArmA2:_CfgVehicles

Share this post


Link to post
Share on other sites

Hello Bon. I got one question:

Code34 Has the bon_loadoutpresets in his mission folder. That mission is without ai, but i wanna modify it, if i am alone, so i can play with some pmc boys. I totally understand how to change units and stuff , but:

i have two of your folders now. bon_loadoutpresets & bon_recruit_units

each one includes dialog with a common.hpp (the same for both) and recruitmen.hpp and presets.hpp .. when i got it right, i'm not allowed to put 2 common.hpp into the description.sqf . How can i combine these two things (presets and recruit_units) ?

Do i have to put em into one folder? I assume when i launch the common.hpp in the description via #include "bon_loadoutpresets\dialog\Common.hpp" , only the preset is working and not the recruitment.

I tried that, i placed a barracks , named it brk , like in the example i put

player addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance brk < 5"];

in the teamleader's init (cause when i play alone, only that one single leader should be able to recruit. But it is not working.

I did not try on ded server, just hosted, all i have is a debug frame with ai settings and stuff on the left..

could you plz help me to figure out the prob??

For repro just get this mission and un-pbo it maybe you can get it working : http://www.armaholic.com/page.php?id=13275

i wanted to use the following unit list :

PMC (+ 2 from BAF, because they look/dress like PMC)

bon_recruit_recruitableunits = [

"CIV_Contractor1_BAF",
"CIV_Contractor2_BAF",
"Soldier_AA_PMC",
"Soldier_AT_PMC",
"Soldier_Bodyguard_AA12_PMC",
"Soldier_Bodyguard_M4_PMC",
"Soldier_Crew_PMC",
"Soldier_Engineer_PMC",
"Soldier_GL_M16A2_PMC",
"Soldier_GL_PMC",
"Soldier_M4A3_PMC",
"Soldier_Medic_PMC",
"Soldier_MG_PKM_PMC",
"Soldier_MG_PMC",
"Soldier_Pilot_PMC",
"Soldier_PMC",
"Soldier_Sniper_KSVK_PMC",
"Soldier_Sniper_PMC",
"Soldier_TL_PMC"

]

Infantry classnames

http://community.bistudio.com/wiki/ArmA_2_OA:_Infantry#PMC_.28DLC.29

Edited by Fruity_Rudy

Share this post


Link to post
Share on other sites

Only use one of my common.hpp scripts. They should be identical (what is the problem: you include them both you'll get an error message saying something like "Member already defined" when you try to load the mission).

Just make sure you include it on the very top of the other .hpp files in the description.ext:

#include "one of the two common.hpp"

#include "either the recruit or loadout .hpp"

#include "the last one"

Share this post


Link to post
Share on other sites
Only use one of my common.hpp scripts. They should be identical (what is the problem: you include them both you'll get an error message saying something like "Member already defined" when you try to load the mission).

Just make sure you include it on the very top of the other .hpp files in the description.ext:

#include "one of the two common.hpp"

#include "either the recruit or loadout .hpp"

#include "the last one"

I did that. I also placed a barracks, named it "brk" like in the example and i only put this command line in the player's init

player addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance brk < 5"];

I didn't use any trigger like the other guy did. Cause in one of your posts you said this code in the player's init is enough. Am i missing something? i only tried hosting it, not on ded server yet

cheers

Share this post


Link to post
Share on other sites
R.Flagg

I used this code to help spawn vehicles with this script, I believe you can use it to help place a specific init into specific types and factions of units

....

Thank you for the tips fro. I've been messing with other stuff since I posted that, but I'll be trying again soon.

I appreciate your help.

Share this post


Link to post
Share on other sites
I also placed a barracks, named it "brk" like in the example and i only put this command line in the player's init

player addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance brk < 5"];

player needs some time to initialize before it actually points to the player unit. Before that it points to the null object. Code in the init line is executed right after you hit the start button, and most of the time too early for using the player variable.

So what probably happens with you right now is:

- game starts, player variable still not initialized, points to null object

- init line executed, addaction to recruit units applied to null object, no effect.

- player gets initialized afterwards.

So replacing player by this would work.

BUT: you should be aware that adding an action to a unit using its init line still happens globally: in your way everyone could walk up to the team leader who is standing close to the brk and use the action on him.

My suggestion: You apply the action to EVERYONE and extend the condition for it a bit. You can still use the player variable and avoid editing each init line by waiting for player to point to the resp. player unit (which differs on each client machine of course) by using a trigger:

condition:

not isnull player

activation:

player addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance brk < 5 && leader player == player"];

Share this post


Link to post
Share on other sites

Uh, thx for your info but i think i reached a point where i have to stop, cause i totally get confused. I should focus on playing an let this job do advanced ppl ..

Share this post


Link to post
Share on other sites

Fruity Rudy,

If you do come back to this post I have some suggestions.

Suggestion 1:

For your common.hpp question from earlier, if you open up the file in either "bon_loadoutpresets/dialog" or "bon_recruit_units/dilog" you will find a message from Bon stating:

"Always replace my Common.hpp with the latest version, if no version specified, consider it as version 1.0. However, never include two Common.hpp at the same time in the Description.ext."

The versions are:

bon_recruit_units

v 1.092

bon_loadoutpresets

v 1.091

So to simply state it, you need to use the "bon_recruit_units" common.hpp file because it is the newest of the two files you have in your mission folder.

Suggestion #2

You have been using the following code in the init of your player:

player addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance brk < 5"];

Don't be offened but did you or did you not run around the barracks? It is fine if you didn't, I only ask because giving the player only a 5 meter radius to satisfy the condition is kind of small. I ran into a simmilar problem with this when I first started out. Try changing from < 5 to < 20 and see what that does.

Also, as a side note, you can change the "player addAction" part of your code to "this addAction" and only the unit with the code will be able to run the action. If that makes sense, then GREAT! If not, then don't worry about it and forget it.

Haha, also an fyi this is what my code looks like in my unit's init:

this addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance barracks_1 < 20"];

Suggestion #3

If you are going to do any editing you will find out that you do alot of testing. One way of testing if this script will even work (as in you have everything lined up and ready to go except how you want to call the script) is, create a trigger and move it so the activation radius is just outside of your player. Group your player to the trigger and then put these variables into the trigger:

axis a: 50
axis b: 50
angle : 0
Activation: Group Leader (the trigger must be grouped to the player (or unit you want to use) before you can choose this)
Repeatedly should be selected
Present should be selected
don't worry about any time settings
Condition: this
On Act: usbrkrecruit = player addAction ["Recruit Barrack Units", "bon_recruit_units\open_dialog.sqf"];
On Dea: player removeAction usbrkrecruit;

Now hit preview and once you're in the game, move toward the trigger (if you set it close you wont have to move far) once you are in the trigger it should give you an action to "Recruit Barrack Units." Select it and see that your units are in the list. Exit the list and move away from the trigger, and you should see that the action disappears.

This should prove to you that the script will work and that something is wrong with how you are calling the script (if anything is wrong, just remember to up the distance). Please keep us posted.

Share this post


Link to post
Share on other sites

In addition to that .... take a look at this. I think this is what Bon was referring to;

https://sites.google.com/site/rflaggtoc/wip-missions/trigger_recruits.Desert_E.7z?attredirects=0&d=1

Like Fro mentioned, I left the distance <5, so you'll have to actually enter the barracks and move to center. Could have made it larger number.

(I don't use ACE, so I couldn't add it to your requested mission, but this might set you on right path)

Share this post


Link to post
Share on other sites

Ok i looked over this post and have to write new and short:

recruiting works now, but when i die and respawn it's not working anymore..so i assume i must add something to the code regarding palyer==isdead script plz work :)

and also ai is spawning on me, not on barracks..maybe somebody can explain how to create the marker for their spawnpoint..thats the only thing i need ..when i start out i can recruit..thx for your help guys..really nice to learn this

Edited by Fruity_Rudy

Share this post


Link to post
Share on other sites

what was the reason to add the action to the player unit in the first place?

Use the barrack's init line:

this addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance _target < 5 && leader player == player"];

and all your problems are solved.

Share this post


Link to post
Share on other sites

So i keep everything like it's now, the trigger and co. , i only put that one into the barracks init in editor and i can recruit again after i respawn?? sorry , for you all this stuff sounds very simple, i have to learn first ;)

Share this post


Link to post
Share on other sites
So i keep everything like it's now, the trigger and co. , i only put that one into the barracks init in editor and i can recruit again after i respawn?? sorry , for you all this stuff sounds very simple, i have to learn first.

I believe the answer should be yes, you should keep everything the same, for the most part.

You will only need the following line to appear once:

this addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance _target < 5 && leader player == player"];

So if you were using a trigger, like I do, you will not need it if you put the code into the init if the barracks that you named brk. (notice in the line provided by bon, and that I also quoted here, will require you to change _target to the name of your barracks which, if I remember right, you named brk)

If you do decide to put it in the init of the barracks, then you should be able to recruit units from the barracks as long as the barracks is not destroyed. I don't believe you should have to worry about that unless there is a chance that the enemy will come near your base. Some times they like to shoot rockets at certain objects within a base. So basically if there is a slight chance that the enemy may be near your base then also put the following line into the init of the barracks:

this allowDamage false;

It basically makes the barracks invincible.

One last thing, by putting this code in the init of the barracks, you will have to "look" at the barracks in order to have the action appear, just like when you come up to a ladder and want to climb up or down it.

Don't let all this get you down. It takes time to be able to figure all this out. I am still learning alot.

Share this post


Link to post
Share on other sites

so i did that..i only have your quoted line now in the barracks init, changed _target to _brk ..i can recruit all fine..but i hit escape and respawn..then its not working anymore and the ai is spawning on me not on the barracks

Edit: the problem with the ai spawning on me is not important. The only thing i need is the ability to recruit again after i died. So somehow i have to tell the script via init or whatever , when my player unit dies, the script should start or should be initialized again. Like unitkilled=exec recruit_units ?? i know it's wrong, just guessing the direction of code entry

Edited by Fruity_Rudy

Share this post


Link to post
Share on other sites

Use the barrack's init line:

this addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf",[],-1,false,true,"","player distance _target < 5 && leader player == player"];

and all your problems are solved.

That's what I said. There's nothing about changing anything. Just this line into the barrack's init. Remove all triggers and all addaction thingies in any units init line you may have added before. Then just do what's above. Nothing else.

Share this post


Link to post
Share on other sites
finally it is working. did it another way but its fine..thx for all your help

You should share what you did here so that others may benefit as well if they have same problem as you.

Share this post


Link to post
Share on other sites

Ah sorry, i totally forgot to say that because it's finally working and i thought i am the only one who is not getting it :)

In the tiny FOB in this mission is not that much space so i removed barracks and took a flagpole instead, much smaller and put that line into its init:

this addAction [""Recruit Units"",""bon_recruit_units\open_dialog.sqf""];

Share this post


Link to post
Share on other sites
Ah sorry, i totally forgot to say that because it's finally working and i thought i am the only one who is not getting it :)

you will never be the only one that is not getting something, and if you are, then someone who doesnt get it, will come up sometime, somewhere :)

Tnx for posting back.

Share this post


Link to post
Share on other sites
Ah sorry, i totally forgot to say that because it's finally working and i thought i am the only one who is not getting it :)

In the tiny FOB in this mission is not that much space so i removed barracks and took a flagpole instead, much smaller and put that line into its init:

this addAction [""Recruit Units"",""bon_recruit_units\open_dialog.sqf""];

this is the full init of that flagpole, but i guess you only need the line above:

this addAction ["Recruit Units","bon_recruit_units\open_dialog.sqf"];this addAction ["Change View Distance And Grass Settings", "gfx_change.sqf"];this addeventhandler ["hit", {_this select 0 setdamage 0}];  this addeventhandler ["dammaged", {_this select 0 setdamage 0}];

Edited by Fruity_Rudy

Share this post


Link to post
Share on other sites

can someone tell me if "AI Recruitment" is available anywhere in an "addon" (pbo) format?

Please Advise.

Thanx

Share this post


Link to post
Share on other sites

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

// description.ext file

#include "bon_recruit_units\dialog\common.hpp"

#include "bon_recruit_units\dialog\recruitment.hpp"

OnLoadMission="Made by MilitantSausage [AAF]";

OnLoadIntroTime=FALSE;

OnLoadMissionTime=TRUE;

disabledAI=TRUE;

ShowGPS=1;

showCompass=1;

showWatch=1;

showMap=1;

showNotePad=1;

briefing=1;

debriefing=1;

class Header

{

gameType=Objective;

minPlayers=2;

maxPlayers=35;

};

respawn=3;

respawnDelay=45;

respawnDialog=1;

#include "scripts\IEDdetect\IEDdetect_dialog.h"

class CfgSounds

{

#include "scripts\IEDdetect\IEDdetect_sounds.cpp"

};

class RscTitles

{

#include "scripts\IEDdetect\IEDdetect_screens.cpp"

};

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

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  

×