Possible to change values of Spring/Mod globals?

Possible to change values of Spring/Mod globals?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Pithikos
Posts: 146
Joined: 26 Dec 2008, 14:26

Possible to change values of Spring/Mod globals?

Post by Pithikos »

I was wondering what role the engine's/mods' constants and variables play. Are they only readable or is it possible to change the value?

I tryied changing the Game.Gravity to 0.1 in a gadget and it seems like it changed although in the game I didn't see any visual difference..
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Possible to change values of Spring/Mod globals?

Post by knorke »

according to wiki Game.gravity is a constant, so you can not change it.
i am pretty sure units & projectiles have a mygravity or something you could try changing that.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Possible to change values of Spring/Mod globals?

Post by zwzsg »

If you change the values of all those constant in Lua, they will be changed for when other Lua gadgets read them, but not for the C++ simulation.

At the start of the game, all those constant are copied into Lua variables. The Lua copy is read/write, because there is no read-only in the Lua language. However, they are not meant to be overwritten, and overwritting them will achieve nothing except you losing the ability to know the original value.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Possible to change values of Spring/Mod globals?

Post by aegis »

zwzsg wrote:no read-only in the Lua language
not true but otherwise yes
Post Reply

Return to “Lua Scripts”