Tech Requirements - Page 2

Tech Requirements

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

Moderator: Moderators

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Tech Requirements

Post by zwzsg »

Oh wait, the bug in Red UI is easy enough that I can find it myself.

In gui_red_buildordermenu.lua replace

Code: Select all

		if (cmd.disabled) then
			icon.texturecolor = {0.5,0.5,0.5,1}
		end
by

Code: Select all

		if (cmd.disabled) then
			icon.texturecolor = {0.5,0.5,0.5,1}
		else
			icon.texturecolor = {1,1,1,1}
		end
I guess Regret considered unit getting disabled before game, but not unit getting re-enabled mid-game. Though, his code would still be buggy anyway, since the same position doesn't always have the same command.
Attachments
gui_red_buildordermenu.lua
Hopefully fixes the permantent darkening issue.
(14.95 KiB) Downloaded 131 times
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Tech Requirements

Post by Forboding Angel »

YAY!!! Thank you! :-)

I like using redui because it's a pretty good gui with a lot of nice features. It has some issues (as you've seen so far) but there aren't many alternatives, sadly.

I wish there was some sort of gui that could be used by moddevs to basically be able to do what you want with the stuff in spring. Unfortunately, meh, we got to live with what we get I guess.

Edit: Tested and it works perfectly, z you are awesome. Thanks so much!
User avatar
PTSnoop
Posts: 97
Joined: 09 Sep 2009, 19:05

Re: Tech Requirements

Post by PTSnoop »

For the Multi-Tech Advanced version, the comment gives instructions about how to add RequireTech and ProvideTech to TDF files. What would I need to write for Lua unitdefs?

I've tried

Code: Select all

	CustomParams = {
		ProvideTech = cuberes1,
	},
and

Code: Select all

	CustomParams = {
		RequireTech = cuberes1,
	},
but you can still build the second building without needing the first.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Tech Requirements

Post by CarRepairer »

PTSnoop wrote:For the Multi-Tech Advanced version, the comment gives instructions about how to add RequireTech and ProvideTech to TDF files. What would I need to write for Lua unitdefs?

I've tried

Code: Select all

	CustomParams = {
		ProvideTech = cuberes1,
	},
and

Code: Select all

	CustomParams = {
		RequireTech = cuberes1,
	},
but you can still build the second building without needing the first.
Put quotes around cuberes1 like so: 'cuberes1'
User avatar
PTSnoop
Posts: 97
Joined: 09 Sep 2009, 19:05

Re: Tech Requirements

Post by PTSnoop »

It's working now. Thanks!

(It's always the quote marks, isn't it...)
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Tech Requirements

Post by zwzsg »

You can see in previous page Forboding Angel posting exemple in Lua unitdefs syntax.
User avatar
PTSnoop
Posts: 97
Joined: 09 Sep 2009, 19:05

Re: Tech Requirements

Post by PTSnoop »

Would I be able to use Multi_Tech.lua to have units as unable to move until a research building is built? (The basic plan is for all buildings to suddenly gain the ability to hover around the map.)

I've had a bit of a look at the instructions at the top of the lua file, and I'm still a bit confused. I'm using Lua unit animation; would I be able to put a GG.TechCheckCommand(commandID, teamID) somewhere to stop the unit from moving? If so, how would I actually do that? Or would I have to make a separate gadget to handle this?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Tech Requirements

Post by FLOZi »

luaunitscripts are actually part of luarules, so yes you can access GG from them.
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Tech Requirements

Post by daryl »

hi zwzsg,
it is possible to hide the "morph" command/button of a unit until the contruction of a research lab unit ??
so could you post a lua example please?? :?:
thx!!
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Tech Requirements

Post by zwzsg »

Uh, yes, most probably. Where did you take your morphing code from?
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Tech Requirements

Post by daryl »

zwzsg wrote:Uh, yes, most probably. Where did you take your morphing code from?
i took the script from this topic http://springrts.com/phpbb/viewtopic.ph ... 19#p385419
and you need the "colors.h.lua" file.
So.. I post the .zip file that contains all file needed to work!

I would like "hide", if possible, ( not disable ) the morph/upgrade button until the construction of determined unit.
If isn't possible hide, it's ok!... no problem..

So, for my mod i would like add the research lab that research new technology ( this laboratory will create invisible unit = technology )

