Jump to content
eviljack109

Looking to do cust. loadouts with sqf's

Recommended Posts

For the past few years I've been doing custom load-out kits for my unit. How we've always done it is I just have a box that has this in the init:

this addAction ["Rifleman", {player execVM "CAF_W\Rifleman.sqf";},[],1,true,true,"","true",5];

Well this and many other kits of many other names. When you pick it, the game just removes everything and gives you the kit in the file. Really easy.
The problem with this is people tend to pick up the stuff from one kit, drop it on the floor, pick another cit, then combine the two. Making for some people to have really OP load-outs which were never the intent of the system I made.

So what I want to do now is when a unit loads they spawn with that sqf file. And I have no idea how to do this... 

This is how it goes in my head: 

Player joins server for op >> player enters role selection screen. >> player sees plenty of open slots, some say Teamleader, Sniper, Rifleman, etc. >> player selects rifleman slot. >> Player then goes to load into the game. >> Players spawns with load-out that was given in the rifleman.sqf >> have fun.

I've kept doing some variation of...
 

player execVM "LOADS\Rifleman.sqf";

But with no good results.

Pls halp.

 

Share this post


Link to post
Share on other sites
57 minutes ago, eviljack109 said:

custom load-out kits

 

Hello there eviljack109 !

 

There are a lot of scripts to do this and a lot of possible ways.

Below i have my script made , very easy to use and edit and it can work for both players and ai.

 

 

Share this post


Link to post
Share on other sites
2 hours ago, eviljack109 said:

when a unit loads

what does "loads" mean?

 

You can just use the init script in editor.

Important part is that you add a "local" check to it, otherwise the loadout script may fire repeatedly.

 

Something like

if (local this) then {
    this execVM "LOADS\Rifleman.sqf";
};

Just into the init script box in the Editor, on that unit.

Share this post


Link to post
Share on other sites
3 hours ago, eviljack109 said:

Player joins server for op >> player enters role selection screen. >> player sees plenty of open slots, some say Teamleader, Sniper, Rifleman, etc. >> player selects rifleman slot. >> Player then goes to load into the game. >> Players spawns with load-out that was given in the rifleman.sqf >> have fun.

 

 

It seems to me that's the aim of the cfgRespawnInventories / cfgRoles in description.ext

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, eviljack109 said:

The problem with this is people tend to pick up the stuff from one kit, drop it on the floor, pick another cit, then combine the two. Making for some people to have really OP load-outs which were never the intent of the system I made.

Yea, people are a$$holes, but there really isn't anyway to prevent this unless you disable their ability to drop things from their inventory entirely or have some sort of "clean up" script that keeps objects from being present on the ground too long.

 

 

Ok, well, wayyyy easier to do than initially expected:

 

player addEventHandler [ "InventoryClosed",
	{
		params ["_unit","_container"];
		deleteVehicle _container;
	}
];

 

  • Like 2

Share this post


Link to post
Share on other sites
21 hours ago, GEORGE FLOROS GR said:

Hello there eviljack109 !

 

There are a lot of scripts to do this and a lot of possible ways.

Below i have my script made , very easy to use and edit and it can work for both players and ai.

 


Not really what I'm looking for, it seems your script assigns the kits randomly. Or I just can't find how to assign a kit to a specific unit.

 

 

19 hours ago, Dedmen said:

You can just use the init script in editor.

Important part is that you add a "local" check to it, otherwise the loadout script may fire repeatedly.

 

Something like


if (local this) then {
    this execVM "LOADS\Rifleman.sqf";
};

Just into the init script box in the Editor, on that unit.


This is on the right idea of what I am looking for (I think), but this never worked when I tested it in the editor. Also tried replacing "this" with "player" and got nothing. will try it in a server with a friend and take a look.
 

 

19 hours ago, pierremgi said:

It seems to me that's the aim of the cfgRespawnInventories / cfgRoles in description.ext

 

I checked that out and that is far more complicated than I am whilling todo. I already made the loadouts in .sqf format. I just want a way to pull them over.

 

18 hours ago, jshock said:

Yea, people are a$$holes, but there really isn't anyway to prevent this unless you disable their ability to drop things from their inventory entirely or have some sort of "clean up" script that keeps objects from being present on the ground too long.

 

 

Ok, well, wayyyy easier to do than initially expected:

 


player addEventHandler [ "InventoryClosed",
	{
		params ["_unit","_container"];
		deleteVehicle _container;
	}
];

 


I don't want to ban ppl from dropping shit cause that could just make more problems in other areas.

Ty for all responses. will keep exploring.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, eviljack109 said:

Not really what I'm looking for, it seems your script assigns the kits randomly. Or I just can't find how to assign a kit to a specific unit

 

This is an example of what you want :

It's the very same script

ex :

if(typeOf _this isEqualto "I_Soldier_TL_F") then{
    [_this] execVM "GF_Exported_Loadouts_MCD\Loadouts\independent\I_Soldier_TL_F.sqf";
};

and this is for respawn

ex:

_this addEventHandler ["Respawn", {
    params ["_unit", "_corpse"];
    _unit execVM "GF_Exported_Loadouts_MCD\Loadouts\independent\I_Soldier_TL_F.sqf";
}];

and you can also use a eventhandler , for disabling , picking up stuff :

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take

ex:

On 12/20/2018 at 4:47 AM, GEORGE FLOROS GR said:

You can add the items that you want to be available or excluded , if you remove the "!" from the code :


if (!(_item in GF_List))  then { 

 


GF_List =[
//	add your list
"classname",
"classname"
]; 

player addEventHandler ["Take",{ 
params ["_unit", "_container", "_item"];

hint format["You picked a %1",_item];

if (!(_item in GF_List))  then { 
_unit unassignItem _item; 
_unit removeItem _item; 
hint "You can't wear that!"};
}];

 

  • Like 1

Share this post


Link to post
Share on other sites

If you go into bis or ace arsenal, you can make a loadout, and then export it, and post it in an sqf and exec it, save yourself all the work, it even writes out the code for you to exec it if I remember right, you just have to turn it to local variables and use the select command, like I'm sure is posted above. but the arsenal is the best way to get your touch. Ask if you need anything. 

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

×