![]() |
Component-dependant engines
I've introduced power reactors to the game, basically just a generic component, and I'm trying to get the engines dependant on it being present for them to work. Since it's not possible to add new 'abilities' from what I could find out, that means I had to use the Get_Design_Specific_Component_Count() function. I first tried putting it in the 'to use' requirement field of the engine without any luck, then I tried using it in the 'movement amount' formula on the engines( i.e. tried setting movement point amount to 0 if no reactor present).
There's simply no way this will work. My two test designs, one with reactor another without, always fly at the same speed. I tried getting a little creative after a while, but alas, reactor or not, it doesn't make any difference between the two ships' speeds. They both fly either 1-2 m/s, or 10 m/s, dependant on how I set up the formula, while I basically want the one with the reactor to fly 10 m/s and the one without to fly 1 m/s( or 0 m/s, but that doesn't seem to be possible). If it wasn't for my very limited capabilities, I'd say the function didn't work properly making it unable to find the reactor component. Any ideas? |
Re: Component-dependant engines
That function doesn't work on components.
You can have a weird workaround by using the method SJ used in GG for his Crew requirement, though.. One way: Requirement 5 Description := Ship requires more reactors to properly power its engines. Requirement 5 Formula := iif(Get_Design_Abilty_Total("Standard Movement") > 2), Get_Design_Abilty_Total_AITAG01 > 1, 1) You can't use that as-is, because I don't remember the format for the AI tags. What this does is if the number of standard move goes above 2, it requires a reactor before the design can be built. It won't slow down due to battle damage, though. |
Re: Component-dependant engines
I tried with a
Requirement 6 Formula := Get_Design_Ability_Component_Count("AI Tag 16") > 0 on the frigate ship type just to test it, but it easily lets me make a ship without it, no warning at all. The reactor component has the "AI Tag 16" ability and everything. *shrug* |
Re: Component-dependant engines
iifs might not work in that file, then. :/ Did you try just the AI tag?
|
Re: Component-dependant engines
Uhuh, think I might have made a mistake.
Yah, looks like it's working now, thanks. Would be nice if there could be a function that looked for a specific ability description, so we could just use the 'Description Only' ability instead of wasting the AI tags and such. |
Re: Component-dependant engines
Actually, there is. Kwok made much use of it in Balance Mod, such as this "ability" on the SDD:
Ability 2 Type := Description Only Ability 2 Description := Automatically used if a ship is successfully boarded, destroying the ship and the attacking ship. Ability 2 Scope := Space Object Ability 2 Range Formula := 0 Ability 2 Amount 1 Formula := 0 Ability 2 Amount 2 Formula := 0 |
Re: Component-dependant engines
Quote:
I was thinking about something like this: <font class="small">Code:</font><hr /><pre>Ability 1 Type := Unique String Ability 1 Description := Ability 1 Scope := Space Object Ability 1 Range Formula := 0 Ability 1 Amount 1 Formula := "UW Basketweaving" Ability 1 Amount 2 Formula := 0 </pre><hr /> Then have a functions like Get_Design_Ability_Unique_String("UW Basketweaving") or some such. Of course, the best thing would be if we could simply add do-nothing abilities to the Main_Strings.txt file! http://forum.shrapnelgames.com/images/smilies/happy.gif |
Re: Component-dependant engines
That's what I was thinking, would make it all much easier.
Fyron: Yeah, the description only ability is there; unfortunately there's not a Get_Design_Ability_Description_Component_Count("De scription here")'ish function. If there was we could add unique 'identifying' abilities to all components we wanted, we'd just need to have a unique description. |
Re: Component-dependant engines
You can actually give an ability any name you want and use formulas for amount1 or amount2 to produce different sorts of data for display purposes. Not sure, but I would think you could use the Get... function with it since it returns just the string.
|
Re: Component-dependant engines
When I try to use "Test" as an ability on a component I get an "Unknown Value" error.
I don't think I'm following what you're saying, CK. |
Re: Component-dependant engines
Yeah, I don't think that works CK. That's what I tried to do the first time basically, although I even added the ability name in the mainstrings file. The game wont start as it doesn't recognize it or some such.
|
Re: Component-dependant engines
My post was sort of incorrect. You can use a blank name for the ability and use amount1 and amount2 to produce formula results such as seeker speed.
I guess you can't just put in any name. http://forum.shrapnelgames.com/image...ies/tongue.gif |
Re: Component-dependant engines
I didn't catch it earlier but Phoenix-D's posting of how SJ used the "Get_Design_Ability_Total" function is a great workaround to not being able to add our own ability types. Using it you can make one AI tag stand in for any number of dummy abilities just by using different amounts for "Amount1" and/or "Amount2."
Ex: AI Tag 01 with an Amount1 of 1 and AI Tag 01 with an Amount1 of 2 could stand for two completely different abilities by using the function call "(Get_Design_Ability_Total("AI Tag 01", 1) = 1)" or "(Get_Design_Ability_Total("AI Tag 01", 1) = 2)" respectively in the requirements field. I hope this ramble makes sense! http://forum.shrapnelgames.com/images/smilies/laugh.gif |
Re: Component-dependant engines
It's not really necessary though, because you can tell the AI to use any component by its name.
|
Re: Component-dependant engines
I was thinking more along the lines of odd requirements where the modder would need to use a dummy ability in order to make his concept work, same as the "Palace" ability was used for SEIV mods.
|
Re: Component-dependant engines
Quote:
|
Re: Component-dependant engines
I don't see why it matters though. The AI scripts can add components directly by a name reference so no special ability tricks are needed. It can't evaluate the ability amounts so most of the special tricks discussed here and really only useful for player restrictions. The AI will have to be told when and how many of these components to add.
|
Re: Component-dependant engines
shinigami said:
I didn't catch it earlier but Phoenix-D's posting of how SJ used the "Get_Design_Ability_Total" function is a great workaround to not being able to add our own ability types. Using it you can make one AI tag stand in for any number of dummy abilities just by using different amounts for "Amount1" and/or "Amount2. That might not work; if you add 2 of the comps with amount1 of 1, you get the same ability total as having 1 of the comps with amonut1 of 2. Though, you might be able to mix it with "Get_Design_Ability_Component_Count("AI Tag 01") == 1", but that limits you to one per ship. |
Re: Component-dependant engines
So this component:
Get_Design_Ability_Component_Count("AI Tag 16") > 0 will demand a component with AI Tag 16? Mmm... |
Re: Component-dependant engines
Quite true, Fyron, it does put a limit on the component of one per ship unless the modder plans things out very carefully.
Also, I've done some testing and have only been able to get the "Get_Design_x" functions to work in the VehicleSizes file so it is not as good a workaround as I had thought. http://forum.shrapnelgames.com/image...s/rolleyes.gif It goes right back to we need to be able to add our own dummy abilities, either in MainStrings or as a separate data file that the game can parse. |
Re: Component-dependant engines
You can always use abiliites that are non-functional in the file in question...
|
Re: Component-dependant engines
Yeah, but if MM wants to make the game really mod friendly (more so than it already is http://forum.shrapnelgames.com/images/smilies/happy.gif ) why not take it all the way and come up with a method for us to use custom dummy abilities?
Of course, this would be something for the future, for now, kill those bugs! http://forum.shrapnelgames.com/images/smilies/laugh.gif |
Re: Component-dependant engines
Well, turns out it was alot easier than using the ability stuff, I got the Get_Design_Specific_Component_Count to work, meaning I don't need to check for any abilities at all. It would be nice if it actually worked on the engine requirements themselves, though, instead of having to give that requirement to every single ship.
|
Re: Component-dependant engines
Quote:
|
Re: Component-dependant engines
Oh, they work. The problem is that some functions don't work in components.txt, including the ones you'd need for this trick.
|
Re: Component-dependant engines
Quote:
For example, Combat Movement with the formulas Get Specific Component Count or Get Design Ability Total do nothing. So problems with the movement formula extend beyond just components.txt. |
Re: Component-dependant engines
It might be those functions only work in requirements, then.
|
Re: Component-dependant engines
I have added just this function to my custom blend of the game, however I used a Reactor piece, didn't make it mandatory. What I did do was removed all but a basic amount of "supply" from ship engines. Changed the ships all over to a fuel based system. Instead of Ion Engines for lvl 1 you get Solar Sails which have 10 supply takes no supply to use and 0.5 movement, and because it's classified as a "engine" the AI will use it. I also redefined supply storage as fuel tanks which are fragile and only hold a small amount, only in late game can you forgo a reactor and have any range. The principle is that the reactor uses your fuel to improve efficiency of the fuel, much like a real ship would use fuel to generate thrust and energy. so just modify AI ship building priorities to include a minimum of supply storage and viola.
I liked this especially because it made my very first ship feel very low tech, with solar sails that were fragile, large and slow, but free to use. |
Re: Component-dependant engines
I'd just like to thanks all the posts here. I had been struggling trying to get mutually exclusive devices (only one type of engine on a ship etc) and couldn't get anywhere. The AI Tag # thing worked perfectly! Thanks. Prior to that no amount of boolean logic seemed to exclude things other than to say '1 of this type allowed'.
A query on a similar vein. I'd like for engines to use fuel based on the number of engines has anyone tried dividing the fuel use by the vessel move to get supply useage? In every mod I've played two ships with the same number of engines but different ship masses will have different fuel useages as the supply listed is used for every move point! Really weird way of doing that. (Edit: OK re-read some of this thread. I guess something similar HAS been tried and failed. Is the formula for reading space based move of a ship one that won't work with components.txt?) Thanks again for the help so far |
Re: Component-dependant engines
Quote:
|
All times are GMT -4. The time now is 08:30 PM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.