How to to get a Widget working with a different Mod

How to to get a Widget working with a different Mod

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

Moderator: Moderators

Post Reply
iph8x
Posts: 6
Joined: 07 Dec 2009, 15:44

How to to get a Widget working with a different Mod

Post by iph8x »

I'am a complety Noob with these Widgets, and i'd like to make some widgets for Example the Defence Range Widget working for a not Supported mod also an example Complete Anaihalion Advanced.

I'd woud be very nice if someone can spend some time in explaining this for a noob :-) .

Thanks
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: How to to get a Widget working with a different Mod

Post by manolo_ »

iph8x wrote:I'am a complety Noob with these Widgets, and i'd like to make some widgets for Example the Defence Range Widget working for a not Supported mod also an example Complete Anaihalion Advanced.

I'd woud be very nice if someone can spend some time in explaining this for a noob :-) .

Thanks
hiho,

i did the same for xta, so open the gui_defenseRange.lua

and scroll to the part

Code: Select all

local modConfig = {}
-- BA
--to support other mods
--table initialized and unitList is needed!
and add the mod:

switch e.g. BA with the mod u want and add the units from here

Code: Select all

modConfig["BA"] = {}
modConfig["BA"]["unitList"] = 
							{ 
								armclaw = { weapons = { 1 } },
								cormaw = { weapons = { 1 } },
								armllt = { weapons = { 1 } },
								tawf001 = { weapons = { 1 } },
								armhlt = { weapons = { 1 } },
								armguard = { weapons = { 1, 1 } },
								armrl = { weapons = { 2 } }, --light aa
								packo = { weapons = { 2 } },
								armcir = { weapons = { 2 } }, --chainsaw
								armdl = { weapons = { 1 } }, --depthcharge
								ajuno = { weapons = { 1 } },
								armtl = { weapons = { 1 } }, --torp launcher
								armfhlt = { weapons = { 1 } },  --floating hlt
								armfrt = { weapons = { 2 } },  --floating rocket laucher
								
								armamb = { weapons = { 1,1 } }, --ambusher
								armpb = { weapons = { 1 } }, --pitbull
								armanni = { weapons = { 1 } },
								armflak = { weapons = { 2 } },
								mercury = { weapons = { 2 } },
								armemp = { weapons = { 1 } },
								armamd = { weapons = { 3 } }, --antinuke
								
								armbrtha = { weapons = { 1 } },
								armvulc = { weapons = { 1 } },
								
								--CORE
								corexp = { weapons = { 1 } },
								cormaw = { weapons = { 1 } },
								corllt = { weapons = { 1 } },
								hllt = { weapons = { 1 } },
								corhlt = { weapons = { 1 } },
								corpun = { weapons = { 1, 1 } },
								corrl = { weapons = { 2 } },
								madsam = { weapons = { 2 } },
								corerad = { weapons = { 2 } },
								cordl = { weapons = { 1 } },
								cjuno = { weapons = { 1 } },
								
								corfhlt = { weapons = { 1 } },  --floating hlt
								cortl = { weapons = { 1 } }, --torp launcher
								corfrt = { weapons = { 2 } }, --floating rocket laucher
								
								cortoast = { weapons = { 1 } },
								corvipe = { weapons = { 1 } },
								cordoom = { weapons = { 1 } },
								corflak = { weapons = { 2 } },
								screamer = { weapons = { 2 } },
								cortron = { weapons = { 1 } },
								corfmd = { weapons = { 3 } },
								corint = { weapons = { 1 } },
								corbuzz = { weapons = { 1 } }					
							}

--implement this if you want dps-depending ring-colors
--colors will be interpolated by dps scores between min and max values. values outside range will be set to nearest value in range -> min or max
modConfig["BA"]["armorTags"] = {}
modConfig["BA"]["armorTags"]["air"] = "vtol"
modConfig["BA"]["armorTags"]["ground"] = "else"
modConfig["BA"]["dps"] = {}
modConfig["BA"]["dps"]["ground"] = {}
modConfig["BA"]["dps"]["air"] = {}
modConfig["BA"]["dps"]["ground"]["min"] = 50
modConfig["BA"]["dps"]["ground"]["max"] = 500
modConfig["BA"]["dps"]["air"]["min"] = 80
modConfig["BA"]["dps"]["air"]["max"] = 500
--end of dps-colors
--implement this if you want custom colors - we dont want it for BA
--[[
modConfig["BA"]["color"] = {}
modConfig["BA"]["color"]["enemy"] = {}
modConfig["BA"]["color"]["enemy"]["ground"] = {}
modConfig["BA"]["color"]["enemy"]["air"] = {}
modConfig["BA"]["color"]["enemy"]["nuke"] = {}									 
modConfig["BA"]["color"]["enemy"]["ground"]["min"] = { 1.0, 0.0, 0.0 }
modConfig["BA"]["color"]["enemy"]["ground"]["max"] = { 1.0, 1.0, 0.0 }
modConfig["BA"]["color"]["enemy"]["air"]["min"] = { 0.0, 1.0, 0.0 }
modConfig["BA"]["color"]["enemy"]["air"]["max"] = { 0.0, 0.0, 1.0 }
modConfig["BA"]["color"]["enemy"]["nuke"] =  { 1.0, 1.0, 1.0 }
modConfig["BA"]["color"]["ally"] = modConfig["BA"]["color"]["enemy"]
--]]
--end of custom colors
--end of BA
iph8x
Posts: 6
Joined: 07 Dec 2009, 15:44

