Jump to content
Sign in to follow this  
ErynSunn

need help with character spawn scripts.

Recommended Posts

OK SO. im new to Arma 3 but not to modding maps and scenarios with other games. here's my issue: I am working out some custom scenarios actually working out a whole campaign. i can not for the life of me get the characters i create to respawn or spawn for that matter with the custom loadouts i have given them. 
so if i named my loadout i want my character to spawn in with "loadout one" and i exported said loadout into the clipboard and made a "loadout1.sqf" file from the exported to clipboard information from the arsenal we use. what do i need to put into the Init section of the character to make them spawn with what's in "loadout1.sqf" every time they spawn or respawn. because everything i try fails and loads me in with a black screen and i can't see. 
simplest version of my querry is "what do i have to do to get my characters to load in with the loadouts and gear i made for them each time they spawn or respawn?" 
because none of what i am reading is working. 
 

Share this post


Link to post
Share on other sites
42 minutes ago, ErynSunn said:

what ever happened to keep it simple.

 

Consider editing your post to a simple, easy-to-read question.

Share this post


Link to post
Share on other sites
21 minutes ago, Harzach said:

 

Consider editing your post to a simple, easy-to-read question.

FAIR ENOUGH! lmao sorry i was not a happy camper when i wrote that it was six hours of trying to find an answer and getting no where because all the videos i found were older. lol i'll go fix that :D 

Share this post


Link to post
Share on other sites

ok i edited to make it simpler but it's not a simple question. because every time i have asked it in it's simplest form i get directed to information that doesn't work anymore. i need to know how to make my characters spawn with my custom loadout and everything i see and try doesn't work because it came from older versions of arma 3. :D 

 

Share this post


Link to post
Share on other sites

The short version:

  • Build your unit's loadout in Arsenal (right-click unit, "Edit Loadout")
  • Export loadout (data is copied to clipboard)
  • Create loadout script (paste data into script file, some editing required, see next post)
  • In unit init:  null = [this] execVM "loadout.sqf"; this addeventhandler ["respawn","_this execVM 'loadout.sqf'"];

You can create as many different loadouts as you'd like (E.G. "squadLeadLoadout.sqf", "riflemanLoadout.sqf", "medicLoadout.sqf", etc).

 

Share this post


Link to post
Share on other sites

going to try thank you for putting up with my frustration. lol i tried a code that looked REALLY close to this but it gave me an error. i may have typed it wrong. gonna try this. i'll update with what i got. :D 

 

Share this post


Link to post
Share on other sites

I edited a BLU rifleman's loadout slightly, by changing his primary weapon from an MX to a SPAR-16 and adding a few mags to his vest. Here is the export data from Arsenal:

 

Spoiler

comment "Exported from Arsenal by Harzach";

comment "Remove existing items";
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;

comment "Add containers";
this forceAddUniform "U_B_CombatUniform_mcam";
this addItemToUniform "FirstAidKit";
this addItemToUniform "Chemlight_green";
for "_i" from 1 to 2 do {this addItemToUniform "30Rnd_556x45_Stanag";};
this addVest "V_PlateCarrier1_rgr";
for "_i" from 1 to 2 do {this addItemToVest "16Rnd_9x21_Mag";};
this addItemToVest "SmokeShell";
this addItemToVest "SmokeShellGreen";
this addItemToVest "Chemlight_green";
for "_i" from 1 to 2 do {this addItemToVest "HandGrenade";};
for "_i" from 1 to 7 do {this addItemToVest "30Rnd_556x45_Stanag";};
this addHeadgear "H_HelmetB";
this addGoggles "G_Tactical_Black";

comment "Add weapons";
this addWeapon "arifle_SPAR_01_snd_F";
this addPrimaryWeaponItem "acc_pointer_IR";
this addPrimaryWeaponItem "optic_Aco";
this addWeapon "hgun_P07_F";

comment "Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "ItemRadio";
this linkItem "NVGoggles";

