Jump to content
Sign in to follow this  
Chris Death

Using numeric variables

Recommended Posts

Today i ran into a problem, when using a numeric variable.

I was using in a waypoint's condition field: det1 == 0

This means, the unit (in my case a gamelogic) expects the

variable "det1" to be at a value of "0".

The condition didn't work. After playing around a little bit,

i figured out: It's important now, to initialize a numeric

variable, by using an init trigger or the init.sqs.

This wasn't required in original OFP. The game could detect

the type of the variable itself earlier. Now you have to tell

the game the type by initializing.

Anyway, initializing variables, before using them is always

the correct method.

~S~ CD

Share this post


Link to post
Share on other sites

Are you sure that this is new.

What I know is that every condition that includes an unitialized variable always returns false. This was already true before Resistance.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">What I know is that every condition that includes an unitialized variable always returns false. This was already true before Resistance<span id='postcolor'>

Not really Spinor

For the reason, it wasn't required before resistance, i sometimes passed the initialisation of variables, and it

worked fine.

For some reason, the game could realize that if the

condition was: variable == value

that this has to be a numeric variable.

The only problem occuring by that was, when using

the same variable as (let's say) boolean on another

part of the mission.

Again however, since this is a requirement for correct

programming anyway, it's not really bothering me.

Just tried to give that info to others, who maybe were

using it.

~S~ CD

Share this post


Link to post
Share on other sites

I have allways had to initialize vars in OFP and OFPR, it you don't you may get unpredicatiable results.

RED

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  

×