Hypoxic125/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "== Creating A Multiplayer Campaign == A multiplayer campaign is a series of interconnected missions that follow a sequential order, creating a storyline that groups of player...")
 
No edit summary
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Creating A Multiplayer Campaign ==
{{TOC|side}}
Creating a custom loading bar involves utilizing two images. A background image (typically desaturated) and a foreground image (full color).


A multiplayer campaign is a series of interconnected missions that follow a sequential order, creating a storyline that groups of players can enjoy together.
Key things to establish before you develop your own loading bar:
* Where will your control be defined
* In what direction will the loading bar flow in


Key things that a multiplayer campaign will include:
== Required Images ==
*Interconnected sequential missions
*Centralized location of common mission files to save on storage space
*Utilizes {{Link|createMPCampaignDisplay|MPCampaignDisplay}}
*Missions can be selected in the hosted server mission selection menu


== Creating the Missions ==
[[File:arma3 decal-rifle-gray.png|300px|frameless|right|Background Image - Desaturated]][[File:arma3 decal-rifle-pink.png|300px|frameless|right|Foreground Image - Full Color]]


If new to creating missions, it is advised that you ignore concerns about disk space and make each mission independent of the campaign mod. When you get more comfortable with how the file structure works, and have more confidence in your code, you can then move on to centralizing common files. Debugging missions within the mod structure is much more annoying, especially if your code is more prone to bugs/errors.
You will need to have two images:
* Background Image: Desaturated
* Foreground Image: Full Color


