Page 1 of 1

Automatic metal maker

Posted: 10 Jun 2010, 19:11
by smoke_th
Here is question. How make in lua unit file (that replaces fbi) changes that it will use as metal income value 1/10 of wind on map? And also add 1/10 energy income from wind? I'm kinda stuck with it =\
Image

Re: Automatic metal maker

Posted: 10 Jun 2010, 19:43
by KaiserJ
no idea, but i like this model :D

Re: Automatic metal maker

Posted: 10 Jun 2010, 19:51
by CarRepairer
I made a similar model:

Image

Re: Automatic metal maker

Posted: 10 Jun 2010, 19:52
by Pxtl
You'll have to Lua it. The CA guys are good at making resource-generating units that work weird, ask them. For example, you could make the wind-generation really tiny and then read the energy-generation value to determine your metal making.

@CR - okay, that's just funny. But being a CA guy, wouldn't you have actually *useful* input?

Re: Automatic metal maker

Posted: 10 Jun 2010, 20:22
by zwzsg
Spring.GetUnitResources
( number unitID ) -> nil | number metalMake, number metalUse,
number energyMake, number energyUse


Spring.SetUnitResourcing
( number unitID,
string res, number amount |
{ res = number amount, ... }
) -> nil
possible values for res are: "[u|c][u|m][m|e]"
unconditional | conditional
use | make
metal | energy


Or do I have to write the whole gadget?

Re: Automatic metal maker

Posted: 11 Jun 2010, 05:25
by smoke_th
zwzsg wrote:Spring.GetUnitResources
( number unitID ) -> nil | number metalMake, number metalUse,
number energyMake, number energyUse


Spring.SetUnitResourcing
( number unitID,
string res, number amount |
{ res = number amount, ... }
) -> nil
possible values for res are: "[u|c][u|m][m|e]"
unconditional | conditional
use | make
metal | energy


Or do I have to write the whole gadget?
Hmm.....interesting....but can you next time wrote it more understandably? And where i need to put this code? I doesn't look like standart tdf-looking lua file with...
unitDef = {
unitname = [[scv]],
name = [[scv]],
description = [[scv]],
acceleration = 0.36,
bmcode = [[1]],
brakeRate = 0.2,
buildCostEnergy = 65,
buildCostMetal = 65,
builder = false,
buildPic = [[bbasicmech.png]],
buildTime = 15,
canAttack = true,
canGuard = true,
...

Re: Automatic metal maker

Posted: 11 Jun 2010, 05:26
by smoke_th
CarRepairer wrote:I made a similar model:

Image
Flying bertha? Man, you are cheater :D

Re: Automatic metal maker

Posted: 11 Jun 2010, 15:38
by FLOZi
It has to be done in a LuaRules gadget, not the unitdef itself. That is what zwzsg's (incomplete) code is for.