Jump to content
copper2010

Shoreline (Mission concept and editing questions [lots of them])

Recommended Posts

UPDATE:

Wow, has the mission come a long way! The main mechanics are out of the way, for now, only small stuff remains, the orginal post is kinda obsolete by now, but I will keep it down there. I am making this so that I can kind of revise stuff that I am working on and need help on. Thanks for reading!

1) Letting the side who controls the sector respawn there. This is my biggest issue thus far, as, to my knowledge, you can only have the sector module active when the sector is "finalize". This also means that the sector can no longer be captured. I am pretty sure I can find a loophole in the system though, by having the sector finalize for a few seconds, then undo it could activate the trigger, thus allowing the respawn point to activate, while at the same time allowing the opposite team to capture the area.

2) Making objects disappear/appear when sectors have been captured. When a sector is captured, I plan to have vehicle ammo appear somewhere in the area so that friendly vehicles can resupply. Since there is a vehicle ammo box for each faction, I need to know how to make one box appear while another disappears when the sector changes control.

3) How to put a timer on addAction menus. The last thing we want is a team spamming helicopters, so I need some why to limit the when people spawn. This can be local and/or serverside.

Old Post

Hello Arma 3 community. For a long time, I have dreamed of a large scale, combined operations entirely PvP mission in Arma 3. I am a huge fan of Planetside 2, and decided to mix the two into a "mission" for Arma 3. In the finished product, I plan to have classes, buyable weapons (from in game money received when completing tasks) a resource system that will let players buy vehicles and extra equipment for their soldier, and overall a mixture of the realism that Arma is known for, and the gameplay that make planetside 2 unique.

I know that pretty much everything will be possible, a money system is seen in RPG Life and Wasteland; classes pretty much mean simply changing the player's loadout.

The only problem...

I am shit at coding.

Well, not shit, just new to it. I have searched the internet and the forums for a long time with no avail. Here is what I need to know.

How to create a scroll menu, while I hope to one day put in some fancy UI, for right now all I need to know is how to have a scroll wheel appear when the player looks at the terminals (laptops) that will display options. For example, if I am looking at the infantry terminal, I see the classes that I can become, or a vehicles terminal, I can see the vehicles I can spawn.

How to use the input to change the player's class/spawn vehicles. Basically when the player selects the option, the game will make the choice “happenâ€. If I change my class to an engineer, my weapon/gear will change to the default loadout of the engineer.

How to create zones that can be captured by any side. It would be preferable to have different points that would speed up the process of the capture, but all I need is an area that if a side stays in it for a while, they will capture it.

How to create an ever-changing spawn system, when a faction captures an area, they will be able to respawn there.

How to script a money and resource system. I imagine this is where most of the trouble is going to smack me in the face. I know a money system is possible, but will probably require a lot of coding in and outside of the game. I am even more doubtful about the resource system. I’ve never really seen this done in an Arma mission before, so I don’t know if people will know how to do it. In any case, I want players to be able to buy attachments, new weapons, extra gear, you get the idea. Something akin to the Wasteland system would be a good start; another problem I have run into is how to have the money be automatically added to the player’s account. In Wasteland, the player has to run over to the body and collect the money. My plan is to have money automatically added to the account of the player whenever he kills an enemy, helps capture a zone, revives a teammate, etc etc. This is going to be fun, isn’t it :rolleyes:.

That’s all I can really think of right now… I might need some more help in the future, but these things are almost necessary for the mission to work as intended. Any help would be greatly appreciated!

Also, I know this is a very ambitious mission for one person with no coding experience to take on, but if you are only here to say “BLUUUU U CANT DU IT BRAH.†I will basically ignore you. This doesn’t mean I will blow you off if you offer to help me make it, hell, I would love it if someone offers a hand. I don’t mind sharing credit, which basically means that I will acknowledge everyone that helped me out.

Thanks in advance guys, I really want this to work out :D.

Edited by copper2010

Share this post


Link to post
Share on other sites

