Typemap Options

Typemap Options

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

Moderator: Moderators

Post Reply
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Typemap Options

Post by Google_Frog »

A gadget that links in with modoptions to give players a lot of control over how much of the map's typemap they use.

Modoptions:

Code: Select all

{
    key='typemapsetting',
    name='Terrain Speed Boost',
    desc='Choose which map Speed Boost to use',
    type='list',
    section= 'mapsettings',        
    def='keepequal',
    items = {
      { key='mapdefault', name="Map Default", desc='Use map speed boost' },
	  { key='average', name="Average", desc='Each terrain types speed boost is averaged' },
	  { key='keepequal', name="Keep Equal", desc='Non-equal speedboost removed' },
	  { key='onlyimpassable', name="Only Impassable", desc='Override all speedboost except impassable terrain' },
	  { key='alloff', name="All Off", desc='Disable all speed boost' },
    },
  },
Edit: Updated for 256 max typemaps.
Attachments
typemap_options.lua
(3.08 KiB) Downloaded 17 times
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Typemap Options

Post by jK »

I would prefer the option to just disable impassable terrain.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Typemap Options

Post by Argh »

Er, why the 1,1600, instead of using map.maxsizeX / Z?

Moreover... you don't need to do any of that. Just:

Spring.SetTerrainTypeData(A,B,C,D,E)

Where A is the type, B == TANK, C == KBOT, D == HOVER, and E == SHIP

...voila, done, no need to reset them or change them all to the same things.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Typemap Options

Post by Google_Frog »

I would prefer the option to just disable impassable terrain.
And leave all the other speed changes? Maps generally have impassable regions for a reason but that didn't stop me from adding the option to disable it.
Er, why the 1,1600, instead of using map.maxsizeX / Z?
Because it looked like I would need 1,32 to start with and discovered that some mappers like to use round, large numbers. 1,1600 is still smaller than (0,map.maxsizeX/8) * (0,map.maxsizeZ/8).
Moreover... you don't need to do any of that. Just:

Spring.SetTerrainTypeData(A,B,C,D,E)

Where A is the type, B == TANK, C == KBOT, D == HOVER, and E == SHIP

...voila, done, no need to reset them or change them all to the same things.
I have got no idea what this means though I can assure you that putting "Spring.SetTerrainTypeData(A,B,C,D,E)" in an empty lua file will not work.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Typemap Options

Post by Argh »

I can assure you that putting "Spring.SetTerrainTypeData(A,B,C,D,E)" in an empty lua file will not work.

Code: Select all

if (gadgetHandler:IsSyncedCode()) then
function gadget:Initialize()
	--get number of movetypes from map file here
end

function gadget:GameFrame(f)
	if f == 1 then
		for 0,moveTypes do
			Spring.SetTerrainTypeData(moveType,B,C,D,E)
		end
	end
	if f == 61 then
		gadgetHandler:RemoveCallIn("GameFrame")
	end
end
end
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Typemap Options

Post by jK »

Google_Frog wrote:
I would prefer the option to just disable impassable terrain.
And leave all the other speed changes? Maps generally have impassable regions for a reason but that didn't stop me from adding the option to disable it.
On most maps it's just breaks them (Azure, BlackStar, ...).
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Typemap Options

Post by Google_Frog »

jK wrote:
Google_Frog wrote:
I would prefer the option to just disable impassable terrain.
And leave all the other speed changes? Maps generally have impassable regions for a reason but that didn't stop me from adding the option to disable it.
On most maps it's just breaks them (Azure, BlackStar, ...).
Hence "{ key='alloff', name="All Off", desc='Disable all speed boost' },"
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Typemap Options

Post by Beherith »

Google_Frog wrote:
Er, why the 1,1600, instead of using map.maxsizeX / Z?
Because it looked like I would need 1,32 to start with and discovered that some mappers like to use round, large numbers. 1,1600 is still smaller than (0,map.maxsizeX/8) * (0,map.maxsizeZ/8).
WTF?
Explain please where you got that 1600 number from.
The max amount of different terrain types is 256. Cant be more. Dont know what that has to do with mapsizex/8*mapsizeZ/8
Theoretically typemap dimensions are (at compile time and in the map format) texturex/16*texturey/16
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Typemap Options

Post by Google_Frog »

The max amount of different terrain types is 256.
Great, I saw some maps using typemap 0,50,100 ect.. and extrapolated. I started with 32 and found a few maps using every 50th typemap. 50*32 = 1600.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Typemap Options

Post by Beherith »

They are using every 50th because its easier to visualize. The typemap is the red channel of a bmp image. The number is how much red there is.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Typemap Options

Post by Pxtl »

I know you're talking about speed-boost, but I assume this also refers to speed-nerfs too, right?
Post Reply

Return to “Lua Scripts”