Jump to content
Sign in to follow this  
windplume

How to make script use to multiplayer

Recommended Posts

init.sqf

if(isServer) then { {if (side _x == opfor) then {nil1 = [_x] execVM "civguise.sqf"}} forEach allUnits };

civguise.sqf

waitUntil {!isNil "bis_fnc_init"};

_civ_clothes = ["U_IG_Guerilla1_1",

"U_IG_Guerilla2_1",

"U_IG_Guerilla2_2",

"U_IG_Guerilla2_3",

"U_IG_Guerilla3_1",

"U_IG_Guerilla3_2",

"U_IG_leader"];

_civ_hats = ["H_Shemag_khk",

"H_Shemag_tan",

"H_Shemag_olive"];

_vests = ["V_Rangemaster_belt",

"V_TacVest_brn",

"V_BandollierB_cbr"];

_unit = _this select 0;

// Remove original equipment

removeAllWeapons _unit;

removeUniform _unit;

removeHeadgear _unit;

removeVest _unit;

removeBackpack _unit;

_unit unassignItem "NVGoggles_OPFOR";

_unit removeItem "NVGoggles_OPFOR";

// Add vest and clothing

_vest_item = _vests call BIS_fnc_selectRandom;

_unit addVest _vest_item;

_cloth_item = _civ_clothes call BIS_fnc_selectRandom;

_unit addUniform _cloth_item;

// Random integer, if 1 instead of 0, add a random item from the array

if(round (random 1) == 1) then

{

_hat_item = _civ_hats call BIS_fnc_selectRandom;

_unit addHeadgear _hat_item;

};

// Random weapon loadout

switch (round(random 7)) do

{

case 0:

{

_unit addMagazines ["30Rnd_556x45_Stanag", 8];

_unit addWeapon "arifle_TRG20_F";

};

case 1:

{

_unit addMagazines ["30Rnd_65x39_caseless_green", 8];

_unit addWeapon "arifle_Katiba_F";

};

case 2:

{

_unit addMagazines ["30Rnd_556x45_Stanag", 8];

_unit addWeapon "arifle_TRG20_F";

};

case 3:

{

_unit addMagazines ["30Rnd_65x39_caseless_green", 8];

_unit addWeapon "arifle_Katiba_F";

};

case 4:

{

_unit addMagazines ["30Rnd_556x45_Stanag", 8];

_unit addWeapon "arifle_TRG20_F";

};

case 5:

{

_unit addMagazines ["30Rnd_65x39_caseless_green", 8];

_unit addWeapon "arifle_Katiba_F";

};

case 6:

{

_unit addBackpack "B_FieldPack_ocamo";

_unit addMagazines ["150Rnd_762x51_Box_Tracer", 5];

_unit addWeapon "LMG_Zafir_F";

};

case 7:

{

_unit addBackpack "B_Carryall_ocamo";

_unit addMagazines ["16Rnd_9x21_Mag", 6];

_unit addMagazines ["RPG32_F", 5];

_unit addWeapon "hgun_Rook40_F";

_unit addWeapon "launch_RPG32_F";

};

};

_unit addMagazine "HandGrenade";

---------- Post added at 11:15 ---------- Previous post was at 11:09 ----------

i try make opfor like terrorist ,but this script only host can useful。 other players can not work。

---------- Post added at 11:16 ---------- Previous post was at 11:15 ----------

i try make opfor like terrorist ,but this script only host can useful。 other players can not work。

Share this post


Link to post
Share on other sites

Did you create a "server" folder in your mission's folder and then put the init in there? You MIGHT also need a Game Logic placed in the mission with the name "server".

Scripts initiated from the init.sqf in the server folder will be initialized on the server, meaning, the host will be processing that stuff.

Scripts initiated from the init.sqf in the default mission's folder will be initiated client-side, meaning, players will process/load that stuff when they load in.

Edited by Phronk

Share this post