@Copper2010 A lot of your questions may have answers to them from BI's Wiki website: http://community.bistudio.com/wiki/Category:Scripting_Topics If you want to be more specific, ArmA 3 scripting question you can find here: http://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 Your question about creating a scroll menu may be answered here: http://community.bistudio.com/wiki/addAction

Also just a heads up, in the past I've used other people's missions as resources in creating my own scripts, or using their's if the mission has what I'm looking for.

Share this post


Link to post
Share on other sites

@Copper2010 I was up for most of the night, till early morning researching and trying to create a All-in-One Load-Out script activated by the "addAction" command selecting a case. I'm actually quite speechless on why I haven't been able to get it to work, I'm getting no script errors in my ArmA2OA.rpt file or in the "Squint2" tool. (I've created several instances of the script that I've lost track, the most recent one I haven't tested yet. I get the different actions on the crate but when I select one nothing happens.) Anyhow here's what I have so far for the newest version...

selectRole.sqf

_unit = _this select 0; 
_unitRole = _this select 1; 

sleep 0.001; 
waitUntil {!isNull _unit}; 
waitUntil {alive _unit}; 

removeAllWeapons _unit; 
removeBackPack _unit; 
_unit setVariable ["ACE_WeaponOnBack", ""]; 
_unit setVariable ["ACE_RuckMagContents", []]; 
_unit setVariable ["ACE_RuckWepContents", []]; 

removeAllItems _unit; 
_unit addWeapon "ACE_Map"; 
_unit addWeapon "ItemCompass"; 
_unit addWeapon "ItemWatch"; 
_unit addWeapon "ACRE_PRC343"; 
_unit addWeapon "ACRE_PRC148"; 
_unit addWeapon "ACE_DAGR"; 
_unit addWeapon "ACE_Earplugs"; 
_unit addWeapon "ACE_Rangefinder_OD"; 

_unitRoleOptions = ["Squad Leader", "Team Leader", "Automatic Rifleman", "Grenadier", "Rifleman", "Designated Marskman", "Sniper", "Engineer", "Medic"]; 

switch (_unitRole) do {    
   case "Squad Leader": {}; 
   case "Team Leader": {};     
   case "Automatic Rifleman": {};     
   case "Grenadier": {};     
   case "Rifleman": {};     
   case "Designated Marksman": {};     
   case "Sniper": {};     
   case "Engineer": {};     
   case "Medic": {}; 
}; 

_primaryWeapon = primaryWeapon _unit; 
if (_primaryWeapon! = "") then 
{ 
   _unit selectweapon _primaryWeapon; 
   _muzzles = getArray (configFile>> "cfgWeapons" >> _primaryWeapon >> "muzzles"); 
   _unit selectWeapon (_muzzles select 0); 
};

selectRoleAct.sqf

// Add this to init box of object: null = [this] execVM "scripts\selectRoleAct.sqf"; 

this addAction ["Play as Squad Leader", "selectRole.sqf", "Squad Leader"]; 
this addAction ["Play as Team Leader", "selectRole.sqf", "Team Leader"]; 
this addAction ["Play as Automatic Rifleman", "selectRole.sqf", "Automatic Rifleman"]; 
this addAction ["Play as Grenadier", "selectRole.sqf", "Grenadier"]; 
this addAction ["Play as Rifleman", "selectRole.sqf", "Rifleman"]; 
this addAction ["Play as Designated Marksman", "selectRole.sqf", "Designated Marksman"]; 
this addAction ["Play as Sniper", "selectRole.sqf", "Sniper"]; 
this addAction ["Play as Engineer", "selectRole.sqf", "Engineer"]; 
this addAction ["Play as Medic", "selectRole.sqf", "Medic"];

Share this post


Link to post
Share on other sites

Damn dude, that is complex looking (at least to me ), keep me posted and let's hope it will work, again, thanks for all the help, I'm going to start working on basic respawns, since I finished up with the vehicle spawn script yesterday, hope you figure that thing out, it is way outta my league!

Share this post


Link to post
Share on other sites

