Forum Jump :

Author Message


Posts: 13
Rank:


Level: Member

Country: dk
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2013-09-19 23:37        
     
Making a mission where I need some equipment and I want it in a backpack carried by the player and his team. I know how to add the items to an editor made backpack. What I don't know is how to equip this backpack with items to the player.

So, how do I give my player a backpack that is not just empty?

Can anyone help with this?


Author Message


Posts: 29
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age: 42
In-game name:

 
#2 Posted at 2013-09-20 09:36        
     
You can't add things to what doesn't exist, right? ;)

this addbackpack "B_carryall_base"; this addmagazine "magazine type"; this additem "firstaidkit";

etc...

backpack first, then items. the way it unfolds: your player will fill slots in order. So uniform > vest > backpack. If I was doing a LRRP I'd get technical and put 5 medkits in the uniform, then fill the vest with mags, nades and smokes leaving whatever to the backpack. More mags, satchels, rockets, etc...


Advertisement


Author Message


Posts: 16
Rank:


Level: Member

Country: se
Location: Stockholm
Occupation:
Age:
In-game name:

 
#3 Posted at 2013-09-21 13:50        
     
I recently wanted to do something similar. I used the following method to make sure the items end up in the backback, without having to rely on it overflowing into the correct container. An added advantage that I think is neat is that it will not clutter the units' init fields.

Copy/paste this code into a notepad and save the file (in your mission folder) as "lrrp_pack.sqf":