Link to post
Share on other sites

You may find that those uniforms do not work on OPFOR units.

Share this post


Link to post
Share on other sites
Did you create a "server" folder in your mission's folder and then put the init in there? You MIGHT also need a Game Logic placed in the mission with the name "server".

Scripts initiated from the init.sqf in the server folder will be initialized on the server, meaning, the host will be processing that stuff.

Scripts initiated from the init.sqf in the default mission's folder will be initiated client-side, meaning, players will process/load that stuff when they load in.

Ok, thanks. I'll try it later.

EDIT

Still not working ! need help !:butbut:

Edited by Maio

Share this post


Link to post
Share on other sites

I like the idea. I have opfor units stripped down for militia too, I just go into INIT and add/remove items and copy AI, between all civilians theres approx. 20 AI guys with different uniforms, just copy those a few times. Not at much time as you may think.

Share this post


Link to post
Share on other sites

try that...

init.sqf

if  !(isServer) then 
{

 {
  if (side _x == opfor) then 
  {
  nil1 = [_x] execVM "civguise.sqf";  
  };
 }forEach allunits;


}; 

civguise.sqf


_unit = _this select 0;


hint "disguise called";

_civ_clothes = ["U_IG_Guerilla1_1",
"U_IG_Guerilla2_1",
"U_IG_Guerilla2_2",
"U_IG_Guerilla2_3",
"U_IG_Guerilla3_1",
"U_IG_Guerilla3_2",
"U_IG_leader"];

_civ_hats = ["H_Shemag_khk",
"H_Shemag_tan",
"H_Shemag_olive"];

_vests = ["V_Rangemaster_belt",
"V_TacVest_brn",
"V_BandollierB_cbr"];




// Remove original equipment
removeAllWeapons _unit;
removeUniform _unit;
removeHeadgear _unit;
removeVest _unit;
removeBackpack _unit;
_unit unassignItem "NVGoggles_OPFOR";
_unit removeItem "NVGoggles_OPFOR";


// Add vest and clothing
_vest_item = _vests call BIS_fnc_selectRandom;
_unit addVest _vest_item;

_cloth_item = _civ_clothes call BIS_fnc_selectRandom;
_unit addUniform _cloth_item;


// Random integer, if 1 instead of 0, add a random item from the array
if(round (random 1) == 1) then
{

_hat_item = _civ_hats call BIS_fnc_selectRandom;
_unit addHeadgear _hat_item;
};

// Random weapon loadout
switch (round(random 7)) do
{
	case 0:
	{
	_unit addMagazines ["30Rnd_556x45_Stanag", 8];
	_unit addWeapon "arifle_TRG20_F";
	};
	case 1:
	{
	_unit addMagazines ["30Rnd_65x39_caseless_green", 8];
	_unit addWeapon "arifle_Katiba_F";
	};
	case 2:
	{
	_unit addMagazines ["30Rnd_556x45_Stanag", 8];
	_unit addWeapon "arifle_TRG20_F";
	};
	case 3:
	{
	_unit addMagazines ["30Rnd_65x39_caseless_green", 8];
	_unit addWeapon "arifle_Katiba_F";
	};
	case 4:
	{
	_unit addMagazines ["30Rnd_556x45_Stanag", 8];
	_unit addWeapon "arifle_TRG20_F";
	};
	case 5:
	{
	_unit addMagazines ["30Rnd_65x39_caseless_green", 8];
	_unit addWeapon "arifle_Katiba_F";
	};
	case 6:
	{
	_unit addBackpack "B_FieldPack_ocamo";
	_unit addMagazines ["150Rnd_762x51_Box_Tracer", 5];
	_unit addWeapon "LMG_Zafir_F";
	};
	case 7:
	{
	_unit addBackpack "B_Carryall_ocamo";
	_unit addMagazines ["16Rnd_9x21_Mag", 6];
	_unit addMagazines ["RPG32_F", 5];
	_unit addWeapon "hgun_Rook40_F";
	_unit addWeapon "launch_RPG32_F";
	};
};

