Help, does anyone know what's causing this?

Post your scripting questions / solutions here

Moderator: Moderators

$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Help, does anyone know what's causing this?

Post 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?
Image

I defined them in a seperate script. Which gets executed once, map changes and then executed again.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Strange :? , never seen that. How does the map change? Standard multiplayer map win or are you using leveltransition/bsptransition?
Image
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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):

Code: Select all

seta ffac "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.
Last edited by $oldier Of Ra on Tue Mar 10, 2009 6:18 pm, edited 1 time in total.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post 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! :? )
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post 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.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post 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.. :)
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

You can change game. vars anytime, like level. etc... and #define isnt a cont var, its a macro.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post 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)
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Game vars are like level vars but they persist through the maps...
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

o :idea: k..now i've understood..
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

lol good idea!
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

hahaha that's how to chisel the engine! :wink:
Post Reply