Page 1 of 2
Help, does anyone know what's causing this?
Posted: Mon Mar 09, 2009 11:10 pm
by $oldier Of Ra
I have never encountered this; for some reason MoHAA just clears my game.variables for no reason and it mentions in the console (also weird).
Anyone have any slightest clue?
I defined them in a seperate script. Which gets executed once, map changes and then executed again.
Posted: Tue Mar 10, 2009 9:19 am
by jv_map
Strange

, never seen that. How does the map change? Standard multiplayer map win or are you using leveltransition/bsptransition?
Posted: Tue Mar 10, 2009 12:00 pm
by $oldier Of Ra
That's the weird part, it's tdm, not obj with its roundrestarts, I set the time to 1 minute and just let it run out.
In my config I set ffac to 1 so the script would work (has a check for this cvar and ends if it's not set to 1):
Then I set 2 execs (exec global/ffa_competition.scr) in mohdm1 and mohdm2. I start mohdm1, the opening round works fine, time runs out and mohdm2 gets started. Normally, the 1st round would start but the opening round starts again and I see that in the console.
Posted: Tue Mar 10, 2009 4:25 pm
by $oldier Of Ra
I found the file where the game stores all the used variables (save/unnamedsoldier/current.spv). After that I tried executing them AFTER level waittill spawn and it worked.
After further testing I concluded that the game vars will not get cleared if when you define them, it may be after or before waittill spawn but in the next map(s) the variable must be used after level waittill spawn or the game will spontaneously clear them.
Posted: Tue Apr 28, 2009 12:45 pm
by SilentAngel
Strange!?...that has no sense..humm
From where do you exec these variables?
maybe you can try to exec it directly from maps scr after prespawn..then if it doeasn't work again it's compleatly confirmed that game var must be set after spawn(what a creazy world!

)
Posted: Tue Apr 28, 2009 2:25 pm
by Aprop
Code: Select all
1) game
Refers to the unique game object which maintains its state across levels. Only primitive values (integers/floats/strings/vectors) will persist across levels.
Posted: Tue Apr 28, 2009 2:33 pm
by SilentAngel
Something like a const var..or <<speaking in C leng>> a #define?
I mean a value that cannot be modifyed during the program execution..is it something like that?
I've never used game.var, time to try..

Posted: Tue Apr 28, 2009 2:42 pm
by Aprop
You can change game. vars anytime, like level. etc... and #define isnt a cont var, its a macro.
Posted: Tue Apr 28, 2009 2:53 pm
by SilentAngel
exactly man..it's named like this<macro> <nome-sostituzione>..
however..I'm not understanding the use of game var, there's a file where that explain how to use them?
(srry for the bad english..humm probably it's time to learn it lol)
Posted: Tue Apr 28, 2009 2:56 pm
by Aprop
Game vars are like level vars but they persist through the maps...
Posted: Tue Apr 28, 2009 3:00 pm
by SilentAngel
o

k..now i've understood..
Posted: Tue Apr 28, 2009 3:55 pm
by $oldier Of Ra
If you experiment a lot, you'll encounter a lot more odd things that don't make sense in MoH, seriously.
I did exec it from the mapscript. It doesn't matter from where you exec them, I tried everything, same thing. Game vars may be set anywhere you like, but you can only use them AFTER waittill spawn if you don't want them erased the next level and get that nonsense printed in your console.
Don't use game vars when you don't need them. If you don't need interlevel values, you don't need game vars.
But I've made a system which will save all the values of my game vars at the end of a level and return them at the start of the next. So my problem is solved.
Posted: Tue Apr 28, 2009 4:04 pm
by SilentAngel
lol good idea!
Posted: Tue Apr 28, 2009 4:54 pm
by $oldier Of Ra
To expand a little:
I saved all values into a string and set a cvar with that string when a map/round is about to end (timelimit as well as by teamwin) . When a round/map starts, if the cvar has values, the cvar's string will be parsed and all the most recent information will be given to the corresponding game variable.
Posted: Tue Apr 28, 2009 4:58 pm
by SilentAngel
hahaha that's how to chisel the engine!