It only seems complex because it's a big block of code and you have no context as to what it is doing. If you understand the syntax and functions, it's quite simple; and this is true of all programming and scripting languages.

In the simplest terms I can put it, programming/scripting is nothing more than checking conditions, changing variables, and executing actions.

When you write down a simple action, like the "hint" command:

hint "Hello world";

That line is executed whenever the script is called or the object is initialized. All that line produces is a box that says "Hello world" in it.

But let's say you only wanted that text to appear when A = B.

if (A == B) then {hint "Hello world";};

Now the text, "Hello world" will only display if variable A is equal to variable B.

How do you know what variable A and B are? Well, with ARMA scripting specifically, you must declare them somewhere first to initialize them; usually in a init.sqf file you must create in the mission folder.

A = 0;
B = 0;

Now if we put them all together in a single script:

A = 0;
B = 0;
if (A == B) then {hint "Hello world";};

This script tell A it is 0, B it is 0, and will then display "Hello World" because A equals the same as B (0).

But variables do not need to be integers (numbers) or strings (text). They can also be boolean (true/false), Objects (named objects placed in the editor map), or even other commands.

Share this post


Link to post
Share on other sites

@TheCoolSideofthePillow Could you explain why I'm unable to get the script above to work? I've spent quite some time researching, developing and trying to get this script to work. I'm trying to create an addAction script that when a player selects the action (i.e. Rifleman) he'll switch to that load-out.

Share this post


Link to post
Share on other sites
@TheCoolSideofthePillow Could you explain why I'm unable to get the script above to work? I've spent quite some time researching, developing and trying to get this script to work. I'm trying to create an addAction script that when a player selects the action (i.e. Rifleman) he'll switch to that load-out.

this will not work inside the script it needs to be _this select 0. By putting [this] in front of the execvm you are passing the object to the script.

To call the whole list (if there is more than one object) use _this, but that is an array and your command will not handle an array so select the first in the array by selecting 0

// Add this to init box of object: null = [this] execVM "scripts\selectRoleAct.sqf";
_box = _this select 0;

_box addAction ["Play as Squad Leader", "selectRole.sqf", "Squad Leader"];
_box addAction ["Play as Team Leader", "selectRole.sqf", "Team Leader"];
_box addAction ["Play as Automatic Rifleman", "selectRole.sqf", "Automatic Rifleman"];
_box addAction ["Play as Grenadier", "selectRole.sqf", "Grenadier"];
_box addAction ["Play as Rifleman", "selectRole.sqf", "Rifleman"];
_box addAction ["Play as Designated Marksman", "selectRole.sqf", "Designated Marksman"];
_box addAction ["Play as Sniper", "selectRole.sqf", "Sniper"];
_box addAction ["Play as Engineer", "selectRole.sqf", "Engineer"];
_box addAction ["Play as Medic", "selectRole.sqf", "Medic"];

side note: you may want to put a check in for ACE running then remove those items. as there is no ACE for A3 yet, it might pay to just use the standard items.

use this to check if a mod is running