Re: How to to get a Widget working with a different Mod

Post by iph8x »

Thanks, but there is a little Problem... The Mod is not in the List.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: How to to get a Widget working with a different Mod

Post by very_bad_soldier »

Then try this:
1. Change the modfile's extension to "zip"
2. Extract it

To find out your mod's shortname:
-Open modinfo.tdf in your editor
-Look for the tag "shortname". This is the mod identifier to use in the table.

To find out unit names:
-Go to the directory "units"
-You will see one definition file for each unit in the mod. Open some of them. ("armflash.fbi" for example)
-"unitname" is the name to use as identifier (Look at the tag "name" to find out how the unit is called ingame)

I hope this helps. I never made a mod or anything similar, so use at your own risk 8)

BTW:
The weapon codes in the table of the lua widget are:
1 = Ground Weapon
2 = AntiAir Weapon
3 = AntiNuke Weapon
iph8x
Posts: 6
Joined: 07 Dec 2009, 15:44

Re: How to to get a Widget working with a different Mod

Post by iph8x »

Thanks, but is ther realy no other way the MANUALY :evil: Enter all This Units ?
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: How to to get a Widget working with a different Mod

Post by very_bad_soldier »

Keep in mind that defenseRange is meant for static defenses only. The Arm Flash was a bad example.
You will only want to add a fraction of the complete unit set to that widget.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: How to to get a Widget working with a different Mod

Post by FLOZi »

Why doesn't it just detect all static, armed units?
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: How to to get a Widget working with a different Mod

Post by very_bad_soldier »

It did once but I changed it. You have not enough control over which units are considered static defenses. There are static defenses you would not want to show up. And you cant reliable say if its antiground/antiair or even both.
Cmon its just 15-20 mins of work which you do once for a mod and you have full control over the whole result.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: How to to get a Widget working with a different Mod

Post by Forboding Angel »

Umm, use defense ranges included in EvoRTS, it will work for old mods. And if you read the description in the widget database, it tells you to use an older version for mods that aren't BA.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: How to to get a Widget working with a different Mod

Post by very_bad_soldier »

Forboding Angel wrote:And if you read the description in the widget database, it tells you to use an older version for mods that aren't BA.
Are you confusing it with Attack-AoE maybe?
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: How to to get a Widget working with a different Mod

Post by Tribulex »

very_bad_soldier wrote:
Forboding Angel wrote:And if you read the description in the widget database, it tells you to use an older version for mods that aren't BA.
Are you confusing it with Attack-AoE maybe?
yes he is.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: How to to get a Widget working with a different Mod

Post by FLOZi »

very_bad_soldier wrote:It did once but I changed it. You have not enough control over which units are considered static defenses. There are static defenses you would not want to show up. And you cant reliable say if its antiground/antiair or even both.
Cmon its just 15-20 mins of work which you do once for a mod and you have full control over the whole result.
You could include all static, armed units then have a mod specific blacklist. I guess that doesn't help with antiground/air though.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: How to to get a Widget working with a different Mod

Post by Tribulex »

Allow the lua to learn the behaviors of different units as you play.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: How to to get a Widget working with a different Mod

Post by manolo_ »

very_bad_soldier wrote:It did once but I changed it. You have not enough control over which units are considered static defenses. There are static defenses you would not want to show up. And you cant reliable say if its antiground/antiair or even both.
Cmon its just 15-20 mins of work which you do once for a mod and you have full control over the whole result.
ive to agree, the work was done pretty fast (but xta is on modua.., so its was easier)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: How to to get a Widget working with a different Mod

Post by Argh »

Better question: why not just have the mod / game authors write simple customParams that can be used for stock Widgets like this, so that they know what type a thing is? Pretty easy solution, tbh, just some copy-pasta work.
Post Reply

Return to “Lua Scripts”