PDA

View Full Version : Component.txt Knowledge Base


President_Elect_Shang
November 11th, 2006, 03:54 PM
Has anyone else experienced this problem: In the Research Window the icon (mini pic) next to the name of the tech area is working. The icon (mini pic) in the “Expected Results” at the top of the same window is not showing the component that will be developed next. If you click on the tech area it lists the component though. Does anyone know why this is happening and what the fix is?

EDITED IN: I edited this thread with the intent that ONLY questions and solutions to problems for the Components.txt be posted here. This thread may jump around some as I intend to quote from other threads to here.

President_Elect_Shang
November 11th, 2006, 07:56 PM
I figured out what the problem was. It has to do with me using duel requirements. To get the component pic to show up I had to change the Requirements Evaluation Availability to the number of the controlling requirement. In the example from my component the tech area “C&C” is the controller and the tech area “High Tech” is the restrictor so the controller can not be researched until the restrictor has been satisfied.

Number Of Requirements:= 2
Requirements Evaluation Availability:= 1
Requirements Evaluation Allows Placement:= TRUE
Requirements Evaluation Allows Usage:= TRUE
Requirement 1 Description:= Empire must have achieved C&C tech level 1.
Requirement 1 Formula:= (Get_Empire_Tech_Level("C&C") = 1) AND (Get_Empire_Tech_Level("C&C") < 2)
Requirement 2 Description:= Empire must have achieved High Tech level 1.
Requirement 2 Formula:= Get_Empire_Tech_Level("High Tech") >= 1

Phoenix-D
November 11th, 2006, 08:12 PM
You realize that setup will completely ignore the second requirement, right?

Also, if you don't use [%Level%] in at least one requirement the component will jump straight to the maximum level.

President_Elect_Shang
November 11th, 2006, 10:17 PM
I have to disagree with you, testing has given me other results. In fact I have been testing this successfully with six self-run test empires for over 40 turns. I have even researched and replaced this very component with no other flaws than getting the pic of it to appear in the expected results portion of the research window. The only change I made to get the pic to appear is changing the Requirements Evaluation Availability from “AND” to “1”. It is restricting the component until both are satisfied and since this is not a generational component (there is only 1 level which is phased out for another component) I don’t even have the possibility of having the max level problem.

Captain Kwok
November 12th, 2006, 01:05 AM
PE Shang, I tried this setup but it didn't work...

Phoenix-D
November 12th, 2006, 01:24 AM
Did you take Empire C&C to level 2 or higher when you did that test?

President_Elect_Shang
November 12th, 2006, 02:15 AM
Captain Kwok said:
PE Shang, I tried this setup but it didn't work...



Your right it’s not working now; what happened? How do you make a generational component that will display as an expected result in the research window and requires that two tech areas be met? The more I fool with this the more I miss the SE4 system.

Docwho
November 12th, 2006, 02:18 AM
lol where is the old se4 system when you need.........






That right it is in the se4 folder......

Captain Kwok
November 12th, 2006, 02:47 AM
It shouldn't be a difficult fix for Aaron - all the pending techs are displayed when you right click on the area you're researching...

President_Elect_Shang
November 12th, 2006, 02:55 AM
I noticed that the right click was working too. I wasn’t thinking it might be a fix that Aaron needed and instead thought it was a mistake I had made. The part I can’t figure is how I got the darn thing to work for 40 turns. I was using a save game so there was my mistake! So you feel that is something Aaron has to fix? Which of us should contact him and request it; both maybe?

Captain Kwok
November 12th, 2006, 03:01 AM
It has been reported before - but some fresh e-mails might stimulate a fix.

President_Elect_Shang
November 12th, 2006, 04:40 AM
Now I can’t get the generations to work? Is this something that just happened with the latest patch?

President_Elect_Shang
November 12th, 2006, 04:59 PM
Generational components do not work at all! I set this up:

Number Of Requirements := 1
Requirements Evaluation Availability := AND
Requirements Evaluation Allows Placement := TRUE
Requirements Evaluation Allows Usage := TRUE
Requirement 1 Description := Empire must have achieved C&C Tech level 1.
Requirement 1 Formula := (Get_Empire_Tech_Level("C&C") <= 1)

