Jump to content
Sign in to follow this  
ante185

class EventHandlers : EventHandlers the init part.

Recommended Posts

OK, I am not the best when it comes to modding but I have some ridicules problem.

		class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\a3\characters_f_gamma\Rebels\scripts\randomize_equipment.sqf""";
	};

this should run the sqf so each unit gets random uniforms and headgear. But it says that it can't find the sqf, when making addons the uses scripts do they follow special rules or what?

this is the sqf:

/*
File: randomize_equipment.sqf
Author: pettka, modified for a different purpose by "ante"

Description:
Randomizes a headgear form _headgear array and puts it to civilian's headgear slot upon startup of mission.
_rnd1 is used to have some civilians without any headgear
_rnd2 is used to determine particular headgear from array


Parameter(s):
None

Returns:
Nothing
*/

_headgear = ["H_Cap_tan", "H_Cap_blk", "H_Cap_blk_CMMG", "H_Cap_brn_SPECOPS",  "H_Cap_tan_specops_US", "H_Cap_khaki_specops_UK", "H_Shemag_tan", 
		 "H_Cap_grn_BI", "H_Cap_blk_Raven", "H_Cap_blk_ION", "H_Bandanna_khk", "H_Bandanna_sgg", "H_Bandanna_cbr", "H_Bandanna_gry", "H_Shemag_khk", "H_Shemag_olive", 
		 "H_Bandanna_surfer", "H_Beret_blk", "H_Beret_red", "H_Beret_grn", "H_TurbanO_blk", "H_StrawHat", 
		 "H_StrawHat_dark", "H_Hat_brown", "H_Hat_camo", "H_Hat_grey", "H_Hat_tan", "H_HelmetB_paint", "H_HelmetIA", "H_MilCap_dgtl", "H_HelmetIA_net", "H_HelmetB", ];

_headCount = count _headgear;

if (isServer) then {
BIS_randomSeed1 = [];
BIS_randomSeed2 = [];
_rnd1 = floor random 3;	
_this setVariable ["BIS_randomSeed1", _rnd1, TRUE];
_rnd2 = floor random _headCount;
_this setVariable ["BIS_randomSeed2", _rnd2, TRUE];
};

waitUntil {!(isNil {_this getVariable "BIS_randomSeed1"})};
waitUntil {!(isNil {_this getVariable "BIS_randomSeed2"})};
_randomSeed1 = _this getVariable "BIS_randomSeed1";
_randomSeed2 = _this getVariable "BIS_randomSeed2";

if (_randomSeed1 < 2) then {
_this addHeadgear (_headgear select _randomSeed2);
};
_uniform = ["U_B_CombatUniform_mcam", "U_B_CombatUniform_mcam_tshirt", "U_B_CombatUniform_mcam_worn", "U_B_survival_uniform",  "U_BG_Guerilla1_1", "U_BG_Guerilla2_1", "U_BG_Guerilla2_2", "U_BG_Guerilla2_3", 
		 "U_BG_Guerilla3_1", "U_BG_Guerilla3_2", "U_BG_leader", "U_C_Farmer", "U_I_CombatUniform_shortsleeve", "U_I_CombatUniform_tshirt", "U_I_OfficerUniform", "H_Bandanna_gry", "H_Bandanna_camo", "H_Bandanna_mcamo", 
		 "U_B_CombatUniform_mcam", "U_B_CombatUniform_mcam_tshirt", "U_B_CombatUniform_mcam_worn", "U_B_survival_uniform",  "U_BG_Guerilla1_1", "U_BG_Guerilla2_1", "U_BG_Guerilla2_2", "U_BG_Guerilla2_3", 
		 "U_BG_Guerilla3_1", "U_BG_Guerilla3_2", "U_BG_leader", "U_I_CombatUniform_shortsleeve", "U_I_CombatUniform_tshirt", "U_I_OfficerUniform", "H_Bandanna_gry", "H_Bandanna_camo", "H_Bandanna_mcamo", 
		 "U_OrestesBody", "U_C_WorkerCoveralls", "U_C_WorkerOveralls", "U_C_TeeSurfer_shorts_1", "U_C_ShirtSurfer_shorts", "U_C_Scavenger_1", 
		 "U_C_Scavenger_1", "U_C_Scavenger_2", "U_C_Poor_1", "U_C_Poor_shorts_2", "U_C_HunterBody_grn", "U_C_HunterBody_brn", "U_C_Fisherman"];

_headCount2 = count _uniform;

if (isServer) then {
BIS_randomSeed1 = [];
BIS_randomSeed2 = [];
_rnd1 = floor random 3;	
_this setVariable ["BIS_randomSeed1", _rnd1, TRUE];
_rnd2 = floor random _headCount2;
_this setVariable ["BIS_randomSeed2", _rnd2, TRUE];
};

waitUntil {!(isNil {_this getVariable "BIS_randomSeed1"})};
waitUntil {!(isNil {_this getVariable "BIS_randomSeed2"})};
_randomSeed1 = _this getVariable "BIS_randomSeed1";
_randomSeed2 = _this getVariable "BIS_randomSeed2";

if (_randomSeed1 < 2) then {
removeUniform _this
_this addUniform (_uniform select _randomSeed2);
};

please some help would be appreciated!

Share this post


Link to post
Share on other sites

First of all is this .sqf in that location where you are saying it...

second, I am also having problems with finding "external files" when binarizing my addon, also when in game... could be some little error in typing or within the game itself...

Third: If you are just running this as like a script inside the game you can change the location into you mission file, or if its in an addon... copy paste it into your addon and change the location of it and see if that works..

Fourth: If you are doing an addon, see if binarizing it or not binarizing it and just packing it would work

Share this post


Link to post
Share on other sites

First of all is this .sqf in that location where you are saying it...

Yeah there is no folder called Rebels and no scripts in:

\a3\characters_f_gamma\

@Ante185

Where did you get the name and path from?

Share this post


Link to post
Share on other sites

I am reusing a PBO from the game, I've added Rebels & scripts folders myself and yes that is the location of the file.

E:\Arma tools\Projects (arma 3)\[u]characters_f_gamma[/u]\a3\characters_f_gamma\Rebels\scripts

this is where sqf is before I turn characters_f_gamma into a PBO and all other configs that uses outside files and scripts begins with \a3\

the eventhandler init for civilians that give them random hats and caps looks like this:

\a3\characters_f\civil\scripts\script.sqf

maybe \a3\characters_f_gamma needs to change name as the game thinks the script is in the unmodded version of that folder?

Edited by ante185

Share this post


Link to post
Share on other sites

If I understand the code below... is inside a script

class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\a3\characters_f_gamma\Rebels\scripts\randomize_equipment.sqf""";
	};

