Forum Jump :

Author Message

Posts: 4

Level: Member

Country: de
In-game name:

#1 Posted at 2016-08-29 23:11        
Hi there,
I've created a simple Parameter to choose between my Custom Vanilla Loadouts and my Custom IFA3 Loadouts:
Then i put the following in my init.sqf:

It's working so far. I choose Vanilla or Iron Front from the Parameters and can spawn with my Vanilla Rifleman or my 1944 Rifleman. But i have more classes. Even this is working if i put them in like this. But i want a slim init.sqf and added a classes_init.hpp:

Is it possible to use this in my init.sqf? I tried
if (_Era == 1) then {#include "classes_init.hpp"};
but got an invalid Number error.
if (_Era == 1) then #include "classes_init.hpp"
+ added {} to classes_init.hpp creates the same error.
Guess i just can't use #include. But is there another Way?

Thanks, Ostanes

Author Message


Posts: 433

Level: Member

Country: de
Location: Bavaria
Occupation: Communications Designer
Age: 34
In-game name: Tajin

#2 Posted at 2016-09-01 08:32        
#include is part of the "Preprocessor" and everything it does happens before any scripts are run.
Hence that if-block is not going to work.
Also be aware that .hpp are NOT script-files, so don't mix up scripting and configs. Scripts can be part of configs (in certain spaces) but they're not the same at all.

I'd say only put that Era selector in your parameters and then define the loadouts from your init like you already tried in your second example.

Of course you can then split that code into different files if you so desire – the principe stays the same.

if (isServer) then {
	_Era = "Era" call BIS_fnc_getParamValue;
	if (_Era == 0) then {
		execVM "init_Vanilla.sqf";
	} else {
		execVM "init_IronFront.sqf";

There are a lot of very capable people on this forum, willing to spend some of their time to help you out. So if you have a problem, it surely isn't too much to ask that you atleast take the time to describe it properly. Thanks.