So if C&C is above tech level 1 this component should not appear in the component list. It is listed. I can’t speak for any other mods but if this doesn’t get fixed my hopes of finally creating this mod are done. I am feeling very depressed about all of this right about now!

Edited in: The components will phase out as they are supposed to; however, the only way I managed to get them to work correctly was to save the game then reload it. In other words by forcing SE5 to read the Components.txt file again. That explains why all of this stuff was working for me before. During my testing I would save, quite, modify, then load the save game over and over.

Phoenix-D
November 12th, 2006, 06:25 PM
That's interesting. If you use the ALLTECH cheat, they do disappear..

EDIT: yep, confirmed. There's a couple of things that don't update until a save is reloaded. Technology that's obsolete does disappear. Pester MM about it. http://forum.shrapnelgames.com/images/smilies/happy.gif

President_Elect_Shang
November 13th, 2006, 12:11 PM
Phoenix-D: First of all full credit goes to David who made the avatar at my request. I just didn’t tell him what it was for! Anyway I added the rank, four stars for a General. So why bother you ask? I noticed that you didn’t have an Avatar and I wanted to say thanks for the help you have given me. My mod wouldn’t be this far along if it wasn’t for your help.

So thanks,
Ed

Devnullicus
November 28th, 2006, 03:57 AM
I'm trying to create a new component that is destroyed after one use, but I can't seem to get it to work correctly. It doesn't seem to get destroyed after one use. Any idea what I'm doing wrong?

Name := External Mount Missile
Description := Externally mounted one-shot heavy duty missile with nuclear warhead.
Picture Number := 87
Maximum Level := 11
Tonnage Space Taken Formula := 10
Tonnage Structure Formula := 10
Cost Minerals Formula := 20 + (([%Level%] - 1) * 5)
Cost Organics Formula := 0
Cost Radioactives Formula := 30 + (([%Level%] - 1) * 5)
Supply Amount Used Formula := 10
Ordnance Amount Used Formula := 5
Can Be Placed On Vehicle Typ := Ship, Base, Satellite, Drone
Can Be Placed In Ship Sections := Outer Hull
Component Type List := Technological
General Group := Weapons
Custom Group := 0
Number Of Requirements := 1
Requirements Evaluation Availability := AND
Requirements Evaluation Allows Placement := TRUE
Requirements Evaluation Allows Usage := TRUE
Requirement 1 Description := Empire must have at least tech level 1 in Missile Weapons.
Requirement 1 Formula := Get_Empire_Tech_Level("Missile Weapons") >= (1 + ([%Level%] - 1))
Number Of Abilities := 3
Ability 1 Type := Ordnance Storage
Ability 1 Description := External Mount Missiles store [%Amount1%] units of ordnance.
Ability 1 Scope := Space Object
Ability 1 Range Formula := 0
Ability 1 Amount 1 Formula := 5
Ability 1 Amount 2 Formula := 0
Ability 2 Type := Component - Destroyed On Use
Ability 2 Description := External Mount Missiles are destroyed on use.
Ability 2 Scope := Space Object
Ability 2 Range Formula := 0
Ability 2 Amount 1 Formula := 0
Ability 2 Amount 2 Formula := 0
Ability 3 Type := Description Only
Ability 3 Description := External Mount Missiles travel at [%Amount1%] km/s and have [%Amount2%] points of damage resistance.
Ability 3 Scope := Space Object
Ability 3 Range Formula := 0
Ability 3 Amount 1 Formula := 40
Ability 3 Amount 2 Formula := 10 + (([%Level%] - 1) * 1)
Weapon Type := Seeking
Weapon Delivery Type := Missile
Weapon Target Type List := Ship, Base, Planet
Weapon Damage Type Formula := "Normal"
Weapon Space At Range Distance Increment := 10.0
Weapon Space Min Damage At Range := 0.0
Weapon Space Max Damage At Range := 0.0
Weapon Space To Hit Modifier At Range := 0.0
Weapon Space Min Damage Modifier Formula := (100 + (([%Level%] - 1) * 20)) - iif([%Range%] > Min(200, (([%Level%] - 1) * 10) + 150), 10000, 0)
Weapon Space Max Damage Modifier Formula := (100 + (([%Level%] - 1) * 20)) - iif([%Range%] > Min(200, (([%Level%] - 1) * 10) + 150), 10000, 0)
Weapon Space To Hit Modifier Formula := 0
Weapon Reload Rate MS Formula := 5000
Weapon Display Type := Directed Torpedo
Weapon Space Display Effect Name := Missile 9
Weapon Ground Display Effect Name := Missile 9
Weapon Explosion Effect Name := [Random Specific Type] Weapon Explosion
Weapon Sound Effect Name := Capital Ship Missile
Weapon Seeker Speed Formula := 0.04
Weapon Seeker Turn Rate := 0.01
Weapon Seeker Tonnage Structure Formula := 10 + (([%Level%] - 1) * 1)
Weapon Seeker Defense Modifier Formula := 50