comment "Set identity";
this setFace "WhiteHead_15";
this setSpeaker "male11eng";

 

 

To use this in my "loadout.sqf," I make these changes:

 

Spoiler

// "Exported from Arsenal by Harzach";  //REPLACE ALL "COMMENT" WITH "//"

//ADD _unit SECTION
waitUntil {!isNull player};
private ["_unit"];
_unit = _this select 0;

// "Remove existing items";
removeAllWeapons _unit;  //REPLACE ALL "THIS" WITH "_UNIT"
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

// "Add containers";
_unit forceAddUniform "U_B_CombatUniform_mcam";
_unit addItemToUniform "FirstAidKit";
_unit addItemToUniform "Chemlight_green";
for "_i" from 1 to 2 do {_unit addItemToUniform "30Rnd_556x45_Stanag";};
_unit addVest "V_PlateCarrier1_rgr";
for "_i" from 1 to 2 do {_unit addItemToVest "16Rnd_9x21_Mag";};
_unit addItemToVest "SmokeShell";
_unit addItemToVest "SmokeShellGreen";
_unit addItemToVest "Chemlight_green";
for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
for "_i" from 1 to 7 do {_unit addItemToVest "30Rnd_556x45_Stanag";};
_unit addHeadgear "H_HelmetB";
_unit addGoggles "G_Tactical_Black";

// "Add weapons";
_unit addWeapon "arifle_SPAR_01_snd_F";
_unit addPrimaryWeaponItem "acc_pointer_IR";
_unit addPrimaryWeaponItem "optic_Aco";
_unit addWeapon "hgun_P07_F";

// "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";
_unit linkItem "NVGoggles";

// "Set identity";
_unit setFace "WhiteHead_15";
_unit setSpeaker "male11eng";

 

 

Share this post


Link to post
Share on other sites
5 minutes ago, ErynSunn said:

going to try thank you for putting up with my frustration. lol i tried a code that looked REALLY close to this but it gave me an error. i may have typed it wrong. gonna try this. i'll update with what i got. :D 

 

 

My third post includes some necessary info!

Share this post


Link to post
Share on other sites

ok i did the following. i opened my editor i went to my character i clicked edit loadout. i made my loadout saved my loadout and exported the loadout to a text editor and saved the file to the mission folder titled the mission i am working on as a .sqf file. 
it shows up in the right place and with the information copied from the export all the right gear is in the file and every thing. i named the file eryn1loadout.sqf. 
i then went into the character atributes and copied and pasted what you said to put there and made it have the name of the loadout i want as in i typed this into the init section of the character attributes: null = [this] execVM "eryn1loadout.sqf"; this addeventhandler ["respawn","_this execVM 'eryn1loadout.sqf'"]; 
and when i start the game up and load in my mission sure enough i spawn with the default stuff. so what am i getting wrong? 
is this because we use the "arsenal anywhere" mod? or did i do something wrong. because yeah this did exactly what it's been doing and spawned me with the default stuff the character was made out of. 

Share this post


Link to post
Share on other sites

in the sqf file the stuff i exported said this: 
 

comment "Exported from Arsenal by ErynSunn";

comment "Remove existing items";
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;

comment "Add containers";
this forceAddUniform "UNS_TIGER_BDU";
this addItemToUniform "FirstAidKit";
this addVest "CUP_V_CZ_vest10";
for "_i" from 1 to 2 do {this addItemToVest "SmokeShellOrange";};
for "_i" from 1 to 2 do {this addItemToVest "hlc_50rnd_300BLK_STANAG_EPR";};
this addBackpack "B_AssaultPack_ocamo";
this addItemToBackpack "Medikit";
this addItemToBackpack "ToolKit";
this addHeadgear "H_HelmetSpecB_snakeskin";
this addGoggles "G_Shades_Red";