if (isClass(configFile >> "cfgPatches" >>  "ACRE") then { /*code goes here*/ };

Edited by KevsnoTrev

Share this post


Link to post
Share on other sites

@KevsnoTrev, could you be more specific about your last sentence? I would like to create the script so that it can be used in more than one object.

Share this post


Link to post
Share on other sites

just edited, not sure if its any clearer now

edit: is it the array you are having trouble with understanding?

Share this post


Link to post
Share on other sites

@KevsnoTrev I'm having trouble trying to comprehend how the addActions in the script will select the certain role in the main script and change the player's loadout. I've only spent a few hours on trying to figure out/learn the case command, how it works, and how to initialize a case when certain parameters are met and/or an action selects a case.

I'm testing the script in ArmA 2 CO as I move along before I modify it for ArmA 3. I just got done testing it, and the actions show up, but when I select "Play as Squad Leader" nothing happens. Here's an update of the selectRole.sqf script...

selectRole.sqf:

private ["_unit", "_muzzles", "_unitRole", "_primaryWeapon"];
_unit = _this select 1;
_unitRole = _this select 2;  

sleep 0.001;  
waitUntil {!isNull _unit};  
waitUntil {alive _unit};  

switch (_unitRole) do {     
   	case "Squad Leader": {
	removeAllWeapons _unit;  
	removeBackPack _unit;  
	_unit setVariable ["ACE_WeaponOnBack", ""];  
	_unit setVariable ["ACE_RuckMagContents", []];  
	_unit setVariable ["ACE_RuckWepContents", []];  

	removeAllItems _unit;  
	_unit addWeapon "ACE_Map";  
	_unit addWeapon "ItemCompass";  
	_unit addWeapon "ItemWatch";  
	_unit addWeapon "ACRE_PRC343";  
	_unit addWeapon "ACRE_PRC148";  
	_unit addWeapon "ACE_DAGR";  
	_unit addWeapon "ACE_Earplugs";  
	_unit addWeapon "ACE_Rangefinder_OD";
};  
   	case "Team Leader": {};      
   	case "Automatic Rifleman": {};      
   	case "Grenadier": {};      
   	case "Rifleman": {};      
   	case "Designated Marksman": {};      
   	case "Sniper": {};      
   	case "Engineer": {};      
   	case "Medic": {};  
};  

_primaryWeapon = primaryWeapon _unit;  
if (_primaryWeapon! = "") then  
{  
   	_unit selectweapon _primaryWeapon;  
   	_muzzles = getArray (configFile>> "cfgWeapons" >> _primaryWeapon >> "muzzles");  
  	_unit selectWeapon (_muzzles select 0);  
};

Edited by JSF 82nd Reaper

Share this post


Link to post
Share on other sites

okay, I see what you have done.

An addaction passes 4 things to the script it runs

_this select 0 - the object: can be a player, or an ammo box of a vehicle, just about anything

_this select 1 - the caller: usually the player

_this select 2 - the action id: used to remove the addaction using removeaction if the action is only to be used once.

_this select 3 - the parameters you define and pass to the script the third string in your example.

change line 3 in your script to

[color=#0000BB][font=monospace]_unitRole [/font][/color][color=#007700][font=monospace]= [/font][/color][color=#0000BB][font=monospace]_this select 3;[/font][/color]

Share this post


Link to post
Share on other sites

@KevsnoTrev Thank you, I missed that and the script seems to be working now, I just need to add a few more Weapons and Magazines to make certain that it does work. Once I'm certain that it's working I'll create an ArmA 3 version of it, will I have to change much other than the ACE stuff, and a few of the removeWeapons/addWeapons command?

Share this post


Link to post
Share on other sites

all good. A3 changed the additem and assignitem quicker/easier/simpler(maybe) now by using linkitem or unlinkitem

@copper - sorry for messing up the thread, but it will be useful to you as well.

Back to the topic at hand

- what do you mean by a resource system. I never played planetside.

Are you looking at collecting 'items' from in game

- eg. damaged vehicles drop scrap, killing enemies allows you to loot them for 'valuables'

Edited by KevsnoTrev

Share this post


Link to post
Share on other sites
all good. A3 changed the additem and assignitem quicker/easier/simpler(maybe) now by using linkitem or unlinkitem

@copper - sorry for messing up the thread, but it will be useful to you as well.

Back to the topic at hand

- what do you mean by a resource system. I never played planetside.

Are you looking at collecting 'items' from in game

- eg. damaged vehicles drop scrap, killing enemies allows you to loot them for 'valuables'

No problem! You were very helpful!

In planetside 2, every time you capture a facility, that facility will provide a certain type of "resource" that will flow to your base. Every few minutes, the number of resources received will then be added to your resource pool, which you can use to buy armor, aerospace, and infantry gear, each having their certain type of resource.

So let's say you control Area A, B, and C. A provides infantry resources, B provides armor resources, and C provides aerospace every five minutes. After you get, lets say 50 armor resources, you can buy a quadbike. Or 100 aerospace will get you a fighter.

It is kinda hard for me to explain, so here is the wiki article explaining it...

http://planetside.wikia.com/wiki/Resources

This is used so that factions cannot simply spam tanks/planes over and over.

While I am planning to not go into as much depth as the Planetside 2 system, I imagine it would be possible to have each sector give a type of resource, and give it to each player every number of minutes.

Hope this helps!

Share this post


Link to post
Share on other sites

@KevsnoTrev I would like to thank you again for for your help and I just got done testing the script after adding more stuff to the loadouts and it worked.

@Copper2010 Thanks to KevsnoTrev's help the script now works, I'll be creating a separate version of it for ArmA 3, I should have it to you in the next day or two. Once that is done I'll attempt to start on a resources script, but I really don't know if I'll be able to do that, it sounds like it may be above my head, I'll give it a try though.

Share this post


Link to post
Share on other sites
@KevsnoTrev I would like to thank you again for for your help and I just got done testing the script after adding more stuff to the loadouts and it worked.

@Copper2010 Thanks to KevsnoTrev's help the script now works, I'll be creating a separate version of it for ArmA 3, I should have it to you in the next day or two. Once that is done I'll attempt to start on a resources script, but I really don't know if I'll be able to do that, it sounds like it may be above my head, I'll give it a try though.

Wow, thanks dude! This is more help from the community then I imagined I would be getting, really happy to see people who are willing to help!

I'm pretty sure I have a solid sector control system in place, I will need your loadout system to let it switch between sides (basically load the right weapons for the right faction when they select their class). My plan is to have the game point to a certain script (The BLUFOR loadout script or the OPFOR loadout script) depending on who controls the sector.

I also have a vehicle spawning system in place. It spawns the vehicle and then moves the player into the driver's seat...

Each vehicle uses its own script, here is the script for the BLUFOR quadbike...

_car = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn"); 
cutText ["","BLACK", 0.3];  
sleep 1; 
player moveInDriver _car;
cutText ["","BLACK IN", 5];

While this works great in singleplayer, I am a little worried about mutiplayer, using common sense, my guess is that _car is the name of the spawned quadbike. What I am worried about is that when someone else spawns a quadbike, it will be named _car_1 by Arma 3 on default, I am not sure whether the script will compensate for that by changing the player moveInDriver _car to player moveInDriver _car_1, or simply move the player to _car, or the quadbike spawned by another player.

I'll test this later in mutiplayer.

Share this post


Link to post
Share on other sites
I also have a vehicle spawning system in place. It spawns the vehicle and then moves the player into the driver's seat...

Each vehicle uses its own script, here is the script for the BLUFOR quadbike...

_car = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn"); 
cutText ["","BLACK", 0.3];  
sleep 1; 
player moveInDriver _car;
cutText ["","BLACK IN", 5];

While this works great in singleplayer, I am a little worried about mutiplayer, using common sense, my guess is that _car is the name of the spawned quadbike. What I am worried about is that when someone else spawns a quadbike, it will be named _car_1 by Arma 3 on default, I am not sure whether the script will compensate for that by changing the player moveInDriver _car to player moveInDriver _car_1, or simply move the player to _car, or the quadbike spawned by another player.

I'll test this later in mutiplayer.

The _ bit means local to that run of the script. so _car will provide a reference for just that script. However, the car is spawned locally and then sync'ed globally in multiplayer automatically by the createVehicle command so make sure that its only spawning on the 1 client or just serverside. These are called local variables.

https://community.bistudio.com/wiki/addAction

^That will work (if I am reading and recalling properly) in a way so that if the client triggers the script by selecting the action, the script only executes for the client that triggered it, meaning that the syncing is done for you.

Make sure that you look into getting a garbage script too if you want to do this mission, otherwise you performance will probably be hurt reasonably quickly. (I assume you want to run this persistently)

After you have had a look at the BIKI page I linked, have a look around on there at these to help you get an understanding:

https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3

https://community.bistudio.com/wiki/Control_Structures

https://community.bistudio.com/wiki/execVM

Make sure you use comments for any blocks of code that you use so that you can remember what you did, it will make changing any code or bugfinding (for others) as well as learning from the code much much easier. I will assume that you know the difference between the // comment and the */ comment tags.

And something a little more complex (I can explain a bit further/provide an example mission later today if needed) but will help with performance (really needed if you want to make a PS2 style gamemode):

https://community.bistudio.com/wiki/function

Functions also make life easier as far as flexibility as well as for performance sakes (you can call them on separate threads if you use spawn instead of call). They can also be called ingame as well by triggers using both the call and spawn commands (I think you can use both in triggers, not sure) which means they are even more useful (Normal scripts can too, using the execVM call). I can send you the little mission I made that used that for you to examine (even comes with some notes too!).

https://community.bistudio.com/wiki/profileNamespace

Since I am assuming you want to run this persistently you might want to use that. Namespace can be used to store variables so that if you want to restart the server but keep progress saved (or track players progress serverside) you can. It is quite advanced stuff, but it really can add to the playability of your mission. I am currently experimenting with this and making a mission with it, but I am willing to share the mission with you so that you can learn from it (and yes I have included comments on the code!).

Wow, I was only going to write a little bit about local variables, but ended up writing an essay almost...

Edited by [EVO] Dan

Share this post


Link to post
Share on other sites

@Copper2010 Just a suggestion but you may want to look into incorporating a system like the loadout script I've been working on, that way you don't have 5+ scripts to spawn different vehicles. I can see if I can attempt that for you, if it's even possible.

Share this post


Link to post
Share on other sites

BTW Copper if you want help with scripting, then feel free to keep this thread going or to PM me. I don't have time to help you actively dev Shoreline (I make my own missions more to my own style and I don't have much time at my good PC nowadays), but I don't mind giving you pointers/sharing code as and when you need it.

Might even getting around to writing a guide with example missions at some point if I get chance.

Share this post


Link to post
Share on other sites
Dan;2603933']BTW Copper if you want help with scripting' date=' then feel free to keep this thread going or to PM me. I don't have time to help you actively dev Shoreline (I make my own missions more to my own style and I don't have much time at my good PC nowadays), but I don't mind giving you pointers/sharing code as and when you need it.

Might even getting around to writing a guide with example missions at some point if I get chance.[/quote']

Wow, thanks Dan, I will defiantly hold you up to that XD

As for the vehicle spawning, that is what I already do, the player walks up to the terminal, chooses an option from the scroll menu, and then is moved to the vehicle he spawned. If that is what you were saying.

The namespace thing is very useful, I didn't know it would be possible to store player's status serverside without doing a number on the server!

If I am reading correctly, functions are basically more accurate and faster ways to have stuff happen in game, without all the code of scripts. Being as "code noob" as I am though, I am sure I am missing something.

In any case, thanks for the huge help you guys have been! I hope the mission won't a disappointment when it comes out, this is a great learning experience for me though, I hope this knowledge will help me in future missions after Shoreline is complete!

Again, thanks for everything!

Share this post


Link to post
Share on other sites
Wow, thanks Dan, I will defiantly hold you up to that XD

As for the vehicle spawning, that is what I already do, the player walks up to the terminal, chooses an option from the scroll menu, and then is moved to the vehicle he spawned. If that is what you were saying.

Most of the way there. You have to make sure that the createVehicle command is only executed on one client, otherwise you end up with multiple copies of everything! But addAction solves that as it executes the code on the client that activated it via their action menu.

The namespace thing is very useful, I didn't know it would be possible to store player's status serverside without doing a number on the server!

Originally it came in TOH but only for campaign saving and SP progress, you would have had to think of something else otherwise. But in A3 they made it so it can be used serverside too (which is really useful).

If I am reading correctly, functions are basically more accurate and faster ways to have stuff happen in game, without all the code of scripts. Being as "code noob" as I am though, I am sure I am missing something.

It gets compiled so it does run a little quicker, but it does make it much easier to edit if you reuse the code multiple times as you only have to edit that one thing and not C+P it to every script you put your code in. I think it says that somewhere on the wiki page.

In any case, thanks for the huge help you guys have been! I hope the mission won't a disappointment when it comes out, this is a great learning experience for me though, I hope this knowledge will help me in future missions after Shoreline is complete!

Again, thanks for everything!

And its good to hear we have someone else interested in making missions!

Share this post


Link to post
Share on other sites

Ok, new problem!

I've been trying to get the respawn points up and running, and while the respawn points themselves are working, I cannot get the code for the respawnInventory to work for the life of me.

The menu shows up for the respawnInventory, but no loadouts show up, despite the fact that I have two in the CfgRespawnInventory description file.

Here is what I have in the CfgRespawnInventory description file...

class CfgRespawnInventory
{
class WEST1
{
	displayName = "Sniper"; 
	icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; 


	weapons[] = {
		"srifle_LRR_SOS_F",
	};
	magazines[] = {
		"7Rnd_408_Mag",
		"7Rnd_408_Mag",
		"7Rnd_408_Mag",
		"7Rnd_408_Mag",
		"7Rnd_408_Mag",
	};
	linkedItems[] = {
		"V_BandollierB_rgr",
		"ItemMap",
		"ItemCompass",
		"ItemWatch",
		"ItemRadio"
	};
	uniformClass = "U_B_GhillieSuit";
};
class WEST2
{

	displayName = "Paratrooper"; 
	icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; 


	weapons[] = {
		"arifle_MX_F",
	};
	magazines[] = {
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
	};
	linkedItems[] = {
		"V_PlateCarrier2_rgr",
		"H_HelmetB",
		"ItemMap",
		"ItemCompass",
		"ItemWatch",
		"ItemRadio"
	};
	uniformClass = "U_B_CombatUniform_mcam_vest";
	backpack = "B_Parachute";
};
};

And in a separate function file, I have this (I assumed that I was suppose to put it in a function file, wiki was kinda vague)

[west, "WEST1"] call BIS_fnc_addRespawnInventory;

Like I said, I can see the respawn inventory menu, but no loadouts show up...

Any tips?

Share this post


Link to post
Share on other sites

@Copper2010 Here's the loadout scripts, I hope they meet your needs. I haven't tested them yet, but I believe they should work, if you have any questions feel free to ask. If they don't work just let me know and I'll take a closer look and try to figure it out. (You may need to update the script paths to where every you put them, just edit these parts below to match your script paths "scripts\selectRoleAct.sqf" & "scripts\selectRole.sqf".)

selectRoleAct.sqf

// Add this to init box of object: null = [this] execVM "selectRoleAct.sqf";  
private ["_box"];
_box = _this select 0;

_box addAction ["Play as Squad Leader", "selectRole.sqf", "Squad Leader"];
_box addAction ["Play as Team Leader", "selectRole.sqf", "Team Leader"];
_box addAction ["Play as Automatic Rifleman", "selectRole.sqf", "Automatic Rifleman"];
_box addAction ["Play as Grenadier", "selectRole.sqf", "Grenadier"];
_box addAction ["Play as Rifleman", "selectRole.sqf", "Rifleman"];
_box addAction ["Play as Designated Marksman", "selectRole.sqf", "Designated Marksman"];
_box addAction ["Play as Sniper", "selectRole.sqf", "Sniper"];
_box addAction ["Play as Sniper", "selectRole.sqf", "Spotter"];
_box addAction ["Play as Engineer", "selectRole.sqf", "Engineer"];
_box addAction ["Play as Medic", "selectRole.sqf", "Medic"];

selectRole.sqf

private ["_unit", "_unitRole"];
_unit = _this select 1;
_unitRole = _this select 3; 

sleep 0.001;  
waitUntil {!isNull _unit};  
waitUntil {alive _unit};  

switch (_unitRole) do {
case "Squad Leader": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "arifle_MX_f";
       _unit addMagazines ["30Rnd_65x39_caseless_mag", 2];
       _unit addBackpack "B_AssaultPack_rgr";
       _unit addPrimaryWeaponItem "optic_Aco";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };  
case "Team Leader": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };      
case "Automatic Rifleman": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };      
case "Grenadier": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };      
case "Rifleman": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };      
case "Designated Marksman": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };      
case "Sniper": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };
case "Spotter": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };      
case "Engineer": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };      
case "Medic": {
       removeAllWeapons _unit;
       removeAllItems _unit;
       removeBackPack _unit;

       _unit addItem "";
       _unit addWeapon "";
       _unit addMagazines ["", 2];
       _unit addBackpack "";
       _unit addPrimaryWeaponItem "";
       _unit addSecondaryWeaponItem "";
       _unit addItemToBackpack "";
       _unit addItemToUniform "";
       _unit addItemToVest "";
   };  
};