Moderator Mode:
Post edited to fit into window (stop side scrolling). No content removed. PE Shang

President_Elect_Shang
November 28th, 2006, 11:54 AM
The problem is that weapons fire automatically, meaning you may target them but they fire by themselves. The ability “Component - Destroyed On Use” is a player used ability. It’s like apples and oranges (automatic and player activated) unless you can talk Aaron into re-writing the code this component won’t work the way you want it to. For my Mod I have an XO weapon too; are you copying me? http://forum.shrapnelgames.com/images/smilies/happy.gif Anyway there are two ways to work around your problem.

1. Set the “Weapon Reload Rate MS Formula to a very high number so the weapon will only fire once every combat action. I did this for a type of satellite that was intended to be a one shot deal. Since I couldn’t blow the thing up (like you are trying to do here) I just set the reload time to something absurdly huge.

2. Split your weapon into components (what I did for my XO weapons). First make an XO Rack that launches only “XO Weapons”. Then make a new vehicle called an “XO Weapon. Give the vehicle a limited number of slots and then break the type of missiles you want into components as warheads or weapons. Just remember that your drone/XO Weapon will try to ram regardless of what you put inside. The work around to that is to set the tonnage low (what I did) so when it hits it won’t do much in the way of extra damage. Or there may be a way to create a new strategy for your XO Weapon to use that keeps it from ramming. I haven’t tried this out so that may be a long shot.

Devnullicus
November 28th, 2006, 01:53 PM
Damn. ok, thanks for the advice.

By the way, External Mount Missiles were in devnullmod for SEIV, so, no I'm not copying you. Are you copying me? http://forum.shrapnelgames.com/images/smilies/happy.gif

Kana
November 28th, 2006, 02:05 PM
I still think the 'drone' usage for missiles/seekers is a bad idea for the fact that they dont launch like seeker components like CSM, based on range and target, they will launch more like fighters. This isnt as bad probably for tactical combat, but for simultaneous combat it just doesnt work, so I would defintely go with PES's option 1 over option 2.

Now if we could launch 'drone/unit' objects based on range and target, that would be ideal, then we could make a launcher, seeker platforms, and warhead/components. Anyone in good with Aaron? http://forum.shrapnelgames.com/images/smilies/wink.gif Or do you think its just too late to program in such a thing?

http://forum.shrapnelgames.com/images/smilies/wink.gif http://forum.shrapnelgames.com/images/smilies/wink.gif

President_Elect_Shang
November 28th, 2006, 02:35 PM
@Kana: Thanks I didn’t know about that problem in multiplayer. Now that you point it out I can see it clearly. I will adjust my XO Weapons to match my satellite component from example #1.

@Devnullicus: I never played the devnullmod. Nothing personal but by the time you released it I was knee deep in my attempt at an SE4 version of this my mod. There were other matter that keep me pretty busy at the time. Anyway what is your mod based from?

Captain Kwok
November 28th, 2006, 05:36 PM
Destroyed On use only works with items that can receive "use" orders from the player.

Slick
November 28th, 2006, 06:27 PM
You could do the SE:IV eqivalent of making the reload time > the combat time. This would make a 1-shot weapon.

President_Elect_Shang
November 28th, 2006, 07:03 PM
What am I just confusing here? First CPT Kwok repeats what I said and now you do too Slick. This is a conspiracy to drive me crazy isn’t it? All of you are trying to make me think I never said those things! I’m not losing it, I’m in perfect control! Isn’t that right PE Shang? I don’t see what you’re talking about Ed.

