Trying to apply a multiplier to MaxStructure

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderators: Oberlus, Committer, Oberlus, Committer

Post Reply
Message
Author
User avatar
Ta'Lon
Space Squid
Posts: 66
Joined: Sat Feb 01, 2014 5:03 pm

Trying to apply a multiplier to MaxStructure

#1 Post by Ta'Lon » Thu Feb 27, 2014 6:59 am

I'm currently working on an idea for some new ship parts, utilizing the core slot concept.

What I'm TRYING to do is to multiply the base Structure value (not current or max structure, but the initial value listed in ship_hulls.txt), and subtract/add said derived value from/to MaxStructure.

I've tried a few things, including adding a new BaseStructure variable via ship_hulls.txt files, no go. Either the game ignores my math or the part disappears...

I'm assuming that a new variable would need to be added somewhere out of reach of the .txt files...

I've tried a few iterations:

SetMaxStructure value - (Target.MaxStructure*.67)
This does nothing, I'm guessing modifying the same variable you are applying the modifer to is a no no. (Not a programming genius here)

And I tried a number of other 'iterations' that I can't remember now, including modifying the SetStructure modifier instead (which I don't think would do what I need anyways, i.e. I think that approach would have 'fully' repaired Structure to 1/3 of Max each turn, but I tried...).

I did try changing the part to Armour and modifying that value,i.e.:
capacity = (0 -(MaxStructure*0.33))
didn't go well...

I can't just apply a minus, as this part can go on a number of hulls. My 'goal' is to take a 15 'base' structure down to 5, but if I simply subtract 10, well then the smaller hulls go 0 or negative on structure...

My intent is to let armor add bonuses in it's usual fashion after this modifier is applied (i.e. adds the capacity value to the MaxStructure value, the same way it does now).

My goal is...
5 structure becomes 2
10 structure becomes 3/4
15 structure becomes 5
etc. etc. etc.

I also have another part that I'd like to modify MaxStructure in the other direction (adds 50% to structure).

These parts are not stackable, and are currently designed for 'core slots', which the hull types I have this in mind for would only have one of (in my idea anyways). My other 'core' parts/modifiers are working pretty well at the moment.

Any suggestions/ideas on how to do this (apply a multiplier to MaxStructure)?
Conquering the galaxy, one planet at a time...

Any artwork that I submit for use in the graphics forum is submitted under the CC-BY-SA 3.0 License.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12675
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Trying to apply a multiplier to MaxStructure

#2 Post by Geoff the Medio » Thu Feb 27, 2014 7:50 am

...the initial value listed in ship_hulls.txt...
Note that there's nothing special about that value... All it does is cause an effect to be created in the hull that does the equivalent of "SetMaxStructure Value + X" where X is whatever number is specified. Note that X can only be a simple number like "2.5" or "18", and not a complicated value reference like "Target.Stealth + 3".

Consequently, there's no way to reliably get at that value in an effect. You can reference the MaxStructure the ship had at the end of the previous meter update (ie. with all effects applied), or the Value of the MaxStructure meter as it's being accumulated (all effects applied after starting from 0) during the current effects execution.
SetMaxStructure value - (Target.MaxStructure*.67)
You could do something like "SetMaxStructure Value/3". Whether this will works as you want will depend on the order of operations though; whatever "Value" is will depend on what effects have already been applied to the object so far during the current effects update.
...I'm guessing modifying the same variable you are applying the modifer to is a no no.
Any time you do an effect like "Value + 5", it's modifying a meter while referencing its current value... Your phrasing is too vague to be clear if what you mean is possible.
My intent is to let armor add bonuses in it's usual fashion after this modifier is applied (i.e. adds the capacity value to the MaxStructure value, the same way it does now).
Detailed orderings of effects such as this likely will depend on cami's efforts towards effects priorities / sequencing, and may not be possible with the current system, which imposing a particular order of effects being applied to objects, depending on what content they come from (species, specials, techs, buildings, hulls, parts, fields)
My goal is...
5 structure becomes 2
10 structure becomes 3/4
15 structure becomes 5
etc. etc. etc.
Meters such as structure are floating point variables, so you'd get 5/3, 10/3, and 15/3, unless you do some special efforts to implement rounding, though I'm not sure if or how that'd be possible.

User avatar
Ta'Lon
Space Squid
Posts: 66
Joined: Sat Feb 01, 2014 5:03 pm

Re: Trying to apply a multiplier to MaxStructure

#3 Post by Ta'Lon » Thu Feb 27, 2014 11:21 am

The /3 did what I needed it to do, at least according to the stats in the ship design window. So that appears to have done the trick... Thanks!
Conquering the galaxy, one planet at a time...

Any artwork that I submit for use in the graphics forum is submitted under the CC-BY-SA 3.0 License.

Post Reply