Stoll

if...then...else

5 posts in this topic

Hi folks,

need some help here. I only roughly know what I'm doing and didn't figure out yet how to set up this correctly...

Let's say I want to spawn a bandit either at one or another position and with different facing directions.

So, for the different spawn locations I use:

_spawn1	= [[4985,6605,0],[4986,6609,0]] call BIS_fnc_selectRandom;

I thought I could define something with if...then...else to define the correct direction for each spawn location.
As mentioned I don't know really how to define this the correct way, so I tried so far:

Spoiler

		if(_spawn1 == "4995,6621,0") then
			{
			_unit1 setDir 269.36;
			}
		else
			{
			_unit1 setDir 91.26;
			};

		_spawn1 = if (4985,6605,0) then
			{
			_unit1 setDir 354;
			}
		else
			{
			_unit1 setDir 312.57;
			};

		_spawn1 = if (4985,6605,0) then
			{
			(_unit1) setDir 354;
			}
		else
			{
			(_unit1) setDir 312.57;
			};

 

Getting an RPT Error Missing ) or Error Missing ; -_-
Any help please?

 

 

Share this post


Link to post
Share on other sites
Advertisement

Yo man, that's it!
Thanks! :)

Share this post


Link to post
Share on other sites

You could also do something like this and lose the if statement altogether:

_spawn1	= [[[4985,6605,0],354],[[4986,6609,0],312]] call BIS_fnc_selectRandom;

_position = _spawn1 select 0;
_dir = _spawn1 select 1;

 

Share this post


Link to post
Share on other sites
On 2016-05-28 at 1:03 AM, second_coming said:

You could also do something like this and lose the if statement altogether:


_spawn1	= [[[4985,6605,0],354],[[4986,6609,0],312]] call BIS_fnc_selectRandom;

_position = _spawn1 select 0;
_dir = _spawn1 select 1;

 

i love it, its the small things that makes mods/scripts more efficient! 

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.