DeadMilkman
December 4th, 2006, 02:24 AM
Ok, what I am attempting is to change master computers to be slightly like SEIV, meaning that as you reasearch them, the space used goes down. I have tried several variations to get the Tonnage to drop in 10Kt increments , but they do not seem to work. Here is an example:
40 - ((int(([%Level%] - 1)) / 7) * 10)
have also tried it using trunc(), and several variations of nesting.

The problem is that neither int() nor trunc() seem to actually work, so the tonnage is decreasing by 2 or 3 Kt increments, instead of 10Kt every few levels as intended.

Any suggestions?
Thanks!

wake_of_angels
December 4th, 2006, 04:05 AM
maybe an iif statement, but I don't know how it is used

President_Elect_Shang
December 4th, 2006, 10:18 AM
DeadMilkman said:
Ok, what I am attempting is to change master computers to be slightly like SEIV, meaning that as you reasearch them, the space used goes down. I have tried several variations to get the Tonnage to drop in 10Kt increments , but they do not seem to work. Here is an example:
40 - ((int(([%Level%] - 1)) / 7) * 10)
have also tried it using trunc(), and several variations of nesting.

The problem is that neither int() nor trunc() seem to actually work, so the tonnage is decreasing by 2 or 3 Kt increments, instead of 10Kt every few levels as intended.

Any suggestions?
Thanks!



Your question is a little confusing; before I can answer let me make sure I know what you want to do. You want the Master Computer to go up every level but you want the space taken to go down by 10kt every seven levels? Or do you want it to go down every level? What does the “int” you are using in your formula mean; Intelligence?

