Jump to content
Sign in to follow this  
kuwahara<ANZAC>

how? to add an "if this/than that" to a script?

Recommended Posts

im a script noob and have VERY limited knolage on scripting.

can someone please help me add a condition to this script if its possible?

what i am hoping to do is:

run this on init>

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_injured = _this select 0

_injured setCaptive true

_injured switchMove "AdthPknlMstpSrasWlnrDnon_1"

_injured DisableAI "move"

_injured SetDammage 0.8

removeAllWeapons _injured

_injured addAction ["ACTIONTEXT", "scriptname.sqs"]

the condition i want is>

i dont want the 'add action' visable untill a trigger sets T1=true

im not even sure if its posable.. plz help me.. crazy_o.gif

Share this post


Link to post
Share on other sites

This is forum is about "OFP mission editing & scripting"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@(condition)

will halt the script until condition returns true, then continue onto the next line.

This might or might not work for ArmA. If not, look into waitUntil.

Your topic title asks about if/then condition, which is not quite what you are after, but obviously possible. Good Luck smile_o.gif

Share this post


Link to post
Share on other sites

i wanted to know, does @ mean condition of presence? PLEASE TELL ME YES. yea cuz i have been wondering since I first got into basic editing... pistols.gifhelp.gif

Share this post


Link to post
Share on other sites

No. @ is a script command. It has nothing to do with condition of presence.

@ will halt the script until the condition in the brackets afterward returns true. I'm not sure how often it checks or if it will stop waiting after a given time (and if so what happens).

example :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;myScript.sqs

_object = _this select 0

@((_object distance player) =< 100)

player setDamage 1

this script will kill the player when he gets within 100 meters of the object passed to the script.

Share this post


Link to post
Share on other sites

Usually when the precision isn't neccessary, you should use a loop instead of @ because @ checks the condition as fast as it can, like every frame or maybe even faster. With slow loops the condition will use much less cpu as in:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_object = _this select 0

#wait

~2

?(_object distance player) > 100: goto "wait"

player setDamage 1

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  

×