dum3d0 11 Posted February 20, 2015 Hi, I'm trying to make some civilian hostages wear a blufor uniform in a coop mission. My civilian are called p1, p2 to p6 this code in civilian named p5 init is working (code is not mine I found a similar one in a old post here) nul = p5 spawn {sleep 1; removeAllWeapons p5; removeAllItems p5; removeAllAssignedItems p5; removeUniform p5; removeVest p5; removeBackpack p5; removeHeadgear p5; p5 addUniform "U_B_CombatUniform_mcam_vest";}; Sleep 1 is there because otherwise script don't remove civilan headgear (don't ask me why) But I would like something simple in unit init so I created an sqf file called civload.sqf this sleep 1; removeAllWeapons this; removeAllItems this; removeAllAssignedItems this; removeUniform this; removeVest this; removeBackpack this; removeHeadgear this; this addUniform "U_B_CombatUniform_mcam_vest"; and I call it from every unit init with this: [this] call compile preprocessFileLineNumbers "scripts\equip\civload.sqf" and I got this error: 'this |#|sleep 1;' error ; missing If I don't use sleep 1 in civload.sqf I don't have the error but the civilian have his random hat if I use null = execVM "scripts\equip\civload.sqf"; I got a different error, too long to remember.. Any suggestion? tnx Share this post Link to post Share on other sites
jshock 513 Posted February 20, 2015 Firstly in the following line it's not "this sleep 1;" it's just "sleep 1;": this sleep 1; //should be sleep 1; Secondly it's a local variable "_this" within the .sqf file: sleep 1; removeAllWeapons _this; removeAllItems _this; removeAllAssignedItems _this; removeUniform _this; removeVest _this; removeBackpack _this; removeHeadgear _this; _this addUniform "U_B_CombatUniform_mcam_vest"; Share this post Link to post Share on other sites
dum3d0 11 Posted February 21, 2015 (edited) Tnx, and should I use null = execVM "scripts\equip\civload.sqf"; or [this] call compile preprocessFileLineNumbers "scripts\equip\civload.sqf"; to run the script file from civilian init? EDIT: Both give me errors (trying to translate from Italian): null = execVM "scripts\equip\civload.sqf"; return this error: Error variable not defined in expression: _this [this] call compile preprocessFileLineNumbers "scripts\equip\civload.sqf"; return this error: Error removeallweapons matrix type object expected In the meantime, I found this working but I still need to punt in each civlian init and it's too much code for this little box null = this spawn {sleep 1; removeHeadgear _this; removeGoggles _this;_this addUniform "U_B_CombatUniform_mcam_vest"}; Edited February 21, 2015 by DuM3D0 Share this post Link to post Share on other sites
jshock 513 Posted February 21, 2015 Your execVM line needs to be: 0 = [this] execVM "scripts\equip\civload.sqf"; Share this post Link to post Share on other sites
dum3d0 11 Posted February 22, 2015 Your execVM line needs to be: 0 = [this] execVM "scripts\equip\civload.sqf"; no, error again in line 2 error removeAllWeapons: Matrix type, object expected civload.sqf sleep 1; removeAllWeapons _this; removeAllItems _this; removeAllAssignedItems _this; removeUniform _this; removeVest _this; removeBackpack _this; removeHeadgear _this; removeGoggles _this; _this addUniform "U_B_CombatUniform_mcam_vest"; Share this post Link to post Share on other sites
jshock 513 Posted February 22, 2015 Hmm, try this: removeAllWeapons (_this select 0); I've never seen that error to be honest. Share this post Link to post Share on other sites
dum3d0 11 Posted February 22, 2015 Maybe I don't traslate good from Italian to english or worse Italian traslation of the game is really bad.. I'll give a try with your last code and let you know Share this post Link to post Share on other sites
giallustio 770 Posted February 22, 2015 the last should work. You're executing the script with an array of parameters [this], so should be _this select 0 in the script. If you use the code more than few times it's better to load it as fnc Share this post Link to post Share on other sites
jshock 513 Posted February 22, 2015 Maybe I don't traslate good from Italian to english or worse Italian traslation of the game is really bad..I'll give a try with your last code and let you know You know, I just read past the parts about you translating it, I didn't even think that the errors would be in Italian as well :p, and putting some thought into it a "matrix" is basically an array so yeah it should work. TBH I would just assign (_this select 0) to a variable and replace each instance of "_this" with that variable name, would ensure it all works everytime. Share this post Link to post Share on other sites
dum3d0 11 Posted February 22, 2015 I'll give it a try and let you know. Tnx. Share this post Link to post Share on other sites
L3TUC3 32 Posted February 28, 2015 p5 addUniform "U_B_CombatUniform_mcam_vest"; Should be: p5 forceAddUniform "U_B_CombatUniform_mcam_vest"; Adduniform has restrictions primarily based on side. forceAdduniform does not. Share this post Link to post Share on other sites