First of all...

@UNN is right.. there is no such Rebels folder in \a3\characters_f_gamma\ neither is it on yours..

. what you are saying is that the Rebels folder is inside

  
E:\Arma tools\Projects (arma 3)\characters_f_gamma\a3\characters_f_gamma\Rebels\scripts

So wouldnt your event hander be something like

class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\Arma tools\Projects (arma 3)\characters_f_gamma\a3\characters_f_gamma\Rebels\scripts\randomize_equipment.sqf""";
	};

Because if i read what you said properly... the above code should most likely work

Share this post


Link to post
Share on other sites
I am reusing a PBO from the game, I've added Rebels & scripts folders myself .....

Big yellow flashing lights !!

That NOT how you add content to the game. You make your own NEW PBO.

Share this post


Link to post
Share on other sites

Sorry guys, i got it working, I was just stupid when a entered the path. but thanks for the help still!

And Gnat I didn't mean that I edited the PBOs that the game uses, I copied characters_f_gamma.pbo and unpbo'ed it and used that as a base :P

Share this post


Link to post
Share on other sites

class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\a3\characters_f_gamma\Rebels\scripts\randomize_equipment.sqf""";
	};

If I want to add another sqf. to this line? because another init will just get me a member is already defined error.

Slap me if it is something along these lines

class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\path\file.sqf""""\path\file_2.sqf""";
	};

also how do I in the same sqf make it so the unit gets a random weapon + mags for that weapon, I've tried making a Frankenstein script but to no avail.

and alex it's in a config, for untis :P like this

	class pmc_F : pmcs {
	identityTypes[] = {"Head_Greek", "G_CIVIL_male"};
	faceType = "Man_A3";
	faction = pmc_blue;
	vehicleClass = "Men";
	scope = public;
	displayName = EISP pmc (Unarmed);
	portrait = "\A3\characters_f\data\ui\portrait_comBarHead_civ_man_ca.paa";
	model = "\A3\Characters_F\Civil\c_poloshirt";
	modelSides[] = {3};
	nakedUniform = "U_NikosBody";
	weapons[] = {"Throw", "Put"};
	respawnWeapons[] = {"Throw", "Put"};
	magazines[] = {"HandGrenade", "HandGrenade"};
	respawnMagazines[] = {"HandGrenade", "HandGrenade"};
	linkedItems[] = {"V_BandollierB_blk", "H_Booniehat_dgtl", "ItemMap", "ItemCompass", "ItemWatch", "ItemRadio"};
	respawnLinkedItems[] = {"V_BandollierB_blk", "H_Booniehat_dgtl", "ItemMap", "ItemCompass", "ItemWatch", "ItemRadio"};

	class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\characters_a_pmc\randomize_equipment.sqf""";
	};
};

Edited by ante185
additonal questions

Share this post


Link to post
Share on other sites

noooooooo Seperate them.... if what i remember I did this awhile back and gave errorss and i dont know for sure if that works but just seperate them... i think that works

class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\path\file.sqf"""; init = "(_this select 0) execVM""\path\file_2.sqf""";
	};

not for sure if the second one can have (_this select 0) may have to make it a 1 and redefine what 1 is but might work with 0 still

Share this post


Link to post
Share on other sites
noooooooo Seperate them.... if what i remember I did this awhile back and gave errorss and i dont know for sure if that works but just seperate them... i think that works

class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\path\file.sqf"""; init = "(_this select 0) execVM""\path\file_2.sqf""";
	};

not for sure if the second one can have (_this select 0) may have to make it a 1 and redefine what 1 is but might work with 0 still

class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\path\file.sqf"""; init = "(_this select 0) execVM""\path\file_2.sqf""";
	};

is the same as

class EventHandlers : EventHandlers {
		init = "(_this select 0) execVM ""\path\file.sqf""";
                       init = "(_this select 0) execVM""\path\file_2.sqf""";
	};

So both will give me member already defined

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
Sign in to follow this  

×