comment "Add weapons";
this addWeapon "hlc_rifle_honeybase_x15";
this addPrimaryWeaponItem "muzzle_snds_B";
this addPrimaryWeaponItem "optic_Arco_blk_F";
this addPrimaryWeaponItem "bipod_01_F_blk";

comment "Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "ItemRadio";
this linkItem "ItemGPS";
this linkItem "O_NVGoggles_hex_F";

comment "Set identity";
this setFace "Mason_h";
this setSpeaker "male08eng";

I then saved that as a sqf file and put in the stuff you sent but changing the name to eryn1loadout because that is the name of the sqf i created. 
i load the game load the mission and i spawn with the wrong stuff. so what gives? what am i missing? 


 

Share this post


Link to post
Share on other sites
4 minutes ago, ErynSunn said:

what am i missing? 

My last two posts.

Share this post


Link to post
Share on other sites

lmao yeah i gotcha now i think i missed the changes that have to be made to the stuff from the export. but i THINK im with ya now gonna try it and see if i got it and im gonna thank you for all the help already and really hope someone hugs you for me :D lol going to edit and work it out now. :D 

 

Share this post


Link to post
Share on other sites

SO then THIS would be want i want my loadout sqf to look like? 

// "Exported from Arsenal by ErynSunn";

//ADD _unit SECTION
waitUntil {!isNull player};
private ["_unit"];
_unit = _this select 0;

// "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

// "Add containers";
_unit forceAddUniform "UNS_TIGER_BDU";
_unit addItemToUniform "FirstAidKit";
_unit addVest "CUP_V_CZ_vest10";
for "_i" from 1 to 2 do {this addItemToVest "SmokeShellOrange";};
for "_i" from 1 to 2 do {this addItemToVest "hlc_50rnd_300BLK_STANAG_EPR";};
_unit addBackpack "B_AssaultPack_ocamo";
_unit addItemToBackpack "Medikit";
_unit addItemToBackpack "ToolKit";
_unit addHeadgear "H_HelmetSpecB_snakeskin";
_unit addGoggles "G_Shades_Red";

// "Add weapons";
_unit addWeapon "hlc_rifle_honeybase_x15";
_unit addPrimaryWeaponItem "muzzle_snds_B";
_unit addPrimaryWeaponItem "optic_Arco_blk_F";
_unit addPrimaryWeaponItem "bipod_01_F_blk";

// "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";
_unit linkItem "ItemGPS";
_unit linkItem "O_NVGoggles_hex_F";

// "Set identity";
this setFace "Mason_h";
this setSpeaker "female01eng";
 

Share this post


Link to post
Share on other sites

You missed a few:

 

Spoiler

// "Exported from Arsenal by ErynSunn";

//ADD _unit SECTION
waitUntil {!isNull player};
private ["_unit"];
_unit = _this select 0;

// "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

// "Add containers";
_unit forceAddUniform "UNS_TIGER_BDU";
_unit addItemToUniform "FirstAidKit";
_unit addVest "CUP_V_CZ_vest10";
for "_i" from 1 to 2 do {_unit addItemToVest "SmokeShellOrange";};
for "_i" from 1 to 2 do {_unit addItemToVest "hlc_50rnd_300BLK_STANAG_EPR";};
_unit addBackpack "B_AssaultPack_ocamo";
_unit addItemToBackpack "Medikit";
_unit addItemToBackpack "ToolKit";
_unit addHeadgear "H_HelmetSpecB_snakeskin";
_unit addGoggles "G_Shades_Red";

// "Add weapons";
_unit addWeapon "hlc_rifle_honeybase_x15";
_unit addPrimaryWeaponItem "muzzle_snds_B";
_unit addPrimaryWeaponItem "optic_Arco_blk_F";
_unit addPrimaryWeaponItem "bipod_01_F_blk";

// "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";
_unit linkItem "ItemGPS";
_unit linkItem "O_NVGoggles_hex_F";

// "Set identity";
_unit setFace "Mason_h";
_unit setSpeaker "female01eng";

 

 

