I am trying to figure out how to use if/then statements in scripts. The following script is what I am using to randomly position a man on the island for a search and rescue mission.
_start = random 4;
?_start<1 :goto "P1";
?_start<2 :goto "P2";
?_start<3 :goto "P3";
?_start<4 :goto "P4";
#P1
_pos = [13452, 15159, 0];
_radius = 300;
_pos = [(_pos select 0)+_radius/2-random _radius,(_pos select 1)+_radius/2-random _radius, _pos select 2];
_this setPos _pos;
exit;
#P2
_pos = [12517, 15952, 0];
_radius = 350;
_pos = [(_pos select 0)+_radius/2-random _radius,(_pos select 1)+_radius/2-random _radius, _pos select 2];
_this setPos _pos;
exit;
#P3
_pos = [12784, 15294, 0];
_radius = 250;
_pos = [(_pos select 0)+_radius/2-random _radius,(_pos select 1)+_radius/2-random _radius, _pos select 2];
_this setPos _pos;
exit;
#P4
_pos = [14224, 14689, 0];
_radius = 200;
_pos = [(_pos select 0)+_radius/2-random _radius,(_pos select 1)+_radius/2-random _radius, _pos select 2];
_this setPos _pos;
exit;
I have added a 'addAction' in my player init line allowing me to reposition myself randomly using the same script. When I attempt to test the mission, the missing man is successfully placed in one of the four areas. However, if I attempt to reposition myself, the game immediately crashes. I managed to get a basic radio DF script working this afternoon but I had a lot of problems with the if/then statement in that script as well, which is why I am presuming that the if/then is where the problem is in the above script. I have not been able to find very much information on if/then statements in the forums and I would appreciate any assistance offered.