Then, from the editor, put the following in the Init field of any unit(s) you wish to equip with the LRRP pack:
0 = this execVM "lrrp_pack.sqf"; (don't forget the semicolon!)

I have several similar sqf files in order to easily equip my rangers with different packs, e.g. Medic packs, explosives, support gunners...

Hope it helps!
-Anders

This post was edited by AndersMolin (2013-09-21 14:03, ago)

See you in the AO!

Author Message


Posts: 7
Rank:


Level: Member

Country: us
Location: Arkansas
Occupation: Industrial, Veteran
Age: 36
In-game name: hendo187

 
#4 Posted at 2013-09-24 12:12        
     
Andersmolin that is awesome just saved me so much time. Wow. Been looking for this for a minute. Thank you


Author Message


Posts: 19
Rank:


Level: Member

Country: hk
Location:
Occupation: kommiekat
Age: 58
In-game name:

 
#5 Posted at 2013-09-24 13:02        
     
Great script Andersmolin.

Could you kindly give a script for each unit?
Med, Explosives, Ranger, Support Gunners.

This could be a sticky one day.


Author Message


Posts: 16
Rank:


Level: Member

Country: se
Location: Stockholm
Occupation:
Age:
In-game name:

 
#6 Posted at 2013-09-25 20:57        
     
Okay, here are my various scripts. The basic idea is that every member of a ranger/SF patrol, regardless of role within the patrol (medic, machinegunner etc) would carry extra ammo, one or two claymores, some smoke grenades and chemlights, plus any equipment specific for their role. During the patrol, items will be redistributed according to need. (E.g., if someone has used up their frag grenades, they could re-arm by going into the autorifleman's backpack.)

These scripts use weapons and classnames from the Arma III v 1.0 release so everyone will be able to use them "as is". You should of course modify the scripts so the loadouts suit your taste. (NB: I add helmets to the backpack of every kit since my SF/ranger patrols usually wear soft caps at mission launch. If your units start the game with helmets on, just delete the row adding helmets.)

Basic SF pack ("sfpack.sqf")
// Call this script from any unit you wish to equip by putting the following string in their Init field: 
// 0 = this execVM "sfpack.sqf"; (don't forget the semicolon!)

removebackpack _this; //gets rid of the current backpack
_this addBackpack "B_carryall_base"; //Replace classname with your choice of backpack, obviously, if you wish
_backpack = unitBackpack _this; //creates a local variable for use in the rest of this script

_backpack addWeaponCargo ["Rangefinder",1];
_backpack addItemCargo ["H_HelmetSpecB_blk",1];

_backpack addmagazinecargo ["SmokeShellGreen", 4];
_backpack addmagazinecargo ["SmokeShellRed", 4];
_backpack addmagazinecargo ["SmokeShell", 2];
_backpack addMagazineCargo ["Chemlight_yellow", 10];
_backpack addMagazineCargo ["ClaymoreDirectionalMine_Remote_Mag", 1];
_backpack addMagazinecargo ["30Rnd_65x39_Caseless_mag", 10];

SF Medic pack ("sfMedicpack.sqf")
My medics carry extra green and yellow smoke to mark own position for extraction/casevac.
// Call this script from any unit you wish to equip by putting the following string in their Init field: 
// 0 = this execVM "sfMedicpack.sqf"; (don't forget the semicolon!)

removebackpack _this; //gets rid of the current backpack
_this addBackpack "B_carryall_base"; //Replace classname with your choice of backpack, obviously, if you wish
_backpack = unitBackpack _this; //creates a local variable for use in the rest of this script

_backpack addItemCargo ["H_HelmetSpecB_blk",1];
_backpack addItemCargo ["Medikit",1];
_backpack addItemCargo ["FirstAidKit",15];

_backpack addmagazinecargo ["SmokeShellGreen", 4];
_backpack addmagazinecargo ["SmokeShellYellow", 4];
_backpack addMagazineCargo ["Chemlight_yellow", 10];
_backpack addMagazineCargo ["ClaymoreDirectionalMine_Remote_Mag", 1];
_backpack addMagazinecargo ["30Rnd_65x39_Caseless_mag", 10];

SF Autorifleman pack ("sfARpack.sqf")
// Call this script from any unit you wish to equip by putting the following string in their Init field: 
// 0 = this execVM "sfARpack.sqf"; (don't forget the semicolon!)

removebackpack _this; //gets rid of the current backpack
_this addBackpack "B_carryall_base"; //Replace classname with your choice of backpack, obviously, if you wish
_backpack = unitBackpack _this; //creates a local variable for use in the rest of this script

_backpack addItemCargo ["H_HelmetSpecB_blk",1];
_backpack addmagazinecargo ["SmokeShell", 2];
_backpack addmagazinecargo ["HandGrenade", 12];
_backpack addmagazinecargo ["100Rnd_65x39_caseless_mag",6];

SF Explosives pack ("sfDemopack.sqf")
// Call this script from any unit you wish to equip by putting the following string in their Init field: 
// 0 = this execVM "sfDemopack.sqf"; (don't forget the semicolon!)

removebackpack _this; //gets rid of the current backpack
_this addBackpack "B_carryall_base"; //Replace classname with your choice of backpack, obviously, if you wish
_backpack = unitBackpack _this; //creates a local variable for use in the rest of this script

_backpack addItemCargo ["H_HelmetSpecB_blk",1];
_backpack addItemCargo ["ToolKit",1];
_backpack addItemCargo ["MineDetector",1];

_backpack addMagazinecargo ["30Rnd_65x39_Caseless_mag", 10];
_backpack addMagazineCargo ["ClaymoreDirectionalMine_Remote_Mag", 2];
_backpack addMagazineCargo ["SLAMDirectionalMine_Wire_Mag", 2];
_backpack addMagazineCargo ["DemoCharge_Remote_Mag", 2];
_backpack addMagazineCargo ["SatchelCharge_Remote_Mag", 2];

See you in the AO!

Author Message


Posts: 19
Rank:


Level: Member

Country: hk
Location:
Occupation: kommiekat
Age: 58
In-game name:

 
#7 Posted at 2013-09-26 11:45        
     
This is fantastic!
Great going, AndersMolin.

I'm going to "borrow" these for a campaign I shall upload to BIS and here and I promise to give
full credits you.

May I ask one last simple question I think you can handle:
How do I add to VEST?

For example:
_vest = unitBackpack _this; //creates a local variable for use in the rest of this script
_vest addItemCargo ["FirstAidKit",2];
_vest addmagazinecargo ["SmokeShellGreen", 2];

I'm using CIA_SAD MOD and his units already have backpacks and vest, that's why I left out the "removebackpack _this;"
Because I like what he has.
Here is the link for that mod:
http://www.armaholic.com/page.php?id=19598&highlight=CIA%2BSAD

You're help is so much appreciated!
Thanks
KK


Author Message


Posts: 16
Rank:


Level: Member

Country: se
Location: Stockholm
Occupation:
Age:
In-game name:

 
#8 Posted at 2013-09-26 17:23        
     
I'm glad to see you found my scripts useful! Feel free to copy, steal or use it in any way you like :)

Unfortunately, I haven't found any solution to the vest problem. In the backpack case, the command "unitBackpack this" returns the backpack worn by the soldier (the unit from which the .sqf file was called using the Init field). It seems there is no "unitVest this" command. There is a "Vest this" command, but it only returns the type of vest worn by the soldier, not the exact vest this individual is wearing. It's a subtle difference but very important.

I'll try to look into this during the weekend. If anyone finds a solution to this, please let me know! I want it for my missions too.

Added 3 hours 25 minutes later:

KK, I found a workaround to the vest issue. I have not found a good way of adding things to an existing vest, but if you want to customize the loadout your patrol starts the mission with, here is what you can do.

Create a file called "sfvest.sqf". In it, put the following code:
removeVest _this;
removeUniform _this;

_this addVest "V_TacVest_khk";  //use the classname of your preferred vest of course
_this addMagazines ["Chemlight_yellow", 1];
_this addMagazines ["30Rnd_65x39_Caseless_mag", 6];
_this addMagazines ["HandGrenade", 2];

_this addUniform "U_B_CombatUniform_mcam"; //change the classname to whatever uniform you prefer
_this addItem "FirstAidKit";

Please note that the order of the rows is important - by removing the uniform and the vest, and then adding a vest first, you ensure that the gear (in this case, a chemlight, six mags and two frags) is added to the vest since that is the only container available. Then the uniform gets added, and the first aid kit will end up there since ArmA tries to fill the uniform first, then gear goes into the vest, then the backpack.

For the same reason, the order in which you call the sqf scripts from the unit's Init field is also important. You should call the vest script first, otherwise the backpack gets added first and the gear meant for the vest might end up in the backpack. So, use this in the Init field:
0 = this execVM "sfvest.sqf"; 0 = this execVM "sfpack.sqf";

Sorry for the longwinded post, but I hope it clears things up!
-Anders

This post was edited by AndersMolin (2013-09-26 20:49, ago)

See you in the AO!

Author Message


Posts: 19
Rank:


Level: Member

Country: hk
Location:
Occupation: kommiekat
Age: 58
In-game name:

 
#9 Posted at 2013-09-27 18:30        
     
@AndersMolin

Thanks!!
I just realized that this VEST thing is a big issue for everybody.

Anyways, I hope FoxHound will make this a sticky because it deserves it!

Cheers,
KK

Added 20 hours 52 minutes later:

@AndersMolin,

One last question for you if I may? It's about the unit init box.

I have a 4 man team. 2 men will use your sfpack. One will use the sfDemo and the other will be sfMedic.

Now in the units init goes the:
0 = this execVM "sfpack.sqf";
for the leader and one other guy. They have the same.
Medic is:
0 = this execVM "sfMedicpack.sqf";
and Demo is:
0 = this execVM "sfDemopack.sqf";

So my question is the 0 that is used. This will not make the equipment same for all units?
In other words, should I name my Leader as say, "aP" then use this instead:
aP = this execVM "sfpack.sqf";

and the Medic as say, "med":
med = this execVM "sfMedicpack.sqf";


The reason why I as is because I am finding my leader with a MedKit in his backpack.
I can only think this is because of the 0 that all four units are using to call the script.

Sorry to bother you again.
KK


EDIT========================

Nevermind. Seems I got things working.

Your vest script is working like a charm.
As soon as I get this mission done, I'll PM you.
Thanks!!
KK

This post was edited by Kommiekat (2013-09-28 16:09, ago)


Author Message


Posts: 29
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age: 42
In-game name:

 
#10 Posted at 2013-09-28 22:16        
     
this is really handy. Thanks Anders. Kinda got me sidetracked on mission making. :)

One small issue I've noticed: The only things I can use from the start in my backpack are the claymore and magazines. The light sticks and smokes don't show up, even if I drag them over to say my vest or uniform. BUT, when I go to take some out of another player's backpack, suddenly it includes what was in mine. So I go from 0 to +5 (one from him and 4 from my pack). This something I did wrong on my end? Curious what KommieKat's results are.


Author Message


Posts: 16
Rank:


Level: Member

Country: se
Location: Stockholm
Occupation:
Age:
In-game name:

 
#11 Posted at 2013-09-28 22:33        
     
# Kommiekat : Nevermind. Seems I got things working.

Your vest script is working like a charm.
As soon as I get this mission done, I'll PM you.

Good to see you got things up and running!

Please do PM me when your mission is ready. I have a soft spot for LRRP/SF-type missions, can't wait to see yours!
-A

Added 11 minutes later:

# {HoD}Ferocious : The only things I can use from the start in my backpack are the claymore and magazines. The light sticks and smokes don't show up, even if I drag them over to say my vest or uniform.

You are right. I had not noticed that before but it is the same for me. Weirdly enough, I found that dropping the backpack on the ground and picking it up again makes all items appear. I'll keep looking into this; let me know if you find a solution!

This post was edited by AndersMolin (2013-09-28 22:46, ago)

See you in the AO!

Author Message


Posts: 29
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age: 42
In-game name:

 
#12 Posted at 2013-09-28 23:12        
     
Ok, will do for sure!


Author Message


Posts: 16
Rank:


Level: Member

Country: se
Location: Stockholm
Occupation:
Age:
In-game name:

 
#13 Posted at 2013-10-22 14:15        
     
This might verge on necroposting, but anyway:

I saw today that some new scripting commands are added to ArmA3 - among them "vestContainer". Looks like this might make it possible to move forward on creating more elegant custom vest (and uniform) loadouts. I'll take a look at this when time allows!

See you in the AO!





Tags: Backpack, Items