I wanted to ask if it is at all possible to have a non-resource item be part of the costList for a building. For example, I was thinking of trying to make the Minigun item be a necessary component of an automated minigun turret. Currently this doesn't appear to be supported. Is the only option to modify the core minigun so that it is a resource and not a weapon? :-(
I know another person on here had the same idea, but that thread died.
Currently the best solution appears to be making a minigun resource (eg: "minigun barrel") and preserve the original minigun item as-is. But I'm hoping there might be a better way since having an item be a necessary component to making another item would be awesome.
You should be able to add non-resource items to a cost list, at least I always thought you could. I'll try it in a sec and get back to you.
Just tested, it does work, however it throws an error whenever you go to look at the item in the menu, so I am surprised it actually works XD I'll pry further for you, see if I can clear up the error problem.
Thank you. I got the error message on start-up and just assumed I messed up the game. I was about to post a suggestion for this on the suggestions thread but will wait to see what you find. By the way, this is how I implemented it:
<costList>
<li>
<thingDef>Gun_Minigun</thingDef>
<count>1</count>
</li>
<li>
<thingDef>Metal</thingDef>
<count>160</count>
</li>
</costList>
edit: By golly, you're right! It totally does work! From now on I will be more skeptical of thrown errors. This made my day!
And you implemented it spot on :P copy the minigun def into your mod, along with the base gun it inherits, then put: <resourceCountPriority>Middle</resourceCountPriority> somewhere in the minigun def. That should solve your errors, and allow your thing of choice to cost the minigun :D
OMG That's wonderful! It removes the error! And now I'm starting to grasp the big picture. I'll have to put this knowledge on the wiki!
Quote from: jpwrunyan on April 29, 2014, 05:24:45 PM
OMG That's wonderful! It removes the error! And now I'm starting to grasp the big picture. I'll have to put this knowledge on the wiki!
Aye do that! the more information on the wiki, the easier modding will become for people :D
This thread made my day.
Can you guys post the error message it throws? I can fix this.
Quote from: Tynan on April 30, 2014, 01:02:16 PM
Can you guys post the error message it throws? I can fix this.
The error is:
Looked for nonexistent key Gun_Pistol in counted resources.
Thanks.
This should be fixed up in next build.
Awesome, good to know :D
Quote from: Tynan on April 30, 2014, 02:42:50 PM
This should be fixed up in next build.
I'm guessing that "resourceCountPriority" will have a silent default? When I (or someone else) writes a tutorial for this it can be left out for simplicity's sake then. Or better, explained alongside information about resources in general.
It just affects the ordering of the resources as they're counted on the top left of the screen. The bug was with the fact that the global resource counter doesn't count things which don't have a count priority, but when you build something the UI code queries the global count to see if the cost number should be red as it is displayed next to your mouse. It queried, found no record, threw exception.
So is the fix literally just as simple as sticking the right tag in the weapon base XML def?
Quote from: Architect on May 01, 2014, 04:58:49 PM
So is the fix literally just as simple as sticking the right tag in the weapon base XML def?
For now, that'd do it.
Excellent XD I'm glad the advice I gave jpwrunyan is actually correct then