Jump to content
Sign in to follow this  
hellstorm77

help with a script error

Recommended Posts

i was wondering if someone could help me with a script error im getting

_max = (count _allunits) - 1;
_skill = 1 + log(mps_mission_factor/4);

for "_j" from 1 to _strength do {
_unit = _Grp createUnit [_allunits select (round random _max),_spawnpos,[],0,"NONE"];
_unit setSkill _skill;
_unit allowFleeing 0;
};

if(_patrol) then {[_Grp,_spawnpos,_movetype] spawn mps_patrol_init;};

error

Error in expression <do {
_unit = _Grp createUnit [_allunits select (round random _max),_spawnpos,[],>
 Error position: <select (round random _max),_spawnpos,[],>
 Error Zero divisor
File C:\Users\Liverpool\Documents\Arma 3 - Other Profiles\Hellstorm77\missions\mps\func\mps_func_spawn_opforsquad.sqf, line 55
Error in expression <" from 1 to _strength do {
_unit = _Grp createUnit [_allunits select (round rand>
 Error position: <createUnit [_allunits select (round rand>
 Error Type Any, expected String
File C:\Users\Liverpool\Documents\Arma 3 - Other Profiles\Hellstorm77\missions\mps\func\mps_func_spawn_opforsquad.sqf, line 55
Error in expression <" from 1 to _strength do {
_unit = _Grp createUnit [_allunits select (round rand>
 Error position: <createUnit [_allunits select (round rand>
 Error Type Any, expected String

Share this post


Link to post
Share on other sites

Is local variable _allunits defined? Maybe you wanted to use script command allUnits?

Share this post


Link to post
Share on other sites

I think this is it

switch _type do{
case "INF": {_allunits = mps_opfor_inf};
case "INS": {_allunits = mps_opfor_ins};
case "TARGET" : {_allunits = mps_opfor_leader};
default {_allunits = mps_opfor_inf};

Share this post


Link to post
Share on other sites

If _allunits is defined only inside that switch case then it won't exist anywhere but in it.

Share this post


Link to post
Share on other sites

Pretty much a guessing game without the rest of the code hellstorm.

The only reference i can find for this particular code is THIS. So what is the mps_opfor_inf/ins/leader in what ever else of this code you have implemented? If these are not defined then you are going to get ANY returned from the selection, giving you the error you are seeing.

Share this post


Link to post
Share on other sites
Pretty much a guessing game without the rest of the code hellstorm.

The only reference i can find for this particular code is THIS. So what is the mps_opfor_inf/ins/leader in what ever else of this code you have implemented? If these are not defined then you are going to get ANY returned from the selection, giving you the error you are seeing.

Does this command: private "_allunits";

at the top of the script initiate the variable properly?

Share this post


Link to post
Share on other sites

I'm wondering if someone can help me with \ca\ui\data\igui_background_addrecord_ca.paa its a arma 2 igui i was wondering what arma 3 igiu's are

class controlsBackground {
	class Mainback : HW_RscPicture {
		idc = 0;
		x = 0.042;
		y = 0.101;
		w = 1.0;
		h = 0.836601;
		text = "\ca\ui\data\igui_background_addrecord_ca.paa";
	};

Edited by hellstorm77

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  

×