Page 1 of 1

Modoptions

Posted: 20 Jan 2013, 18:26
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?

Re: Modoptions

Posted: 20 Jan 2013, 18:46
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.

Re: Modoptions

Posted: 20 Jan 2013, 18:52
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 :?

Re: Modoptions

Posted: 20 Jan 2013, 18:59
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.

Re: Modoptions

Posted: 20 Jan 2013, 19:17
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.

Re: Modoptions

Posted: 20 Jan 2013, 19:36
by Beherith
StartingResourses
StartingResourses


Does this section exist?

Re: Modoptions

Posted: 20 Jan 2013, 19:38
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.

Re: Modoptions

Posted: 20 Jan 2013, 21:01
by zyxar
Beherith wrote:StartingResourses
StartingResourses


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