It is currently Wed Sep 30, 2020 5:09 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Sun Mar 09, 2014 9:44 pm 
Offline
User avatar

Joined: Fri Feb 17, 2012 1:22 pm
Posts: 1090
I don't know if any of you know (some do), but there's an easy way to have playable units equipped like you want them from the start of the mission AND have them respawn with that gear and not the default gear (essentially removes the need for saving gear scripts). all you need to do is

(1) add a line to your mission's Description.ext
Code:
respawnOnStart = 1;

bear in mind, it doesn't actually make you die and respawn on start, it just flags all playable units as respawned. what for? well for this to work:

(2) create a file in your mission's folder called onPlayerRespawn.sqf (this is technically an Event Handler, a function that fires off whenever a player respawns, it can do ANYTHING, it will run any script, so be careful, what I'm proposing to you is to use it for saving gear automatically - https://community.bistudio.com/wiki/Arma_3_Respawn#Files). here's what you put in it (a regular fireteam's layout):
Code:
#define BR "srifle_EBR_F"
#define BR_MAG "20Rnd_762x51_Mag"

#define AR "arifle_MXC_F"
#define AR_MAG "30Rnd_65x39_caseless_mag"
#define AR_MUZZLE "muzzle_snds_M"

#define MG "LMG_Mk200_F"
#define MG_MAG "200Rnd_65x39_cased_Box_Tracer"
#define MG_MUZZLE "muzzle_snds_H_MG"

#define P "hgun_Pistol_heavy_01_F"
#define P_MAG "11Rnd_45ACP_Mag"

#define HEAD "H_HelmetB_light_snakeskin"
#define UNIFORM "U_B_CTRG_1"
#define PLATE "V_PlateCarrierL_CTRG"
#define PACK "B_Kitbag_cbr"

#define OPTIC "optic_Hamr"
#define ATTCH "acc_pointer_IR"

switch (str player) do {
    case "S1"://FTL
    {
        removeallweapons player;
      removeallitems player;
      removeBackpack player;
      
      player addHeadgear HEAD;
      player addUniform UNIFORM;
      player addVest PLATE;
      player addBackpack PACK;
      player addMagazines [P_MAG,4];
      player addWeapon P;
      player addMagazines [BR_MAG,6];
      player addWeapon BR;
      player addPrimaryWeaponItem OPTIC;
      player addPrimaryWeaponItem ATTCH;
      player addItem "ItemGPS";
      player addItem "Laserdesignator";
      player addMagazines ["Laserbatteries",1];
      player addItem "FirstAidKit";
      player addMagazines ["SmokeShell",3];
      player addMagazines ["SmokeShellPurple",1];
      player addMagazines ["HandGrenade",2];
    };
case "S2"://Rifleman
    {
        removeallweapons player;
      removeallitems player;
      removeBackpack player;
      
      player addHeadgear HEAD;
      player addUniform UNIFORM;
      player addVest PLATE;
      player addBackpack PACK;
      player addItem AR_MUZZLE;
      player addMagazines [P_MAG,4];
      player addWeapon P;
      player addMagazines [AR_MAG,9];
      player addWeapon AR;
      player addPrimaryWeaponItem OPTIC;
      player addPrimaryWeaponItem ATTCH;
      player addMagazines ["SmokeShell",2];
      player addMagazines ["HandGrenade",2];
    };
   case "S3"://CLS
    {
        removeallweapons player;
      removeallitems player;
      removeBackpack player;

      player addHeadgear HEAD;
      player addUniform UNIFORM;
      player addVest PLATE;
      player addBackpack PACK;
      player addItem AR_MUZZLE;
      player addMagazines [P_MAG,4];
      player addWeapon P;
      player addMagazines [AR_MAG,9];
      player addWeapon AR;
      player addPrimaryWeaponItem OPTIC;
      player addPrimaryWeaponItem ATTCH;
      player addItem "Medikit";
      player addItem "FirstAidKit";
      player addItem "FirstAidKit";
      player addItem "FirstAidKit";
      player addItem "FirstAidKit";
      player addItem "FirstAidKit";
      player addItem "FirstAidKit";
    };
   case "S4"://Automatic Rifleman
    {
        removeallweapons player;
      removeallitems player;
      removeBackpack player;

      player addHeadgear HEAD;
      player addUniform UNIFORM;
      player addBackpack PACK;
      player addVest PLATE;
      player addMagazines [P_MAG,4];
      player addWeapon P;
      player addMagazines [MG_MAG,4];
      player addWeapon MG;
      player addPrimaryWeaponItem OPTIC;
      player addPrimaryWeaponItem ATTCH;
      player addMagazines ["HandGrenade",2];   
    };
};

