Jump to content
Sign in to follow this  

Recommended Posts

so I was gonna write an if statement in a trigger, or maybe a script file and just call it in the trigger but cant seem to get it to work.

I have a trigger that does "alpha_clear=true" once all of the opfor are dead, but stays "alpha_clear=false" if opfor are still present.

So the trigger I want to make would do: player sidechat "OPFOR still alive!" if alpha_clear=false and: player sidechat "OPFOR have been eliminated!" if alpha_clear=true.

I write a lot in C++ so I figured it would be somwhat the same, but doesnt seem to wanna work. This is what I tried.

if(alpha_clear = false)

{

player sidechat "OPFOR still alive"

}

else if(alpha_clear = true)

{

player sidechat "OPFOR have been eliminated!"

}

Share this post


Link to post
Share on other sites

Thanks ghost I used that as a reference and came up with this... though it says "Missing )"

if (alpha_clear=false) then {player sideChat "Not clear"} else {player sideChat "All Clear"};

I then put it in an .SQF file called "secure.sqf" and in the trigger activation did [] exec "secure.sqf"

and still it doesnt work. it never shows anything in player side chat.

Edited by GunnDawg09

Share this post


Link to post
Share on other sites
Thanks ghost I used that as a reference and came up with this... though it says "Missing )"

if (alpha_clear=false) then {player sideChat "Not clear"} else {player sideChat "All Clear"};

I then put it in an .SQF file called "secure.sqf" and in the trigger activation did [] exec "secure.sqf"

and still it doesnt work. it never shows anything in player side chat.

That looks fine but I like to put ; after each statment i.e.

player sidechat "not clear";

I believe its needed but you would have to double check that.

Share this post


Link to post
Share on other sites

are you suggesting this?

if (alpha_clear=false) then {player sideChat "Not clear";} else {player sideChat "All Clear";};

Share this post


Link to post
Share on other sites

yes. Thats the only thing I see that may be wrong. But then again I am tired and learning scripting myself.

Share this post


Link to post
Share on other sites

if (!alpha_clear) then {player sideChat "Not clear";} else {player sideChat "All Clear";}

Xeno

Share this post


Link to post
Share on other sites
if (!alpha_clear) then {player sideChat "Not clear";} else {player sideChat "All Clear";}

Xeno

dont forget the ; at the end....

Share this post


Link to post
Share on other sites
dont forget the ; at the end....

Not needed in a trigger activation field as long as you don't add code behind it.

Xeno

Share this post


Link to post
Share on other sites
Not needed in a trigger activation field as long as you don't add code behind it.

Xeno

good to know thanks

Share this post


Link to post
Share on other sites
so I was gonna write an if statement in a trigger, or maybe a script file and just call it in the trigger but cant seem to get it to work.

I have a trigger that does "alpha_clear=true" once all of the opfor are dead, but stays "alpha_clear=false" if opfor are still present.

So the trigger I want to make would do: player sidechat "OPFOR still alive!" if alpha_clear=false and: player sidechat "OPFOR have been eliminated!" if alpha_clear=true.

I write a lot in C++ so I figured it would be somwhat the same, but doesnt seem to wanna work. This is what I tried.

if(alpha_clear = false)

{

player sidechat "OPFOR still alive"

}

else if(alpha_clear = true)

{

player sidechat "OPFOR have been eliminated!"

}

If you are used to C++, look at that page : http://community.bistudio.com/wiki/Control_Structures

From what I get, SQS is now deprecated in favor of SQF, which looks a lot more like C++ than the SQS.

Your script then looks like this.

if(!alpha_clear) then
{
  player sidechat "OPFOR still alive";
}
else
{
  player sidechat "OPFOR have been eliminated!";
};

From what I can see, there is NO if, else if structures. You will have to go with nested if, else statements.

Edited by The_Angry_Canadian
To reflect Xeno precision about == vs =

Share this post


Link to post
Share on other sites

I'd suggest Xeno's version with "! boolean", but just for the detail:

alpha_clear = false, this is assigning false to your variable

alpha_clear == false, this is checking if variable is false.

Share this post


Link to post
Share on other sites
ODEN;1358388']

alpha_clear == false' date=' this is checking if variable is false.[/quote']

Doesn't work in ArmA.

Either a boolean variable is true or false, no need to check against false or true :)

A boolean variable allready mets a condition.

!alpha_clear

or

alpha_clear

Xeno

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  

×