Jump to content
BeaniePope.

Error with code, syntax most likely

Recommended Posts

There's a stackoverflow post with this same question if you want better readability, here https://stackoverflow.com/questions/74280551/error-on-activation-select-type-nothing-expected-array-string-config-entry


But anyway, whenever I try to run this code from a trigger
 

private _all_freedom_units = ["B_FRD_Freedomer_Patrolman_01","B_FRD_Freedomer_Sniper_01", "B_FRD_Freedomer_Exo_1", "B_FRD_Freedomer_Warrior_01", "B_FRD_Freedomer_SEVA_01", "B_FRD_Freedomer_Gaurdian_01", "B_FRD_Freedomer_Seva_II_01"]; 

private _final_pos = [0,0,0]; 
private _position_player = [0, 0, 0]; 
_direction = getDir player; 
if (_direction > 0 and _direction < 90) then {cardinal_direction = "North";}; 
if (_direction > 90 and _direction < 180) then {cardinal_direction = "South";}; 
if (_direction > 180 and _direction < 250) then{cardinal_direction = "South";}; 
if (_direction > 250 and _direction < 359) then{cardinal_direction = "North";}; 
 
_position_player = getPos player; 
_position_player_x =  _position_player select 0; 
_position_player_y =  _position_player select 1; 
 
if (cardinal_direction == "North") then{  
 _random_x = [250, 500] call BIS_fnc_randomInt; 
 _random_y = [250, 500] call BIS_fnc_randomInt; 
 _final_pos set [0 , _position_player_x + 200 + _random_x]; 
 _final_pos set [1 , _position_player_y + 200 + _random_y]; 
}; 
if (cardinal_direction == "South") then{ 
 _random_x = [-250, -500] call BIS_fnc_randomInt; 
 _random_y = [-250, -500] call BIS_fnc_randomInt; 
 _final_pos set [0 , _position_player_x + _random_x]; 
 _final_pos set [1 , _position_player_y + _random_y]; 
}; 
 
_position = _final_pos;    
    
_group_freedom_patrol = createGroup [west, true];   
 
hint str _final_pos select 0; 
 
_random_number = floor random 5;

The trigger throws an error: On Activation: Select: Type Nothing, expected Array,String,Config entry and I suspect the affected code piece is

 

_position_player = getPos player; 
_position_player_x =  _position_player select 0; 
_position_player_y =  _position_player select 1; 

since it says select in the error, but I don't know. Any help is good, thank you!




 

Share this post


Link to post
Share on other sites
1 hour ago, BeaniePope. said:

hint str _final_pos select 0;

hint str _final_pos, ok it can do that. The command hint returns nothing.

Nothing select 0, is an error.

hint str (_final_pos select 0);

 

Share this post


Link to post
Share on other sites
12 minutes ago, Larrow said:

hint str _final_pos, ok it can do that. The command hint returns nothing.

Nothing select 0, is an error.


hint str (_final_pos select 0);

 

I feel like an idiot not seeing that- not even supposed to be in there. Thank you so much!

Share this post


Link to post
Share on other sites
Spoiler

private _all_freedom_units = ["B_FRD_Freedomer_Patrolman_01","B_FRD_Freedomer_Sniper_01", "B_FRD_Freedomer_Exo_1", "B_FRD_Freedomer_Warrior_01", "B_FRD_Freedomer_SEVA_01", "B_FRD_Freedomer_Gaurdian_01", "B_FRD_Freedomer_Seva_II_01"]; 

private _direction = getDir player;
private _position_player = getPos player;

_random_xyz = [ [250, 500] call BIS_fnc_randomInt, [250, 500] call BIS_fnc_randomInt, 0 ];

private _final_pos = if ( _direction > 90 && _direction < 270 ) then {
	//South
	_position_player vectorDiff _random_xyz;
}else{
	//North
	( _position_player vectorAdd _random_xyz ) vectorAdd[ 200, 200, 0 ];
};

private _group_freedom_patrol = createGroup [west, true];   
 
hint str _final_pos;

 

 

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

×