
Automatic metal maker
Moderator: Moderators
Automatic metal maker
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 =\


Re: Automatic metal maker
no idea, but i like this model :D
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Automatic metal maker
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?
@CR - okay, that's just funny. But being a CA guy, wouldn't you have actually *useful* input?
Re: Automatic metal maker
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?
( 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
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...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?
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
It has to be done in a LuaRules gadget, not the unitdef itself. That is what zwzsg's (incomplete) code is for.