Jump to content
Sign in to follow this  
scajolly

An "Exist" variable? Does it exist?

Recommended Posts

Okay, I just made a huge f* mistake.

Probability of Presence, if set to 100% for a variable MAN, will of course yield "alive MAN = true" so long as he's not destroyed.

Probability of Presence, if set to 0%, yields nothing in the bloody world.

Is there a command with which I can check whether or not something exists? Say I have the aforementioned MAN, what can I place in his INIT, and call in another unit's condition field, that will check that he either exists or does not exist?

PLEASE HELP :(

Share this post


Link to post
Share on other sites

Thank you, Kondor!

I just tried to edit the Condition lines in my .sqm (to rectify a far-ranging error on my part about !alive). The game crashed when trying to load the mission. Is a " in a condition line, in the sqm, a source for problems?

---------- Post added at 08:07 PM ---------- Previous post was at 07:53 PM ----------

Worked it out. If you enter the SQM to make changes, an in-game " is an in-editor ""

Share this post


Link to post
Share on other sites

If you aren't advanced mission maker you shouldn't manualy edit sqm file but via editor.

Yes " could be a problem. It's not trivial to put " inside a string. The easiest way to fix it is using ' instead of ".

Share this post


Link to post
Share on other sites
If you aren't advanced mission maker you shouldn't manualy edit sqm file but via editor.

Yes " could be a problem. It's not trivial to put " inside a string. The easiest way to fix it is using ' instead of ".

The scripting system supports VB's way of escaping quotes... Use "" inside quotes.

onMapSingleClick "player setPos getMarkerPos ""marker1""";

Share this post


Link to post
Share on other sites

As said, quotes inside quotes need special treatment. When you just type it in the editor the game deals with this for you in this special case.

isNil "VARNAME" checks if VARNAME has been defined. Once you give unit name VARNAME or once you run a command such as VARNAME = ... the isNil "VARNAME" will change from true to false. So be careful when using it, it doesn't necessarily check if the unit exists or not.

Share this post


Link to post
Share on other sites
As said, quotes inside quotes need special treatment. When you just type it in the editor the game deals with this for you in this special case.

isNil "VARNAME" checks if VARNAME has been defined. Once you give unit name VARNAME or once you run a command such as VARNAME = ... the isNil "VARNAME" will change from true to false. So be careful when using it, it doesn't necessarily check if the unit exists or not.

Oh, thanks for the heads up. Just to clarify, can you tell me if the following will not result in isNil "VARNAME" being true:

A trigger activates at t=0, condition "this AND isNil "VARNAME"

B trigger is set to activate at t=1, condition "this AND isNil "VARNAME"

VARNAME has not changed value after trigger A, has it? Trig A is simply a passive check. In a Schrödinger's Cat-like IT existensialist situation, we have not confirmed VARNAME to be TRUE just because we checked that it was FALSE?

Oh God this is getting philosophical.

Share this post


Link to post
Share on other sites

i am making a campaign and wanted to only allow units to spawn if they didnt die in the previous mission(s) and i set up a variable and i even got a hint saying "it works" that is activated by the exact same condtion of presence of a soldier and yet the soldier still wont spawn. Can somebody please help me.

---------- Post added at 19:15 ---------- Previous post was at 19:10 ----------

wait i think i got it, check if a unit is dead and only if they are then define the variable;)

---------- Post added at 19:24 ---------- Previous post was at 19:15 ----------

nope ot working, halp pleeease:(

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  

×