for example:
when the research of commander update is done, X invisible unit is created by research lab and this x unit activate the "morph/upgrade" button.
( so i don't know more simple alternative at the moment to do this kind of research lab :-) )

thx for your help!!
Attachments
unit_morph.zip
(9.94 KiB) Downloaded 30 times
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Tech Requirements

Post by zwzsg »

I've just stray files, not a mod, so I can't test. What I would try is:

File: unit_morph.lua
Function: UpdateMorphReqs
Between: morphCmdDesc.disabled = ...
And: morphCmdDesc.tooltip =
So between line 281 and 282
Add a new line:
morphCmdDesc.hidden = not GG.TechCheck(morphDef.RequireTech,teamID)

And also in AllowCommand, in the big if, between "(morphDef.xp<=Spring.GetUnitExperience(unitID))and" and "(UnitReqCheck(teamID, morphDef.require)) )", add "(GG.TechCheck(morphDef.RequireTech,teamID))and".

In morph_defs.lua add some RequireTech field like you did already for the first one. And use together with my Better_Ranged_Counted_Multi_Tech.lua
Attachments
unit_morph.lua
Untested, may not work.
(38.83 KiB) Downloaded 126 times
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Tech Requirements

Post by daryl »

zwzsg wrote:I've just stray files, not a mod, so I can't test. What I would try is:

File: unit_morph.lua
Function: UpdateMorphReqs
Between: morphCmdDesc.disabled = ...
And: morphCmdDesc.tooltip =
So between line 281 and 282
Add a new line:
morphCmdDesc.hidden = not GG.TechCheck(morphDef.RequireTech,teamID)

And also in AllowCommand, in the big if, between "(morphDef.xp<=Spring.GetUnitExperience(unitID))and" and "(UnitReqCheck(teamID, morphDef.require)) )", add "(GG.TechCheck(morphDef.RequireTech,teamID))and".

In morph_defs.lua add some RequireTech field like you did already for the first one. And use together with my Better_Ranged_Counted_Multi_Tech.lua
hi zwzsg,
I tested your modified unit_morph.lua Script but doesn't work at the moment.
I copied your file in \LuaRules\Gadgets and i didn't modified the morph_defs.lua in \LuaRules\Configs directory.
you know there are those fields in morph_defs.lua:
[...]
armcom = {
into = 'armcom1',
tech = 0,
time = 120,
metal= 600,
energy= 2000,
RequireTech = 'armham', -- ( for example arm hammer )
--xp = .05,
[...]

morph button appear from the start of the game and i can morph my commander withouth the construction of an arm hammer unit but, when I click on morph button an error appear. I post an image of this error. I hope this can help you!!..

thx again!!
Attachments
screen009.jpg
(150.57 KiB) Downloaded 2 times
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Tech Requirements

Post by zwzsg »

Any way I could grab your W.I.P. mod?

Rebuilding a whole mod just to plug these gadgets so I can start debugging is an unenticing task.
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Tech Requirements

Post by daryl »

zwzsg wrote:Any way I could grab your W.I.P. mod?

Rebuilding a whole mod just to plug these gadgets so I can start debugging is an unenticing task.
sure..
i just started with this mod!.. so it's based on BA 7.01 but i have too many things to do!! ( i want upgrade models geometry, textures, add this research lab option, add some OTA 3ds party units and remodel it, etc! ).
first of all i need this "research lab"!. I need to know if it is possible to do.
download this mod at: http://www.totalannihilation.it/files/m ... v0.26a.sd7
if you want, i can give you my msn contact.
thx again!
bye!!
Last edited by daryl on 17 Dec 2009, 20:10, edited 1 time in total.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Tech Requirements

Post by Forboding Angel »

*sob*

./facepalm
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Tech Requirements

Post by zwzsg »

Daryl: So, I had a look at it today, an uh.... You don't even need my gadget at all! The morph gadget you use already support a "require" tag in morph_defs.lua. (And also you need to put the unit id of the required unit in morph_defs.lua where it's said to add it)
Attachments
TFBv0.26b.sdz
(10.13 KiB) Downloaded 35 times
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Tech Requirements

Post by daryl »

zwzsg wrote:Daryl: So, I had a look at it today, an uh.... You don't even need my gadget at all! The morph gadget you use already support a "require" tag in morph_defs.lua. (And also you need to put the unit id of the required unit in morph_defs.lua where it's said to add it)
oi really? :-)
it's ok!!!!!!!
I will need morph + Better_Ranged_Counted_Multi_Tech.lua becouse (example) I need to morph a x unit only when I researched a y tech. ( I will build an y invisible unit corresponding at y tech -> y tech = researched -> x unit can morph). But I need to research this tech ( build this invisible unit) only 1 time!!! I can do this with your script!...
" RequireTech=y unit;
ProvideTech=-y unit;
"
without this I can research 1000 time the same tech ( i build 1000 invisible units corresponding at y tech )
ok "problem" 99,9% solved.
it is possible lock the button of units that you can have only one at a time?
thx again!!!!!!!!!!!!
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Tech Requirements

Post by zwzsg »

In the FBI of Arm hammer, add:
UnitRestricted=1;
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Tech Requirements

Post by daryl »

zwzsg wrote:In the FBI of Arm hammer, add:
UnitRestricted=1;

aah ok!!!
yes it is working!!!
thx zwzsg !!!!!!!!!!!!!!!!!
Post Reply

Return to “Lua Scripts”