Edited by JSF 82nd Reaper

Share this post


Link to post
Share on other sites
Ok, new problem!

I've been trying to get the respawn points up and running, and while the respawn points themselves are working, I cannot get the code for the respawnInventory to work for the life of me.

The menu shows up for the respawnInventory, but no loadouts show up, despite the fact that I have two in the CfgRespawnInventory description file.

Here is what I have in the CfgRespawnInventory description file...

		
	weapons[] = {
		"arifle_MX_F",
	};
	magazines[] = {
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
		"30Rnd_65x39_caseless_mag"
	};
};

I think you need to add the , to the above code, besides that I cant see anything wrong. I cant check it with arma atm, it'll probably show something in your rpt for the error though so have a look there.

And in a separate function file, I have this (I assumed that I was suppose to put it in a function file, wiki was kinda vague)

[west, "WEST1"] call BIS_fnc_addRespawnInventory;

Like I said, I can see the respawn inventory menu, but no loadouts show up...

Any tips?

No, you don't need to put that in a function since that it is a function that exists already (you can though). You can just call it in a normal script though.

Btw just looking over the wiki page

https://community.bistudio.com/wiki/BIS_fnc_addRespawnInventory

Did you have a look and try the example one on this page?

https://community.bistudio.com/wiki/Arma_3_Respawn