Share this post


Link to post
Share on other sites
2 minutes ago, Harzach said:

You missed a few:

 

  Reveal hidden contents


// "Exported from Arsenal by ErynSunn";

//ADD _unit SECTION
waitUntil {!isNull player};
private ["_unit"];
_unit = _this select 0;

// "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

// "Add containers";
_unit forceAddUniform "UNS_TIGER_BDU";
_unit addItemToUniform "FirstAidKit";
_unit addVest "CUP_V_CZ_vest10";
for "_i" from 1 to 2 do {_unit addItemToVest "SmokeShellOrange";};
for "_i" from 1 to 2 do {_unit addItemToVest "hlc_50rnd_300BLK_STANAG_EPR";};
_unit addBackpack "B_AssaultPack_ocamo";
_unit addItemToBackpack "Medikit";
_unit addItemToBackpack "ToolKit";
_unit addHeadgear "H_HelmetSpecB_snakeskin";
_unit addGoggles "G_Shades_Red";

// "Add weapons";
_unit addWeapon "hlc_rifle_honeybase_x15";
_unit addPrimaryWeaponItem "muzzle_snds_B";
_unit addPrimaryWeaponItem "optic_Arco_blk_F";
_unit addPrimaryWeaponItem "bipod_01_F_blk";

// "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";
_unit linkItem "ItemGPS";
_unit linkItem "O_NVGoggles_hex_F";

// "Set identity";
_unit setFace "Mason_h";
_unit setSpeaker "female01eng";

 

 

ROFLMAO and i knew it the SECOND i logged in and those two things weren't right roflmao i SO would kiss you on your forehead and hug you and make you dance a happy dance with me right now if i could because you just made all of this work for me after SIX DAYS of people leaving out the most important step of changing those "this's" to "_unit" and the "comment" to // 
everyone has left that step out in every example they have shown that i have found and i swear to god you are my newest frackin hero! lmao thank you thank you thank you thank you thank you :D 

  • Haha 1

Share this post


Link to post
Share on other sites

well i was doing the happy dance because i spawned in but ever since i added the stuff to make me spawn with my gear i now have the issue of what ever i click be it map or a box to see what's in it i get stuck in black screen and can't see anything. it's like the game just turns off the video card any time i go into any menu. i used to be able to use "ka virtual arsenal anywhere" to open that and close it and get to see again but since i removed that mod i now can't get out of black screen with that code all being part of the mission. so i guess i have to figure out another way to do this. because dieing repeatedly in black screen hell is not ok. not sure why it couldn't be that this game just saves the gear you load onto your character for the mission and respawns you with it. the way this is overcomplicated makes no sense to us non coders. so i guess i'll go back to not spawning with it and getting my gear from a box like i did before. what a pain in the butt. either way thanks for attempting to help me i just cant seem to get any of it to work and am done with trying to figure it out. it's way overcomplicated for something that should just save to the unit when i make it. 

 

Share this post


Link to post
Share on other sites

Share your mission file and mod list. Something is very wrong.

Share this post


Link to post
Share on other sites

yeah i would love to but i cleared all the missions i was building and gave up. so i can't do that. i got tired of trying to figure out something that is as you say VERY WRONG. SO i just gave up. when someone can explain to me why i can't just save my character and it be that character and stay that character without having to write code then MAYBE i will try again. but with having to learn code to save a load out i doubt it. this game is NOT "user friendly" when it comes to making maps with it's editor. so yeah i gave up. this game makes it WAY too difficult for people who just want to make a scenario and play it and since we can't seem to get any of the stuff we've made to play on our dedicated server we just decided to stop even building. which sucks because everything we made was awesome to us. but we can't get the dedicated server to play it and we can't get loadout spawning to work. so yeah sorry i can't provide that any more. :D i could give you the mod list but at this point why? im not going to make anything else for the game until someone can explain to me why the game makes it so hard to just make a scenario without having to know fricken code. 

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  

×