Results 1 to 9 of 9

Thread: Problem with Arrays and loaded saved game.

  1. #1

    Problem with Arrays and loaded saved game.

    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
    Code:
    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.
    1 IQ away from licking windows, drooling since 1966.

  2. #2
    Private First Class
    Join Date
    May 19 2009
    Location
    Poland , Chelm
    Posts
    20
    Where i must paste that , in command channel? if yes , this don't work
    Code:
    Array2 set[0,(Array2 select 0) + 1];
    Last edited by Stalker15; Jun 15 2009 at 20:58.

  3. #3
    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:

    Code:
    _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);
    Last edited by UNN; Jun 15 2009 at 21:49.

  4. #4
    Private First Class
    Join Date
    May 19 2009
    Location
    Poland , Chelm
    Posts
    20
    Sorry , i don't understand this, im not scripter , so where i paste it? and what's name have file with amount start money???
    Last edited by Stalker15; Jun 15 2009 at 22:57.

  5. #5
    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:
    Code:
    player sideChat format ["Array1 = %1  Array2 = %1", Array1, Array2]
    It should be:
    Code:
    player sideChat format ["Array1 = %1  Array2 = %2", Array1, Array2]
    Last edited by Spooner; Jun 15 2009 at 22:43.
    CBA: Community Base Addons for A2
    DevHeaven: development unraveled!
    SPON scripts/addons (A1) | Roller island tool (OFP -> A1)
    OFPEC: The editing center (for OFP, A1 and A2)

  6. #6
    Staff Sergeant Squ33z3's Avatar
    Join Date
    Oct 26 2005
    Location
    Melbourne Zoo
    Posts
    211
    Author of the Thread
    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

  7. #7
    Staff Sergeant Squ33z3's Avatar
    Join Date
    Oct 26 2005
    Location
    Melbourne Zoo
    Posts
    211
    Author of the Thread
    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.

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

  9. #9
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •