OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: maxjoiner on 23 Jul 2011, 19:23:25

Title: scripts after saving (solved)
Post by: maxjoiner on 23 Jul 2011, 19:23:25
Hi, I've a problem.
In My mission after the save when I reloaded the saving my custom scripts don't work!  >:(
Ex: Init unit: nul = [this] execVM "light.sqf";
or: trigger: nul = [player] execVM "light.sqf";
and also the scripts in init.sqf don't work!
Somebody can help me!   :weeping:
Title: Re: scripts after saving
Post by: Pirin on 24 Jul 2011, 03:38:10
I'm still real fuzzy about savegame compatible scripting, but do setVariables work?  If so you can have a trigger that sets the actual light on or off via the state of a variable.  So set the variable to on in init.sqf, the trigger detects this and turns the light on.  During play the variable sets to off, the trigger turns off the light.  You save.  Come back into the game and the init isn't run again, but since the variable says the light should be off the trigger turns the light off post save?
Title: Re: scripts after saving
Post by: h- on 24 Jul 2011, 09:48:33
@maxjoiner:

Two things need clarifying:
1. You say you save a mission, do you mean you save a mission while playing (press ESC - Save Game) it or do you mean you save a mission in the editor?
2. You say the scripts don't work, how exactly? Error messages?

EDIT:
Hmm, if the script is a short non-looping script, it has already been executed via a trigger and run through, and then the game is saved the trigger will not be run again after the savegame reload because it already has done it's job.

Also, there has been in the past savegame incompatability with a few of the scripting commands, at least setObjectTexture and animate "don't work" in OFP (CWA) and A1; as in their states don't get saved in a savegame (dunno what's the situation with A2). IIRC the same problem was with the command switchLight.
Title: Re: scripts after saving
Post by: maxjoiner on 24 Jul 2011, 10:17:20
@Pirin
Thanks for your reply.

@h-
Thanks for your reply.

I solved thanks at Wiggum!  :good:

http://forums.bistudio.com/showthread.php?t=122714