you can add more cases (they have to match your playable units' names in the editor)

(3) (for this example) in your mission, in the editor, name 4 of your playable units S1 through S4, when you start the mission your named units will spawn with the gear you defined in the file above. and they will respawn with it.

how this works.

I assume you know a thing or two about scripts so I won't go into much detail. you only really need to work with the first few lines that begin with #define

#define VARIABLE "value"

this adds a constant expression to a variable of your choosing (name it anything, it should be descriptive). in our case expression is a class name of a piece of equipment. you can look up class names for weapons here: https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Weapons for example.

so, you define which item is associated with your variables. then, what you do is you specify which unit gets which type of weapon, magazine etc. you just copy paste cases, altering variables. after you've become familiar with this you can add your own stuff, make it even more streamlined.

TL;DR:
copy all of the above into your mission folder, load through and see what it does. play around with values of variables. hope this helps someone


Last edited by sorophx on Mon Mar 10, 2014 9:31 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Mar 10, 2014 8:00 am 
Offline

Joined: Sun Feb 26, 2012 3:31 pm
Posts: 427
Whiskers has done the leg work I think in HCcore. It just doesn't get reactivated on respawn, I think we have used the save gear script in case we needed extra stuff. but then if the mission maker sets this up then you wouldnt need to save gear.

maybe it could be option use hccore or4 this?

S1-68/69 is also used by HCcore


Top
 Profile  
 
PostPosted: Mon Mar 10, 2014 8:22 am 
Offline
User avatar

Joined: Fri Feb 17, 2012 1:22 pm
Posts: 1090
this file essentially works the same as this: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPRespawn
only less hassle to set up. Whiskers could use the EH to save people one extra click on the Save button. but that's not really needed.

the method above is for situations where the mission maker doesn't want to place down a weapon crate in his mission for one reason or another but still wants the gear to be saved.

or you could look at this as a way of enforcing certain loadouts on certain player slots. instead of trusting people not to pick weird shit up from the crates you just make an extra effort and pre-assign all the gear via onPlayerRespawn, same as clicking on one of Whiskers's buttons in the GUI.


Top
 Profile  
 
PostPosted: Mon Mar 10, 2014 9:14 am 
Offline

Joined: Sun Feb 26, 2012 3:31 pm
Posts: 427
I know how it works as I was using it to test the his ticket function. We could use the inventory system atve spawn.


You can activate n it using a respawn template.


Top
 Profile  
 
PostPosted: Mon Mar 10, 2014 9:16 am 
Offline

Joined: Sun Feb 26, 2012 3:31 pm
Posts: 427
I do agree though. I would love to ditch crates entirely and just have ammo in vehicles.


Top
 Profile  
 
PostPosted: Mon Mar 10, 2014 9:34 am 
Offline
User avatar

Joined: Fri Feb 17, 2012 1:22 pm
Posts: 1090
btw, we tested the ticket system with Plores. passing [west,16] to the function set the number of tickets to 32 with the two of us. in other words, it's fucked up a bit, we need to test it thoroughly to see how and when it determines the number of tickets for various parameters. passing [player, 2, true] set it to -1, for example


Top
 Profile  
 
PostPosted: Mon Mar 10, 2014 10:05 am 
Offline

Joined: Sun Feb 26, 2012 3:31 pm
Posts: 427
Yeah it is strange. MYbe it is because it is on the init file so it executes every time since one joins.


Top
 Profile  
 
PostPosted: Mon Mar 10, 2014 10:48 am 
Offline
User avatar

Joined: Sat Feb 18, 2012 2:45 pm
Posts: 657
Location: Netherlands
is server perhaps?

_________________
No, I disagree


Top
 Profile  
 
PostPosted: Mon Mar 10, 2014 10:50 am 
Offline

Joined: Sun Feb 26, 2012 3:31 pm
Posts: 427
I tried it, it still doesn't work.


Top
 Profile  
 
PostPosted: Tue Mar 11, 2014 12:55 pm 
Offline

Joined: Sun Feb 17, 2013 12:32 pm
Posts: 183
hccore does use this event handler already, but yes it's only if 'save gear' has been clicked on the GUI. It only works after saving gear in the GUI to allow mission makers to not use the GUI at all.

If this event handler is used all the time by hccore then players will always respawn with whatever gear they saved into their default profile - regardless of whether or not the havoc crates were placed in the mission. This could (and did) easily fuck things up.

I don't know if soro's method would override the eventhandler defined in hccore - so if you use this method then for some reason used the GUI and saved gear, I have no idea what you'd respawn with.

For cases where the mission maker didn't want to allow players to choose their own year, I made the initGear script which assigns all players the default havoc gear for their faction and role (currently only defined for BLUFOR) and saves it to their default profile - therefore they respawn with that same gear. This doesn't allow players to have their own gear like soro's does, but then again if the mission maker wants players to choose their own gear then they would include the crate and GUI.

Overall this method is the same as saving a profile in the GUI then loading it on mission start. It requires the mission maker to add more scripts to their mission. It only allows one set of gear to be defined, whereas the GUI allows 5 different profiles (not that many people use them anyway). It does make it slightly faster at mission start, but that's the only advantage I see.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group