I get the general impression you should have your CfgRespawnInventory in the description.ext and then in the init.sqf put the addRespawnInventory code so that it is available to the whole side on loading. I am not sure if it need to be executed just serverside but I don't think it'll do any harm to have it run that code once on each client. (If you get duplication bugs with the loadouts, then yes you need to execute it only serverside).

Edited by [EVO] Dan

Share this post


Link to post
Share on other sites

@Copper - There were quite a bit of missing , and also even one too many (after last element of some arrays) in some cases. I fixed the , mistakes below.

class CfgRespawnInventory
{
class WEST1
{
	displayName = "Sniper"; 
	icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; 


	weapons[] = {
		"srifle_LRR_SOS_F"
	};
	magazines[] = {
		"7Rnd_408_Mag",
		"7Rnd_408_Mag",
		"7Rnd_408_Mag",
		"7Rnd_408_Mag",
		"7Rnd_408_Mag"
	};
	linkedItems[] = {
		"V_BandollierB_rgr",
		"ItemMap",
		"ItemCompass",
		"ItemWatch",
		"ItemRadio"
	};
	uniformClass = "U_B_GhillieSuit";
};
class WEST2
{

	displayName = "Paratrooper"; 
	icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; 


	weapons[] = {
		"arifle_MX_F"
	};
	magazines[] = {
		"30Rnd_65x39_caseless_mag",
		"30Rnd_65x39_caseless_mag",
		"30Rnd_65x39_caseless_mag",
		"30Rnd_65x39_caseless_mag",
		"30Rnd_65x39_caseless_mag",
		"30Rnd_65x39_caseless_mag",
		"30Rnd_65x39_caseless_mag"
	};
	linkedItems[] = {
		"V_PlateCarrier2_rgr",
		"H_HelmetB",
		"ItemMap",
		"ItemCompass",
		"ItemWatch",
		"ItemRadio"
	};
	uniformClass = "U_B_CombatUniform_mcam_vest";
	backpack = "B_Parachute";
};
};

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

×