Jump to content
Sign in to follow this  
squeeze

Problem with Arrays and loaded saved game.

Recommended Posts

if Array1 = Array2 changing either will change the other since they both point to Array1.

But I've found when you load a saved game changing Array2 dosen't change either Array1 or Array2, is this a bug or will it be fixed in the future.

using the set command to change array2

Array2 set[0,(Array2 select 0) + 1];

sample missions, works like you would expect, when loaded from saved game radio Bravo dosen't work, unless you use radio Alpha first.

Share this post


Link to post
Share on other sites

Where i must paste that , in command channel? if yes , this don't work

Array2 set[0,(Array2 select 0) + 1];

Edited by Stalker15

Share this post


Link to post
Share on other sites

Things like pointers get lost with saved games. Saving just writes the content of a variable to a text file.

One way round it is to add checks for a restored saved game into your code. The most vulnerable scripts are those that have loops running for any amount of time, or large scripts that contain a few sleep or While, forEach loops e.t.c

In Arma the Time command was reset once a saved game was loaded. So in your case you can grab the Time into a local variable. Then in your loops and after each Sleep command, do this:

_Blah=_This Select 0;

//Grab the scripts start time
_StartTime=Time;

Sleep 10;

//Restore the array pointers
If (Time<_StartTime) Then
{
Array1 = Array2;
_StartTime=Time;
};

//Do something with the new array pointer
Array2 set[0,(Array2 select 0) + 1];

Hint Str (Array1 Select 0);
[/Code]

Edited by UNN

Share this post


Link to post
Share on other sites

Sorry , i don't understand this, im not scripter , so where i paste it? and what's name have file with amount start money???

Edited by Stalker15

Share this post


Link to post
Share on other sites

Not sure about this issue you are claiming (didn't run test) but you are always outputting the value of Array1 twice, rather than each of the separate arrays, which is misleading:

player sideChat format ["Array1 = %1  Array2 = %1", Array1, Array2]

It should be:

player sideChat format ["Array1 = %1  Array2 = %2", Array1, Array2]

Edited by Spooner

Share this post


Link to post
Share on other sites

lo,l here I was thinking saved games was a new feature in arma2 and looking for a new command, guess I paid the price for not having single player as part of my vocaublary......thanks UNN

Share this post


Link to post
Share on other sites

bummer "time" and "servertime" are saved in Arma2.

Since nothing worked until I changed a "waituntil" to a "@" in the jip code in init.sqs I think

I may need to check if all players are null then array1 = array2.

there is a bis function for this, I'll try this next weekend.

Share this post


Link to post
Share on other sites

waitUntil is an SQF command, whereas @ is the equivalent command in SQS. SQS is obsolete, so I'd avoid it as much as possible.

Share this post


Link to post
Share on other sites
lo,l here I was thinking saved games was a new feature in arma2

Well multiplayer saves are new...I think? JIP adds a whole new dimension to.

Since nothing worked until I changed a "waituntil" to a "@" in the jip code in init.sqs

Init.sqs and init.sqf, along with AddAction script names. Are two of the few cases where the file extension you use dictates the expected script format. If you use init.sqf then the WaitUntil command will work ok.

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  

×