Modoptions

Modoptions

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

Moderator: Moderators

Post Reply
User avatar
zyxar
Posts: 18
Joined: 18 Dec 2012, 04:39

Modoptions

Post by zyxar »

Hi guys,
I've been looking at adding a couple of modoptions to a game, but I can't get my options to show up in the lobby.
For example:
Say I wanted an option to vary the commander's sight range.
This is what I'd put in the mod options.

Code: Select all

{
		key    = "los",
		name   = "Line of Sight",
		desc   = "varies the line of sight of commander",
		type   = "number",
		section= "StartingResourses",
		def    = "4000",
		min    = "2000",
		max    = "10000",
		step   = 	100,
	},
Then, to implement this, I'd have to go and edit commoption.lua
and add something like:

Code: Select all

if (los and tonumber(los) ~= 0) then
			Spring.SetUnitSensorRadius(commanderID, "los", los)
		end
inside of the function spawnStartUnit(teamID) block

my problem is nothing is showing up in the lobby. Is there another file I need to edit?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Modoptions

Post by Jools »

Does nothing show up in lobby? Does it show mod options (0) ?

In that case, that's because there was a problem with modoptions.lua. It's very sensitive, check that you have commas after each parameter and that the brackets match.
User avatar
zyxar
Posts: 18
Joined: 18 Dec 2012, 04:39

Re: Modoptions

Post by zyxar »

what I wrote above is exactly what I pasted into the modops file. It's really just a copy of the metal energy stuff just with different names

and yes, nothing shows up :?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Modoptions

Post by Jools »

Well, if it shows "modoptions (0)" then the reason is a problem with modoptions.lua. Try disabling (commenting) parts of it until you find the flaw.
User avatar
zyxar
Posts: 18
Joined: 18 Dec 2012, 04:39

Re: Modoptions

Post by zyxar »

Jools wrote:Well, if it shows "modoptions (0)" then the reason is a problem with modoptions.lua. Try disabling (commenting) parts of it until you find the flaw.
do you mean if it shows "modoptions (0)" in the lobby?

I guess I didn't explain the output I was getting too well.
The normal mod options show and work. It's just the one I'm trying to add that won't show.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Modoptions

Post by Beherith »

StartingResourses
StartingResourses


Does this section exist?
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Modoptions

Post by Jools »

The only requirement for it to show up is presence of that stuff in modoptions.lua. Did you check key is unique? Did you check it won't who up somewhere else within that section?

The for functionality you need more. It really depends on the mod you are using.
User avatar
zyxar
Posts: 18
Joined: 18 Dec 2012, 04:39

Re: Modoptions

Post by zyxar »

Beherith wrote:StartingResourses
StartingResourses


Does this section exist?
awesome that fixes the lobby issue lol I'm blind
Thanks guys
Post Reply

Return to “Lua Scripts”