Be sure you structure your missions with multiplayer {{Link|Multiplayer_Scripting#Locality|locality}} in mind from the start. It is much more time-consuming to convert a single-player mission into a multiplayer mission.
These images will need to be converted from .png to .paa using TexView2


== File Structure ==


Now that you have your missions created, we can move on to the mod's file structure.


<span style="color: blue;">'''myModName'''</span>
== Building The Config ==
|--<span style="color: red;">addons</span>
    |--<span style="color: red;">myCampaignName</span>
      |--<span style="color: green;">data</span>
      |--<span style="color: green;">functions</span>
      |--<span style="color: red;">campaign</span>
      |  |--<span style="color: red;">missions</span>
      |  |  |--myMission01.worldName
      |  |  |--myMission02.worldName
      |  |  |--myMission03.worldName
      |  |--<span style="color: red;">description.ext</span>
      |--<span style="color: red;">$PBOPREFIX$</span>
      |--<span style="color: red;">config.cpp</span>


<span style="color: red;">Red</span> highlights indicate required files/folders
'''Define Pixel Grid Macros'''
<syntaxhighlight lang="cpp">
#define pixelScale          0.5
#define GRID_X              safezoneX
#define GRID_Y              safezoneY
#define GRID_W              (pixelW * pixelGridNoUIScale * pixelScale)
#define GRID_H              (pixelH * pixelGridNoUIScale * pixelScale)
#define CENTER_X            ((getResolution select 2) * 0.5 * pixelW)
#define CENTER_Y            ((getResolution select 3) * 0.5 * pixelH)
</syntaxhighlight>


<span style="color: green;">Green</span> highlights indicate optional organization files/folders for shared campaign files
'''Define Image Positions'''
<syntaxhighlight lang="cpp">
#define IMAGE_X    0
#define IMAGE_Y    0
// IMAGE_W and IMAGE_H need to follow the aspect ratio of your image. This is for a 2:1 image.
#define IMAGE_W    50
#define IMAGE_H    25
</syntaxhighlight>


== Campaign Description.ext ==
'''Create Config'''


The campaign description file will dictate how the missions are structured within the campaign menus. Unlike a single-player campaign, we are going to be ignoring the mission flow aspect of the campaign description file so that the multiplayer campaign menu functions correctly.
Import Base Classes
* [[GUI_Tutorial#Import_Classes_Via_import_Keyword_(Mission_Only)|Mission]]
* [[GUI_Tutorial#Declare_Classes_(Addon_Only)|Addon]]
 
<syntaxhighlight lang="cpp">
#define pixelScale          0.5
#define GRID_X              safezoneX
#define GRID_Y              safezoneY
#define GRID_W              (pixelW * pixelGridNoUIScale * pixelScale)
#define GRID_H              (pixelH * pixelGridNoUIScale * pixelScale)
#define CENTER_X            ((getResolution select 2) * 0.5 * pixelW)
#define CENTER_Y            ((getResolution select 3) * 0.5 * pixelH)
 
#define IMAGE_X    0
#define IMAGE_Y    0
// IMAGE_W and IMAGE_H need to follow the aspect ratio of your image. This is for a 2:1 image.
#define IMAGE_W    50
#define IMAGE_H    25
 
class TAG_MyDisplay {
idd = -1;
onLoad = "uiNamespace setVariable ['TAG_MyDisplay', _this select 0]";
onUnload = "uiNamespace setVariable ['TAG_MyDisplay', nil]";
 
class Controls {
class BackgroundCtrl: RscPicture {
idc = -1;
x = IMAGE_X * GRID_W;
y = IMAGE_Y * GRID_H;
w = IMAGE_W * GRID_W;
h = IMAGE_H * GRID_H;
onLoad = "uiNamespace setVariable ['TAG_BackgroundCtrl', _this select 0]";
onUnload = "uiNamespace setVariable ['TAG_BackgroundCtrl', nil]";
text = "pathTo\BackgroundImg.paa";
};
class ForegroundCtrlGroup: RscControlsGroupNoScrollBars {
    idc = -1;
    x = IMAGE_X * GRID_W;
    y = IMAGE_Y * GRID_H;
    w = IMAGE_W * GRID_W;
    h = IMAGE_H * GRID_H;
onLoad = "uiNamespace setVariable ['TAG_ForegroundCtrlGroup', _this select 0]";
onUnload = "uiNamespace setVariable ['TAG_ForegroundCtrlGroup', nil]";
    class controls {
        class ForegroundCtrl: RscPicture {
            idc = -1;
            x = 0 * GRID_W;
            y = 0 * GRID_H;
            w = IMAGE_W * GRID_W;
            h = IMAGE_H * GRID_H;
            onLoad = "uiNamespace setVariable ['TAG_ForegroundCtrl', _this select 0]";
            text = "pathTo\ForegroundImg.paa";
        };
    };
};
};
};
</syntaxhighlight>
 
[[Category:Arma 3: Editing]]

Latest revision as of 03:31, 27 April 2024

Creating a custom loading bar involves utilizing two images. A background image (typically desaturated) and a foreground image (full color).

Key things to establish before you develop your own loading bar:

  • Where will your control be defined
  • In what direction will the loading bar flow in

Required Images

Background Image - Desaturated
Foreground Image - Full Color

You will need to have two images:

  • Background Image: Desaturated
  • Foreground Image: Full Color

These images will need to be converted from .png to .paa using TexView2


Building The Config

Define Pixel Grid Macros

#define pixelScale          0.5
#define GRID_X              safezoneX
#define GRID_Y              safezoneY
#define GRID_W              (pixelW * pixelGridNoUIScale * pixelScale)
#define GRID_H              (pixelH * pixelGridNoUIScale * pixelScale)
#define CENTER_X            ((getResolution select 2) * 0.5 * pixelW)
#define CENTER_Y            ((getResolution select 3) * 0.5 * pixelH)

Define Image Positions

#define IMAGE_X    0
#define IMAGE_Y    0
// IMAGE_W and IMAGE_H need to follow the aspect ratio of your image. This is for a 2:1 image.
#define IMAGE_W    50
#define IMAGE_H    25

Create Config

Import Base Classes

#define pixelScale          0.5
#define GRID_X              safezoneX
#define GRID_Y              safezoneY
#define GRID_W              (pixelW * pixelGridNoUIScale * pixelScale)
#define GRID_H              (pixelH * pixelGridNoUIScale * pixelScale)
#define CENTER_X            ((getResolution select 2) * 0.5 * pixelW)
#define CENTER_Y            ((getResolution select 3) * 0.5 * pixelH)

#define IMAGE_X    0
#define IMAGE_Y    0
// IMAGE_W and IMAGE_H need to follow the aspect ratio of your image. This is for a 2:1 image.
#define IMAGE_W    50
#define IMAGE_H    25

class TAG_MyDisplay {
	idd = -1;
	onLoad = "uiNamespace setVariable ['TAG_MyDisplay', _this select 0]";
	onUnload = "uiNamespace setVariable ['TAG_MyDisplay', nil]";

	class Controls {
		class BackgroundCtrl: RscPicture {
			idc = -1;
			x = IMAGE_X * GRID_W;
			y = IMAGE_Y * GRID_H;
			w = IMAGE_W * GRID_W;
			h = IMAGE_H * GRID_H;
			onLoad = "uiNamespace setVariable ['TAG_BackgroundCtrl', _this select 0]";
			onUnload = "uiNamespace setVariable ['TAG_BackgroundCtrl', nil]";
			text = "pathTo\BackgroundImg.paa";
		};
		class ForegroundCtrlGroup: RscControlsGroupNoScrollBars {
    		idc = -1;
    		x = IMAGE_X * GRID_W;
    		y = IMAGE_Y * GRID_H;
    		w = IMAGE_W * GRID_W;
    		h = IMAGE_H * GRID_H;
			onLoad = "uiNamespace setVariable ['TAG_ForegroundCtrlGroup', _this select 0]";
			onUnload = "uiNamespace setVariable ['TAG_ForegroundCtrlGroup', nil]";
    		class controls {
        		class ForegroundCtrl: RscPicture {
            		idc = -1;
            		x = 0 * GRID_W;
            		y = 0 * GRID_H;
            		w = IMAGE_W * GRID_W;
            		h = IMAGE_H * GRID_H;
            		onLoad = "uiNamespace setVariable ['TAG_ForegroundCtrl', _this select 0]";
            		text = "pathTo\ForegroundImg.paa";
        		};
    		};
		};
	};
};