Jump to content
Sign in to follow this  
JacobJ

If statement problem (condition issue)

Recommended Posts

Here is a bit of a script I have found and tweaked a bit:

waitUntil {!isNull player};

// Array of markers pre placed in the editor at diffrent locations.

_markers1 = ["balota", "kozlovka", "nadezhdino","mogilevka","pusta","elektrozavodsk"];

/// Pick some random positions to put the hummer
   _pos1 = (getmarkerPos (_markers1 select (floor(random(count _markers1)))));

// Move the hummer to this random position        
humrescue setPos _pos1;

if (_pos1 == (getmarkerpos (_markers1 select 5))) then {
humrescue setTriggerArea [500, 500, 0, false];
};

The problem is, that I can't get the if statement to work. I what it to check (have the condition) that when _pos1 is elektrozavodsk it sets the triggerarea larger.

But what I have there doesnt work. I thought I just could put _markers1 select 5 into the condition ()'s but that didnt work either.

What can I do to make it happen?

/Jacob

Edited by JacobJ
Forgot the title

Share this post


Link to post
Share on other sites

because you cannot compare a array to another one, you can however get distance and compare that.

and i ofc asume that humrescue is a trigger not a hummer..... if not then the triggername needs to be fixed.

waitUntil {!isNull player};

// Array of markers pre placed in the editor at diffrent locations.
_markers1 = ["balota", "kozlovka", "nadezhdino","mogilevka","pusta","elektrozavodsk"];

/// Pick some random positions to put the hummer
_pos1 = (getmarkerPos (_markers1 select (floor(random(count _markers1)))));

// Move the hummer to this random position        
humrescue setPos _pos1;

if ( [b](_pos1 distance (getmarkerpos "elektrozavodsk")) == 0[/b] ) then {
humrescue setTriggerArea [500, 500, 0, false];
};

Share this post


Link to post
Share on other sites

Arh okay I see. So arrays can't be compared, that I will have to remember.

I see the logic in your solution and of course your solution works as it should!

Thanks

ps. the humrescue is a trigger.

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  

×