If you want it to go down every level than use: (40 – ([%Level%] * 10) but once you hit level 4 you will have a 0 ton component. You see why I am asking now?

Onomatopoeia
December 4th, 2006, 12:53 PM
I'm not exactly sure where this question should go, but it is about the component.txt file so I suppose this is the best place.
I was told once that SEV still supports the old SE4 weapon damage system (i.e. not formulas but instead 30,30,25,25,20,20 etc).
But I still cannot find a clear answer on exactly how to do it. I think Iremember you have to use the "Weapon Space Min/Max Damage At Range" fields, but no matter how I input the figures it never seems to work, I've tried spaces in between the numbers, tabs, commas, it just won't work.
Any help would be much appreciated, thank you.

President_Elect_Shang
December 4th, 2006, 02:08 PM
I thought Imperator Fyron at one time describe a method that was a sort of back door which allowed you to do just that. Unfortunately I don’t recall how he said to do it. I have sent him a PM asking so he (or me if he sends the message to me and not here) should be getting back to you very soon. This was the right place for this question by the way. If nothing else it can be done in a formula but I suspect you already know this.

Fyron
December 4th, 2006, 03:19 PM
Technically, it was SJ.

Take a look at a snippet from the DUC:

Weapon Space At Range Distance Increment := 10.0
Weapon Space Min Damage At Range := 0.0
Weapon Space Max Damage At Range := 0.0
...
Weapon Space Min Damage Modifier Formula := blah formula we don't care about
Weapon Space Max Damage Modifier Formula := blah formula 2

The Damage At Range lines are exactly like SE4, except you can use decimals. They are a space-delimited listing of damage values. The range increment is moddable, as you can see from the first line. IIRC, the first value is used at ranges up to the distance increment, the second value is used at ranges up to 2x the distance increment, and so on.

Damage done at any range is the sum of the appropriate value from the Damage At Range list and the result of the Damage Modifier Formula (the damage is random between the Min and Max values).

Let's take an example:

Weapon Space At Range Distance Increment := 20.0
Weapon Space Min Damage At Range := 50.0 40.0 30.0
Weapon Space Max Damage At Range := 50.0 40.0 30.0
...
Weapon Space Min Damage Modifier Formula := iif([%Range%] < 60, (5 * ([%Level%] - 1)), 0)
Weapon Space Max Damage Modifier Formula := iif([%Range%] < 60, (5 * ([%Level%] - 1)), 0)

This is a range 60 weapon that increases damage by 5 per level. A short chart of resultant damage at range values (taken at increments of 10 to look like SE4 damages):

L1: 50 50 40 40 30 30
L2: 55 55 45 45 35 35
L3: 60 60 50 50 40 40
L4: 65 65 55 55 45 45
L5: 70 70 60 60 50 50
...

Fyron
December 4th, 2006, 03:23 PM
DeadMilkman said:
Ok, what I am attempting is to change master computers to be slightly like SEIV, meaning that as you reasearch them, the space used goes down. I have tried several variations to get the Tonnage to drop in 10Kt increments , but they do not seem to work. Here is an example:
40 - ((int(([%Level%] - 1)) / 7) * 10)



Erm... what is wrong with just:

40 - (([%Level%] - 1) * 10)

(excessive parenthesis cause I still don't trust SE5's order of operations...)

If that doesn't produce the desired results, you have found a bug and should report it to se5 at malfador.com (with as simple a data file as you can send).

Phoenix-D
December 4th, 2006, 04:05 PM
It looks like he wants it to stay the same for several levels, THEN drop 10kt..

President_Elect_Shang
December 4th, 2006, 04:18 PM
That was my impression, but how many levels till the next drop 7? I don’t know why he is dividing level minus one by seven or what the int is for. Maybe he is thinking he has to tell SE5 it is an integer before he declares it? Integer or Intelligence?

Thank you for helping out Imperator Fyron. Is that what you were looking for DeadMilkMan? I dub thee DMM! http://forum.shrapnelgames.com/images/smilies/cool.gif

Fyron
December 4th, 2006, 11:16 PM
DMM is already reserved for Deathstalker's Mount Mod. http://forum.shrapnelgames.com/images/smilies/wink.gif

Ah, drop after several levels. Gotcha. Here is a horrible way to do it:

Note the if-else function:

iif(cond, A, B)

This means, if cond is true, return A. Else, return B. You can naturally put other functions in for A and/or B.

Now to apply it:

40 - iif([%Level%] >= 5, 20, iif([%Level] >= 3, 10, 0))

This will make it:

L1: 40
L2: 40
L3: 30
L4: 30
L5: 20
L6: 20
L7: 20
...


Hmm... a possibly less crazy way that gets the same progression:

iif([%Level] >= 5, 20, iif([%Level%] >= 3, 30, 40))

Or, as a purely aesthetic issue, if you want to see decreasing sizes, just invert:

iif([%Level] < 3, 40, iif([%Level%] < 5, 30, 20))

DeadMilkman
December 5th, 2006, 12:05 AM
President_Elect_Shang said:

Your question is a little confusing; before I can answer let me make sure I know what you want to do. You want the Master Computer to go up every level but you want the space taken to go down by 10kt every seven levels? Or do you want it to go down every level? What does the “int” you are using in your formula mean; Intelligence?

If you want it to go down every level than use: (40 – ([%Level%] * 10) but once you hit level 4 you will have a 0 ton component. You see why I am asking now?



You were correct that I wish the space taken to go down approximately every seven levels (although that number is somewhat arbitrary).

The "int()" in the formula should be an integer function, assuming that Aaron has programmed the formulas to follow standard coding practice. Which I would think he would since he is in fact a programmer http://forum.shrapnelgames.com/images/smilies/happy.gif

The integer function should drop anything after the decimal point, but this does not seem to be working. I was hoping maybe the trunc() function may be something similar, but it also does not seem to work.

The reason for this is if the decimal is not truncated, the value returned would not go in increments of 10Kt, but instead in smaller increments equal to the rounded value of the decimal. Which is unfortunately what it seems to be doing anyways http://forum.shrapnelgames.com/images/smilies/happy.gif


Imperator Fyron said:
Erm... what is wrong with just:

40 - (([%Level%] - 1) * 10)

(excessive parenthesis cause I still don't trust SE5's order of operations...)

If that doesn't produce the desired results, you have found a bug and should report it to se5 at malfador.com (with as simple a data file as you can send).



Nothing really wrong with that formula, I just wanted it to go in increments of 10, instead of incremints of 1, which yours does.

It is no big deal really, I am just trying to get a hang of the formulas in SEV. I actually just suspect that it is a bug, and will email it in.


DOH, didnt notice that this thread was already 3 pages long, so missed some replys there.

Phoenix D basically has the idea, Imperator Fyron , that solution should work fine, I just hate nesting IIF's if avoidable, I always end up messing those up.

I put the -1 in the formula at some point because I kept getting into negative Kt otherwise (this is using the formula helper on the SEV editor).

As I said, I mainly posted the question because I suspect the INT() formula is not working as it should.

Of course it is entirely possible that I just dont remeber how int functions are supposed to work, considering my normal brain function http://forum.shrapnelgames.com/images/smilies/happy.gif

Fyron
December 5th, 2006, 01:47 PM
DeadMilkman said:
Nothing really wrong with that formula, I just wanted it to go in increments of 10, instead of incremints of 1, which yours does.


Huh? How does the level * 10 bit not go in increments of 10?


Of course it is entirely possible that I just dont remeber how int functions are supposed to work, considering my normal brain function http://forum.shrapnelgames.com/images/smilies/happy.gif


I'd consider it more likely that there is no such function in SEV land. http://forum.shrapnelgames.com/images/smilies/wink.gif Or if there is, it was never tested...

President_Elect_Shang
December 5th, 2006, 02:11 PM
Actually int is one of the functions called from the main string. Thus far everything I have tried from the main string works; once I figured how to use it that is. Now I am not saying everything there works, just that the ones I have used have all worked. Another possibility is that int works but not with components.

Hay DeadMilkMan, did you try “int()” or “Int()” because int is nothing to SE5 but Int() [notice the capital I] means round toward zero I believe. Round() should round off to the nearest whole number if that is what you want.

DeadMilkman
December 5th, 2006, 08:26 PM
Imperator Fyron, you are correct, as I said, my brain isn't what it used to be http://forum.shrapnelgames.com/images/smilies/happy.gif
The formula you suggest would cause a 10kt drop in space every level, which would make the component 0kt at level 5, and then it would go into negatives after that. The reason I divided it by 7 is it would spread the reduced component size across the 20 research levels at roughly 1/3 intervals ending with a final component size of 20Kt, although I am considering dividing it by 6 instead which theoretically would cause levels 19 and 20 to result in a 10Kt component.


President_Elect_Shang said:
Actually int is one of the functions called from the main string. Thus far everything I have tried from the main string works; once I figured how to use it that is. Now I am not saying everything there works, just that the ones I have used have all worked. Another possibility is that int works but not with components.

Hay DeadMilkMan, did you try “int()” or “Int()” because int is nothing to SE5 but Int() [notice the capital I] means round toward zero I believe. Round() should round off to the nearest whole number if that is what you want.



Nope, I've only tried int not Int, will give it a shot when I get a chance, round may work fine too, will check it out.

Thanks.

DeadMilkman
December 5th, 2006, 08:28 PM
Btw President_Elect_Shang, where do I find the main string?

President_Elect_Shang
December 5th, 2006, 08:43 PM
MainString.txt is one of the files in the same directory as the component file you are modding. Please remember to make a backup copy of any file you are going to mod before you mod it. Any you can just call me PES, much easier! http://forum.shrapnelgames.com/images/smilies/happy.gif

DeadMilkman
December 5th, 2006, 10:13 PM
Thanks for the info, I use a mod directory for my playing around so as not to mess up my game http://forum.shrapnelgames.com/images/smilies/happy.gif

PES works fine for me, just remember, copy and paste is my friend.

DM.

DeadMilkman
December 7th, 2006, 02:47 AM
Update: I found the problem with my original formula, I'm an idiot as usual, and missplaced a (.

So I have runs some tests, and all 4 of the methods discussed work as they should.
Method 1. using 40 - ( Int(([%Level%] - 1) / 7) * 10)
Method 2. using 40 - ( Trunc(([%Level%] - 1) / 7) * 10)
Method 3. using 40 - ( Round(([%Level%] - 1) / 7) * 10)
Method 4. using 40 - iif([%Level%] >= 19, 30, iif([%Level%] >= 15, 20, iif([%Level%] >= 8, 10, 0)))

Each method gives slightly different results as expected, except that Trunc and Int seem to be the same.

Hopefully this will be usefull to everyone.

President_Elect_Shang
December 7th, 2006, 03:03 AM
Excellent contribution; thank you DeadMilkMan!

Captain Kwok
December 21st, 2006, 02:51 PM
I know a lot of modders are interested in Space Yard Expansions. Once possible way to achieve that in SE:V is to use the "Space Yard Rate Modifier" ability on your expansion facility. Perhaps someone can test that and see if it works - I think it just might. http://forum.shrapnelgames.com/images/smilies/tongue.gif

Fyron
December 21st, 2006, 04:24 PM
The next patch might have a very easy, clean way to do SYEs...

Devnullicus
September 4th, 2007, 11:57 PM
Does anyone know why this doesn't work? Specifically, it always gives shield points as if there were 0 stars in the system. [%NumberOfStars%] is used in Formulas.txt, so it should be usable in other places as well, correct?

Edit: I even tried putting the formula in formulas.txt and then using the name in components.txt and it still acts as if there are 0 stars. *sigh*. I really wish there were easy ways to add variables like this to formulae.

<font class="small">Code:</font><hr /><pre>
Name := Star Shield
Description := Generator that creates an energy field around a starship preventing damage that gets stronger the more stars there are in the star system
Picture Number := 52
Maximum Level := 20
Tonnage Space Taken Formula := 25 - trunc( ( [%Level%] - 1 ) * 0.7 )
Tonnage Structure Formula := 25 + trunc( ( [%Level%] - 1 ) * 0.75 )
Cost Minerals Formula := 200 + ( ( [%Level%] - 1 ) * 10 )
Cost Organics Formula := 100 + ( ( [%Level%] - 1 ) * 5 )
Cost Radioactives Formula := 160 + ( ( [%Level%] - 1 ) * 8 )
Supply Amount Used Formula := 0
Ordnance Amount Used Formula := 0
Can Be Placed On Vehicle Types := Ship, Base, Satellite, Weapon Platform, Drone
Can Be Placed In Ship Sections := Inner Hull, Outer Hull
Component Type List := Technological
General Group := Shields
Custom Group := 0
Number Of Requirements := 2
Requirements Evaluation Availability := AND
Requirements Evaluation Allows Placement := TRUE
Requirements Evaluation Allows Usage := TRUE
Requirement 1 Description := Empire must have at least tech level 1 in Shields.
Requirement 1 Formula := Get_Empire_Tech_Level("Shields") &gt;= ( 1 + ( [%Level%] - 1) )
Requirement 2 Description := Empire must have at least tech level 1 in Stellar Manipulation.
Requirement 2 Formula := Get_Empire_Tech_Level("Stellar Manipulation") &gt;= ( 1 + ( [%Level%] - 1) )
Number Of Abilities := 1
Ability 1 Type := Shield Generation
Ability 1 Description := Shield Generators provide [%Amount2%] normal shield points.
Ability 1 Scope := Space Object
Ability 1 Range Formula := 0
Ability 1 Amount 1 Formula := "Normal Shields"
Ability 1 Amount 2 Formula := 100 + ( ( [%Level%] - 1 ) * 10 ) + ( ( 50 + ( ( [%Level%] - 1 ) * 10 ) ) * [%NumberOfStars%] )
Weapon Type := None
</pre><hr />

Captain Kwok
September 5th, 2007, 12:57 AM
Check pg 52 of the modding pdf file - it has a short list of string substitutes that can be used in the data files.

Fyron
September 5th, 2007, 01:48 AM
Devnullicus said:
Does anyone know why this doesn't work? Specifically, it always gives shield points as if there were 0 stars in the system. [%NumberOfStars%] is used in Formulas.txt, so it should be usable in other places as well, correct?

I suspect that pretty much every data field has its own parser... or at least there are several parsers for different "types" of data fields, perhaps related to file. There is very little crossover in having functions and built-in variables that work in one place translate successfully to another. For example, only a system has any stars, so only files dealing with systems or stellar object properties would ever even need to consider having access to the [%NumberOfStars%] variable... or so Aaron's thinking seems to go.

Edit: I even tried putting the formula in formulas.txt and then using the name in components.txt and it still acts as if there are 0 stars. *sigh*. I really wish there were easy ways to add variables like this to formulae.

You cannot use formulas in Formulas.txt in any fields in the data files where they are not already used (pretty much just planet temperature/radiation/gravity field). There is absolutely no support for user-defined functions in the data files (only the AI/event/intel scripts).