_unit addMagazine "HandGrenade";

Share this post


Link to post
Share on other sites
try that...

init.sqf

if  !(isServer) then 
{

 {
  if (side _x == opfor) then 
  {
  nil1 = [_x] execVM "civguise.sqf";  
  };
 }forEach allunits;


}; 

civguise.sqf


_unit = _this select 0;


hint "disguise called";

_civ_clothes = ["U_IG_Guerilla1_1",
"U_IG_Guerilla2_1",
"U_IG_Guerilla2_2",
"U_IG_Guerilla2_3",
"U_IG_Guerilla3_1",
"U_IG_Guerilla3_2",
"U_IG_leader"];

_civ_hats = ["H_Shemag_khk",
"H_Shemag_tan",
"H_Shemag_olive"];

_vests = ["V_Rangemaster_belt",
"V_TacVest_brn",
"V_BandollierB_cbr"];




// Remove original equipment
removeAllWeapons _unit;
removeUniform _unit;
removeHeadgear _unit;
removeVest _unit;
removeBackpack _unit;
_unit unassignItem "NVGoggles_OPFOR";
_unit removeItem "NVGoggles_OPFOR";


// Add vest and clothing
_vest_item = _vests call BIS_fnc_selectRandom;
_unit addVest _vest_item;

_cloth_item = _civ_clothes call BIS_fnc_selectRandom;
_unit addUniform _cloth_item;


// Random integer, if 1 instead of 0, add a random item from the array
if(round (random 1) == 1) then
{

_hat_item = _civ_hats call BIS_fnc_selectRandom;
_unit addHeadgear _hat_item;
};

// Random weapon loadout
switch (round(random 7)) do
{
	case 0:
	{
	_unit addMagazines ["30Rnd_556x45_Stanag", 8];
	_unit addWeapon "arifle_TRG20_F";
	};
	case 1:
	{
	_unit addMagazines ["30Rnd_65x39_caseless_green", 8];
	_unit addWeapon "arifle_Katiba_F";
	};
	case 2:
	{
	_unit addMagazines ["30Rnd_556x45_Stanag", 8];
	_unit addWeapon "arifle_TRG20_F";
	};
	case 3:
	{
	_unit addMagazines ["30Rnd_65x39_caseless_green", 8];
	_unit addWeapon "arifle_Katiba_F";
	};
	case 4:
	{
	_unit addMagazines ["30Rnd_556x45_Stanag", 8];
	_unit addWeapon "arifle_TRG20_F";
	};
	case 5:
	{
	_unit addMagazines ["30Rnd_65x39_caseless_green", 8];
	_unit addWeapon "arifle_Katiba_F";
	};
	case 6:
	{
	_unit addBackpack "B_FieldPack_ocamo";
	_unit addMagazines ["150Rnd_762x51_Box_Tracer", 5];
	_unit addWeapon "LMG_Zafir_F";
	};
	case 7:
	{
	_unit addBackpack "B_Carryall_ocamo";
	_unit addMagazines ["16Rnd_9x21_Mag", 6];
	_unit addMagazines ["RPG32_F", 5];
	_unit addWeapon "hgun_Rook40_F";
	_unit addWeapon "launch_RPG32_F";
	};
};

_unit addMagazine "HandGrenade";

Still doesn't work. NO clothe and weapons wrong

Share this post


Link to post
Share on other sites

the script is called on a dedicated server - tested and works - what you seem to have a problem with is the actual clothing working....

this is as Kuskluk stated - i dont think you can use the uniforms on the opposite team. therefore best suggestion is to switch a player to a civilian unit, but that is a bit more complex.

Share this post


Link to post
Share on other sites

You can use uniforms of a different team if you assign them with a script. I do this in DTAS.

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  

×