Home   Help Search Login Register  

Author Topic: Save the game 5 times  (Read 1581 times)

0 Members and 1 Guest are viewing this topic.

Offline gezegond

  • Members
  • *
Save the game 5 times
« on: 21 May 2010, 19:39:26 »
Question: How to make the player save the game whenever he wants, but only for 5 time.

More Details:
Hi, I had a Quick save feature in one of my missions, which would let you save the game by pressing 0-0-1. I've noticed that this makes the game really easy, since the player saves the game every 5 seconds. So I decided to give the player the ability to save the game, but only 5 times.

1st problem is that, when in single mission, you can press abort and save the game whenever you want, is there a way to stop this?

2nd problem: I created 3 triggers for saving up to 5 times, here they are:
=================================
Trigger 1:

Condition: Radio Alpha Present
On Activation: gosaveit=true
On Deactivation: gosaveit=false
Activate Repeatedly

Trigger 2:

Condition: gosaveit && totalsaves>0
On Activation: saveGame, totalsaves= totalsaves - 1, hint format ["you have %1 saves remaining.", totalsaves], gosaveit=false
Activate Repeatedly

Trigger 3:

Condition: gosaveit && totalsaves<1
On Activation: hint "you've used all your saves! can't save any more!", gosaveit=false
Activate Repeatedly

and finally:

Player's init field: totalsaves=5
=================================
This thing works, I tested it. but sometimes, it just doesn't work. It usually happens when you save the game once, play for 5 to 10 minutes, and then try to save again. When I press 0-0-1, nothing happens, and no message is shown, the game is not saved either.

Got any idea why this happens?

Thanks!
« Last Edit: 21 May 2010, 19:42:51 by gezegond »

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Save the game 5 times
« Reply #1 on: 21 May 2010, 20:16:13 »
Quote
1st problem is that, when in single mission, you can press abort and save the game whenever you want, is there a way to stop this?

I don't think so, but all that save does is let you stop playing, come back to your computer, and come back to where you last left off. I don't believe you can revert back to that point from later in the game.


Quote
This thing works, I tested it. but sometimes, it just doesn't work. It usually happens when you save the game once, play for 5 to 10 minutes, and then try to save again. When I press 0-0-1, nothing happens, and no message is shown, the game is not saved either.

Very strange. Your method is essentially what I would have used.

I suspect two possible explanations. (a) Your "on deactivation" field in trigger 1 is sometimes setting gosaveit to false before the save trigger can poll. This field is redundant anyway since your save trigger sets gosaveit to false once saveGame is complete. Or, (b) somehow certain variables are not getting saved, causing the radio trigger to stop working.

Limited radio savegames is definitely possible. THobson did it for Abandoned Armies.

I will look into this once I get onto an OFP-capable computer. Stay tuned. :cool2:
« Last Edit: 21 May 2010, 20:22:04 by RKurtzDmitriyev »
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline gezegond

  • Members
  • *
UPDATE
« Reply #2 on: 21 May 2010, 23:58:51 »
I tried clearing Trigger 1's deactivation field, it didn't have any effect.
===========
Alright, I figured when the problem occurs, just don't know why.

The info I gave you before was inaccurate. In fact, this happens when I load a previously saved game. The game starts, I can save the game, everything is perfect. but if I die and press retry, the save system stops functioning.

Got any idea why?
===========
PS: Sorry for misleading information earlier, I just forgot that I had used the retry option. I realized this when I was testing the deactivation field.
=============================
Another update:

I'm just guessing here, but the problem could be that the game doesn't save "totalsaves". I declare it player's init field, so when the game loads from a saved state, it doesn't know such variable exists, so when "gosaveit" gets true, it won't do anything since both Trigger 2 & 3 need a knowledge of totalsaves to operate, therefore nothing happens.

If my guess is right, then I need to somehow tell the game to save "totalsaves" along with the rest of the info when saving the mission.
===========
what you said about "Abandoned Armies" worries me. could this be a problem that v1.46 had and was solved later in v1.96?
I hope not, since I don't have resistance and getting it is nearly impossible for me.
« Last Edit: 22 May 2010, 00:31:43 by gezegond »

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Save the game 5 times
« Reply #3 on: 22 May 2010, 01:59:23 »
Quote
PS: Sorry for misleading information earlier, I just forgot that I had used the retry option. I realized this when I was testing the deactivation field.

It's alright. I was wrong about something, too. You can use the "resume" feature from the OFP menu screen to revert back to an earlier point in the mission, if you:

(1) Return to the menu by pressing Esc and then Abort
(2) Re-load the mission by clicking Resume at the bottom of the menu
(3) Die
(4) Click "end" rather than "retry"
(5) Resume the mission by clicking Resume at the bottom of the menu

You will return to where you were at step (1). Thus, every mission has infinite saveGames. But this is very convoluted, and few players will be lame enough to try it. No one will blame you if you just ignore that part.

Anyway,

Quote
what you said about "Abandoned Armies" worries me. could this be a problem that v1.46 had and was solved later in v1.96?

Possibly. There are numerous bugs and weird things reported with the saveGame command, in all versions of OFP. For example, attempting to save too many global variables will cause the game to CTD on reloading (don't worry, it only happens with huge missions).

Fortunately, I did tinker around and find a system that appears to work, regardless of how I die. Try playing the attached demo mission. It was made with 1.96 but should not require any Resistance addons. Use the radio trigger 0-0-1 to save your game. 0-0-2 makes the East soldier shoot you, and 0-0-3 reports how many saves you have left.

The key may be to use a script to check if the saves have been exhausted, rather than a series of triggers. It's more elegant to do so anyway, in my opinion. If it doesn't work on your computer, I will suspect that CWC wasn't made to save variables in the way we're trying to save them. :(

I took a look at one of Mandoble's Grunt One missions, which also all have limited radio saves. He uses essentially the same system as the one in the demo mission below.

Quote
I don't have resistance and getting it is nearly impossible for me.

Can you get your hands on the Game of the Year edition? It has Resistance bundled in it. Yes, the purchase is a little redundant because you'll get another CWC copy, but the Resistance pack is required to play most missions and addons made after about 2003 or so. It's worth it if you're serious about OFP editing, IMO.

So, does the demo mission work for you? :)
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline gezegond

  • Members
  • *
Re: Save the game 5 times
« Reply #4 on: 22 May 2010, 10:48:07 »
That worked! thanks a lot. It seems I have to use an external script in the end. I still haven't learned those!
=======
PS: About Resistance: I can't get my hands on any game that has been released in a time preceding 3 months before now. At least not in my country. If I want an older game, I have to import it from outside my country, that's both expensive and troublesome. So it's nearly impossible for me to get older games (I bought OFP in 2000). I might go crazy and actually import Resistance, but first I need to make sure it's worth it. I might also forget about Resistance and import ARMA, don't really know. (I bought ARMA II, but it didn't run smooth on my computer)

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Save the game 5 times
« Reply #5 on: 22 May 2010, 14:11:03 »
Glad to hear it worked. :)

Bummer to hear about not being able to get GOTY. I wouldn't get ArmA1, though. If anything, the ArmA1 community is even more dead than the OFP community. Everyone has either moved to ArmA2 or else is sticking to OFP: Resistance.
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)