Question about abilities and formulas |
Is it possible to use Get_Empire_Tech_Level as a variable in an ability calculation?
What I'm thinking of doing is trying to bring in something like the Cultural Centers from the SE:IV Proportions mod, give them a variety of abilities, and make the abilities increase based on different tech levels. Like, say, the mineral extraction value gets a bonus based on the mineral extraction tech and the research point value going up with the research tech level.
I guess what I'm looking for is something like:
Ability 1 Type := Mined Resource Generation - Minerals
Ability 1 Description := Mines [%Amount1%] minerals each turn.
Ability 1 Scope := Space Object
Ability 1 Range Formula := 0
Ability 1 Amount 1 Formula := 3000 + ([%Get_Empire_Tech_Level("Minerals Extraction")%] * 100)
Ability 1 Amount 2 Formula := 0
So my "cultural center" would have only one level but its resource production and abilities would hopefully grow as you gained techs in other areas. I'm also hoping I can create the entry for the cultural center, but give it an impossible tech level and have it only appear on homeworlds via the HomeworldStartingFacilities file.
Wondered if anyone tried this and if it worked for them before I go breaking things in my game. 

GETL works good in formulae!
It will work. It has been used for example to allow armor advances to improve missile damage resistance etc.
-----
Ooh GETL? *IDEA* Your lord
Ooh GETL? *IDEA*
Your lord and master (below Foamy) LordHavoc

GETL
For ship designs, the result of "GETL" saved to the design, so advancing tech / trading ships won't change its value? Seems like it should be, but before I base a mod on it I"d like to be sure.
There are 10 types of people in the world:
Those that understand binary, and those that don't.

Another another question....
When modding weapons, how do the formulas work? Looking at them, I can't make heads or tails of them.
There are 10 types of people in the world:
Those that understand binary, and those that don't.

Stock Damage Formula
The stock formula falls into 3 pieces. The first part of the formula is the damage amount minus the second term which is the damage decrease at range, and lastly if IIF statement at the end tells the game if the range is more than X, subtract -10000 (ie make damage zero) and that's the maximum range.
-----

Ok...
Just to check, here's a formula from the game:
(20 + (([%Level%] - 1) * 5)) - (([%Range%] / 10) * 0.00) - iif([%Range%] > Min(80, (([%Level%] - 1) * 10) + 40), 10000, 0)
It breaks down into two parts:
20 + (([%Level%] - 1) * 5)) - (([%Range%] / 10) * 0.00)
The first half of this controls the damage done by a given level, and teh second half adjusts for range. However, this is the "default" formula and I can change it to something like...
(20+(([%Level%]-1)*5)/(2^([%Range%]/10)))
and have a weapon which halves in damage every 10 units of range.
The second half:
iif([%Range%] > Min(80, (([%Level%] - 1) * 10) + 40), 10000, 0
still leaves me a little confused. I get that "if range is greater than the min" but the entire min value leaves me confused. Where's the 80 come from? How does it figure in (or not in) to the "(([%Level%] - 1) * 10) + 40)" part? And what does the zero at the end control?
There are 10 types of people in the world:
Those that understand binary, and those that don't.

More Dmg formula stuffs
The Min function returns the lower of two items, min(a, b). In this case what's lower 80 or the weapon level * 10? In this case the 80 represents the maximum allowed range of the weapon.
The IIF function than looks at the condition, which in this case is the range value more than what Min returns? If yes, then the value to subtract is 10000, and if false its 0.
-----

I think
I think so, it would certianly allow it. I wonder how we could get it to return the HIGHER of two values, though...
And Kwok, if I read this right, if the damage reduces to 0 naturally (say because the diminising damage formula reduced that much) it would range cap that way, instead of needing the iif, right?
There are 10 types of people in the world:
Those that understand binary, and those that don't.
Nope
The line
Weapon Space At Range Distance Increment := 10.0
is what causes the range to increase up to a maximum of 300
However, the IIF is what is used to determin a weapons 'maximum' range. It does this by checking to see if a weapon has fired "x" distance, if it has gone beyond it, it reduces the damage by 10000.
You can see it in this code
Weapon Space Min Damage Modifier Formula := (20 + (([%Level%] - 1) * 5)) - (([%Range%] / 10) * 1.67) - iif([%Range%] > Min(90, (([%Level%] - 1) * 10) + 30), 10000, 0)
Your lord and master (below Foamy) LordHavoc
Yep
The iif statement is what determines maximum range. I have no idea what the Distance Incriment field does; changing doesn't seem to have an effect.
Foamy: in your example, that's not fixed at all. It uses the either 90, OR the result from ([%Level%] - 1) * 10) + 30). That means the gun starts at 30 range and goes up by 10 per level until it reaches 90.
I didn't say fixed.
I never said it was fixed. And i'm not Foamy, he's the TRUE lord and master. I can't measure up to him...no one can.
Your lord and master (below Foamy) LordHavoc

So....
So if I increase that value, will it be possible to increase teh relative maximum range of thigns? (One of the reasons I'm modding missiles onto drone bodies is I DETEST how short range weapons are ATM -- you can go through the long-ranged weapons "fire zone" very quickly to get to point blank, especially if both sides are going head on).
There are 10 types of people in the world:
Those that understand binary, and those that don't.
Not sure about that one.
Not sure about that one. Could be hard-coded. The interface only goes up to 300.
Your lord and master (below Foamy) LordHavoc

Poking around some more...
OK, poking around in the files a little more, I've realised that "iif" is actually an if/else combination statement. iff([condition],[if true do this],[else do this]).
Things are starting to make a LOT more sense, yay!
There are 10 types of people in the world:
Those that understand binary, and those that don't.
Max range
The max range is 500 ls. The stock CSM gets to about 160 LS max, so you've got plenty of room to play with.
Give yourself a pat on the
Give yourself a pat on the back. You've taken the first step into becoming a modder.
Now you've got to make something and release it.
Your lord and master (below Foamy) LordHavoc

O RLY
Now you've got to make something and release it.
Your lord and master (below Foamy) LordHavoc
And here I was, thinking the first step was waaaaay back when I first started modding SEIV (OK, so I started out on MoO3... don't kill me!)
There are 10 types of people in the world:
Those that understand binary, and those that don't.





Yes, I believe Suicide
Yes, I believe Suicide Junkie and Captain Kwok have used both the concepts you want to use in their respective mods - it should work
~~~
Mr. Flibble says...
Game over, boys!