Home   Help Search Login Register  

Author Topic: save game causing issues  (Read 3402 times)

0 Members and 1 Guest are viewing this topic.

Offline sharkattack

  • Former Staff
  • ****
save game causing issues
« on: 28 May 2007, 17:46:02 »
hi ..
have noticed a few things when starting from a save point in single play missions
ie  doors set to locked  are open  ...
i seen in the wiki  the following

Quote
Not to be confused with _time. Within a script, the reserved local variable _time returns the time elapsed since the script started running. Note that the value of time is not saved when the mission is saved and so will be reset to zero when a mission is restarted from a saved position. The value of _time is saved correctly and will resume from where it was.


can anyone  shed some light on how and where to use this command ...  might fix my problem ... :good:
"HOLY SARDINE" - see Shark-Attack meet his match

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: save game causing issues
« Reply #1 on: 28 May 2007, 17:59:57 »
What command are you talking about?

Offline sharkattack

  • Former Staff
  • ****
Re: save game causing issues
« Reply #2 on: 28 May 2007, 18:54:23 »
_time  i think ...
to be honest  wiki entry has me puzzled ... again ...

all i know  is that if i run a mission from save point i notice problems  like  doors open  which should be shut
units  not in there correct positions ...   :dunno:

"HOLY SARDINE" - see Shark-Attack meet his match

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: save game causing issues
« Reply #3 on: 28 May 2007, 18:58:25 »
Well, _time is not a command but an special variable that stores the time since game started, but, at least in OFP, its value was reset after loading a game.

It is much better to use dayTime, which gives you the real clock time.

Offline sharkattack

  • Former Staff
  • ****
Re: save game causing issues
« Reply #4 on: 28 May 2007, 19:06:15 »
So where and when  would i use this variable
please  forgive my ignorance ... but i never encountered this before ...
and  locked doors and unit pos are vital to mission ...

all i see is   _timeofday = daytime
where do i put this     ???


again many thanx  mate
« Last Edit: 28 May 2007, 19:17:31 by shark attack »
"HOLY SARDINE" - see Shark-Attack meet his match

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: save game causing issues
« Reply #5 on: 28 May 2007, 19:15:59 »
Dont know about doors or positions issues with savegame.
About time functions, as any other, you may use them if needed, for example, to check the current time, or time elapsed, etc.

For example, the following code will do something for the following two minutes, and it should be resistant to savegames/loadgame

Code: [Select]
// current time in seconds,
_timeini = dayTime * 3600;

while {dayTime * 3600 < (_timeini + 120)} do
{

};

Offline sharkattack

  • Former Staff
  • ****
Re: save game causing issues
« Reply #6 on: 28 May 2007, 19:26:24 »
i dont get it mate ...
from bi forums
Quote
You can detect the savestatus with the time command. When a saved game is loaded the time variable resets.
read the Hardrocks comment on the wiki :

hardrocks comment
Quote
Not to be confused with _time. Within a script, the reserved local variable _time returns the time elapsed since the script started running. Note that the value of time is not saved when the mission is saved and so will be reset to zero when a mission is restarted from a saved position. The value of _time is saved correctly and will resume from where it was.

« Last Edit: 28 May 2007, 19:28:12 by shark attack »
"HOLY SARDINE" - see Shark-Attack meet his match

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: save game causing issues
« Reply #7 on: 28 May 2007, 19:31:31 »
Ah, now I understand your "problem".
You may check time to see "if" a game has been "recovered" (loaded), If time is close to 0.

Offline sharkattack

  • Former Staff
  • ****
Re: save game causing issues
« Reply #8 on: 28 May 2007, 19:35:05 »
can  you teach me how to do this      please
i havnt a clue   ???

again  many thanks   :P
"HOLY SARDINE" - see Shark-Attack meet his match

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: save game causing issues
« Reply #9 on: 28 May 2007, 20:23:36 »
Code: [Select]
// CheckLoad.sqf
Sleep 1;
while {true} do
{
   if (time < 3) then
   {
      hint "Game just loaded or started";
      Sleep 5;
   };
   Sleep 1;
};

put it in your init.sqs
Code: [Select]
[]execVM"CheckLoad.sqf"

Offline sharkattack

  • Former Staff
  • ****
Re: save game causing issues
« Reply #10 on: 01 Jun 2007, 19:09:45 »
sorry mate  i still dont get it ..
have  noticed also  that  upon  loading  a saved game  the time of day  seems  to change ... things become a lot  darker  ???
"HOLY SARDINE" - see Shark-Attack meet his match

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: save game causing issues
« Reply #11 on: 01 Jun 2007, 19:41:35 »
sharky, my pointy-toothed fiend,

The issues you describe sound like bona-fide save game bugs.

The code Mandoble has posted above is a script that will detect when a save game is loaded. It does this by monitoring the value of the special variable time, which is the number of seconds playing the current mission. When you load a savegame is resets back to 0.

The special variable _time is local to a script and holds the number of seconds a script has been running. Each script you run has its own value for _time since each script has most likely been running for a different duration. The _time variable keeps its value when you save and load a game. That is, when you save game, ArmA stores the status of each running script, including its _time.
« Last Edit: 01 Jun 2007, 19:48:56 by Mr.Peanut »
urp!

Offline sharkattack

  • Former Staff
  • ****
Re: save game causing issues
« Reply #12 on: 01 Jun 2007, 20:22:32 »
fiend  or friend ...  lol
thanx  mate   that  explains  things  perfectly ...   :good:
cheers  :cop:
and  thanx  also  to mandoble   :clap:
« Last Edit: 01 Jun 2007, 20:24:15 by shark attack »
"HOLY SARDINE" - see Shark-Attack meet his match

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: save game causing issues
« Reply #13 on: 06 Jun 2007, 22:39:26 »
On the topic of save games,

I'm trying to use a radio trigger to allow the player to save his game. 

In the activation line i have the usual "Savegame"  and the trigger set to REPEATEDLY.  But that's not saving the game or doing anything it seems.  Anyway else have trouble with that or a solution?  I have a long mission and would like the player to be able to save repeatedly etc. thanks!

Offline Arkon

  • Members
  • *
Re: save game causing issues
« Reply #14 on: 27 Jun 2007, 22:31:40 »
Also on the topic of save games,

I think it may be known that Disabled AI is enabled in save games which of course is a pain - but I have found
that it is also enabled by just saving a game without even loading the saved game!

Just done another test and it seems that it is only when you use waypoints that the AI is affected by saving.

Arkon
« Last Edit: 28 Jun 2007, 03:52:30 by Arkon »