|
 |
| Author |
Message |
|
aeoncleanse
|
Posted: 02 Feb, 2013
|
|
Joined: 30 Aug, 2008 Posts: 438 Location: Cambridgeshire, UK
|
I want to double the BuildTime of every unit with the Category BUILTBYTIER2ENGINEER without having to manually hook each one individually. I have looked at the Resource Rich mod and extrapolated the following, but, predictably, it doesn't work. Code: -- Copyright 2007 Gas Powered Games - All rights reserved -- -- Author: Matt Mahon -- -- Description: -- Sample Mod to double economic output of econ units. --
--this function is called already in game. This gives us a hook to screw the --blueprint values for the units
do local oldModBlueprints = ModBlueprints
function ModBlueprints(all_bps) oldModBlueprints(all_bps)
local TimeScale2 = 1.5 local TimeScale3 = 2 --loop through the blueprints and adjust as desired. for id,bp in all_bps.Unit do if bp.Categories.BUILTBYTIER2ENGINEER then bp.Economy.BuildTime = bp.Economy.BuildTime * TimeScale2 end if bp.Categories.BUILTBYTIER3ENGINEER then bp.Economy.BuildTime = bp.Economy.BuildTime * TimeScale3 end end end
end Is there any way of doing this?
_________________
Quote: Supcom 2 is like a car, Its got a great engine, suspension and drive train, a sweet *** body where every curve is just right, but the guy at the paint shop accidentally painted it neon pink.
Mike
Last edited by aeoncleanse on 03 Feb, 2013, edited 1 time in total.
|
|
| Top |
|
 |
|
BulletMagnet
|
Posted: 03 Feb, 2013
|
|
Joined: 05 Oct, 2007 Posts: 16425 Location: camping near the biggest power-up
|
Code: bp.Economy.BuildTime = bp.Economy.BuiltTime * TimeScale3 This line has your mistake. It's but only one character wrong. Also, you're not checking if a unit has no BuildTime defined. If something is built by an engineer (or at the very least has the BUILTBYTIER2ENGINEER, or BUILTBYTIER3ENGINEER category tags) but doesn't have a built time (I'm not saying a zero time, but one that is completely missing) it'll crash in a fiery ball of death.
_________________
Nephylim wrote: But, an FA army in an FA environment just looks... right. Does anyone know how to use air transports? I cant get them to pick up troops.
|
|
| Top |
|
 |
|
aeoncleanse
|
Posted: 03 Feb, 2013
|
|
Joined: 30 Aug, 2008 Posts: 438 Location: Cambridgeshire, UK
|
BulletMagnet wrote: Code: bp.Economy.BuildTime = bp.Economy.BuiltTime * TimeScale3 This line has your mistake. It's but only one character wrong. Also, you're not checking if a unit has no BuildTime defined. If something is built by an engineer (or at the very least has the BUILTBYTIER2ENGINEER, or BUILTBYTIER3ENGINEER category tags) but doesn't have a built time (I'm not saying a zero time, but one that is completely missing) it'll crash in a fiery ball of death. I spotted that typo just after I posted, and it makes no difference. I simply don't think that I can do this using the BUILTBYTIER2ENGINEER category check, though I know of no alternative. I can't use the error log either, as for some reason it gives me a looping error to do with my external sound card and crashes the game when I bring it up. I'll check, but I'm pretty sure everything with the categories has a BuildTime cost...
_________________
Quote: Supcom 2 is like a car, Its got a great engine, suspension and drive train, a sweet *** body where every curve is just right, but the guy at the paint shop accidentally painted it neon pink.
Mike
|
|
| Top |
|
 |
|
BulletMagnet
|
Posted: 04 Feb, 2013
|
|
Joined: 05 Oct, 2007 Posts: 16425 Location: camping near the biggest power-up
|
Try this: Code: if bp.Economy and type(bp.Economy.BuildTime) == 'number' then bp.Economy.BuildTime = bp.Economy.BuildTime * TimeScale3 end Also, spend some time fixing that problem with your sound. It's holding you back as a modder.
_________________
Nephylim wrote: But, an FA army in an FA environment just looks... right. Does anyone know how to use air transports? I cant get them to pick up troops.
|
|
| Top |
|
 |
|
aeoncleanse
|
Posted: 04 Feb, 2013
|
|
Joined: 30 Aug, 2008 Posts: 438 Location: Cambridgeshire, UK
|
BulletMagnet wrote: Try this: Code: if bp.Economy and type(bp.Economy.BuildTime) == 'number' then bp.Economy.BuildTime = bp.Economy.BuildTime * TimeScale3 end Also, spend some time fixing that problem with your sound. It's holding you back as a modder. I don't understand what this code would do/ If it has an economy section, and if the economy section is a certain number, then apply the modification? How does this limit the changes to only those structures built by the corresponding Engineer? Is 2 days time enough? 
_________________
Quote: Supcom 2 is like a car, Its got a great engine, suspension and drive train, a sweet *** body where every curve is just right, but the guy at the paint shop accidentally painted it neon pink.
Mike
|
|
| Top |
|
 |
|
BulletMagnet
|
Posted: 04 Feb, 2013
|
|
Joined: 05 Oct, 2007 Posts: 16425 Location: camping near the biggest power-up
|
|
You are correct, that's exactly what the code does. This should prevent some crashes, if a unit doesn't have a BuildTime.
I'm thinking the Cybran construction drones (oh yes, they are units) might be problematic at times.
_________________
Nephylim wrote: But, an FA army in an FA environment just looks... right. Does anyone know how to use air transports? I cant get them to pick up troops.
|
|
| Top |
|
 |
|
aeoncleanse
|
Posted: 04 Feb, 2013
|
|
Joined: 30 Aug, 2008 Posts: 438 Location: Cambridgeshire, UK
|
Ah, so 'number' does not have to be replaced with a specific value, that tells the code that if it has any value at all, do the if, yes? If it had to be replaced with a specific value that would be useless. The T2 drones don't worry me as they don't have BUILTBYTIER2ENGINEER... Do they? It's a nice bit of safeguard code, and thanks for it. Unfortunately, the main code function is still not working. Is there any way of doing what I want to do?
_________________
Quote: Supcom 2 is like a car, Its got a great engine, suspension and drive train, a sweet *** body where every curve is just right, but the guy at the paint shop accidentally painted it neon pink.
Mike
|
|
| Top |
|
 |
|
Domino
|
Posted: 16 Feb, 2013
|
|
Joined: 26 Feb, 2009 Posts: 2996
|
|
Hi,
The categories table is a numbered table so bp.categories.tag will not work You need to use table.find (categories, 'tag')
A few checks though
If bp.Categories and table.find (bp.Categories, 'TAG') then If bp.Economy then If bp.Economy.BuildTime then --do cool stuff End End End
Sorry I written this on my tablet
_________________ Domino. ______________
|
|
| Top |
|
 |
|
BulletMagnet
|
Posted: 16 Feb, 2013
|
|
Joined: 05 Oct, 2007 Posts: 16425 Location: camping near the biggest power-up
|
|
Well ****, Domino is absolutely right.
_________________
Nephylim wrote: But, an FA army in an FA environment just looks... right. Does anyone know how to use air transports? I cant get them to pick up troops.
|
|
| Top |
|
 |
 |
 |
|