Author Topic: New weapon type  (Read 6127 times)

FlessenGreendart

  • Full Member
  • ***
  • Posts: 206
    • View Profile
New weapon type
« on: August 20, 2014, 01:49:48 pm »
Hey all,

I wonder if you guys have any idea:

I'm trying to create a new weapon type. I'm using the term broadly, as really, what I want to do is not technically a weapon but a ship "plugin"

Basically, I've built a ship, and I want it to have a radar dish that faces where you're aiming. Not really firing anything, but just pointing.

I've implemented it theoretically, as it shows up in the store, and I can equip it to it's dedicated slot, but if I hover over the hull icon to get the tooltip info, or if I undock, the game crashes, citing an unknown (non-existent) xml file.

I can't find anywhere that defines weapon slots elwhere... Do you know what else I would need to do?

Lurler

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1320
    • View Profile
Re: New weapon type
« Reply #1 on: August 21, 2014, 01:43:49 am »
Hey, welcome to the forums! Also love your avatar :)

Now, back on topic. Could you copy the exact error message?
Also, can you give a link to the actual XML file? I might be able to figure out what is wrong.

FlessenGreendart

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: New weapon type
« Reply #2 on: August 21, 2014, 03:44:34 am »
Thanks, made it with the set I've uploaded!

I'll send the info across when I get back home, but what I've done so far, is in the data/items folder, created a new folder named weapons_5_decal - or something like that, added in an xml for the "weapon" made sure the category was set to 5, and in the hull xml added a weapon slot as category 5.

It's definately reading the weapon xml, as like I said, it shows in the store and on the hanger tab, and I can equip it to the hull, and the mesh/texture loads fine. It looks like the tooltip doesn't know how to handle the weapon category (I think)

Lurler

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1320
    • View Profile
Re: New weapon type
« Reply #3 on: August 21, 2014, 03:49:11 am »
Ah, so that's the problem then. You can only use categories that are actually present in the game as each category of weapons are handled differently.
So far there are only 4: energy, ballistic, missile, mines.
So no, unfortunately you can't simply create a new category like that.

FlessenGreendart

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: New weapon type
« Reply #4 on: August 21, 2014, 03:52:47 am »
Ah. I figured that might be the case, as there didn't seem to be a file defining the categories. I had hoped that I'd just overlooked something.

In that case, would there be a way to set a slot on a ship that can only take these decorative items, so as not to have a potentially overpowered ship?
Like maybe setting the decorative items to energy weapons level 4, and only having these decorative items at that level?

FlessenGreendart

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: New weapon type
« Reply #5 on: August 21, 2014, 09:13:42 am »
To answer my own question, no, you can't add a new turret level (or size, as it's defined in the xml), either.

Can anyone else think of how to add this?

Lurler

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1320
    • View Profile
Re: New weapon type
« Reply #6 on: August 21, 2014, 08:13:29 pm »
You could technically create a normal weapon, with new model as you described, and make it so that it simply doesn't shoot. Or shoots invisible beam with no damage.

Hammish

  • Sr. Member
  • ****
  • Posts: 350
    • View Profile
Re: New weapon type
« Reply #7 on: August 22, 2014, 12:02:22 am »
About the only way I can think of, and it would be imperfect, would be to put an effect on the ship hull you want to be able to pull this off.  I did verify that it works today, though.

Ergo, you might add an effect to the qualifications list (or any effects list really) called use_radar_dish.  Then, on the hull under effects, you'd want to set the value on use_radar_dish_ability to 1.  Then, on the dish itself, you just make it a requirement to have use_radar_dish at 1 or higher.  This will limit the dish the only hulls you specifically give that attribute.  You can of course use any variable name you want. :D

Unfortunately that won't -force- a person to put the dish weapon in that slot; they could just choose to tack on another damage-dealing weapon.  The only thing I can think of trying to stop this would be something along these lines:  Make sure the dish is an energy weapon and the only required effect to equip is use_radar_dish=1.  (It should not even have the use_energy_weapons requirement)  Then, on the hull, set not only use_radar_dish_ability=1, but also use_energy_weapons_ability=-3.

The core principle is that you want to allow the dish to still be mounted while denying all other energy weapons.  In order for a module to fit into a slot, it must past both the slot type test and the effects test.  So if the above effects actually worked, a player who had level 3 use_energy_weapons (large turrets) on a 'generic' hull would instead be left with level 0 use_energy_weapons (not usable) at all but a use_radar_dish of 1.  The dish requires an energy slot and that use_radar_dish, so it'll equip.  A light energy turret, say, would require an energy slot and at least level 1 use_energy_weapons... so it fails and will not equip.

Please note the secondary fix is theoretical, though.  I know you can put effect modifiers on ship hulls that will change what you can equip, but I have no idea if you can apply a negative modifier to a qualification skill to make it unusable.  If you can, though.. handy trick. :)

FlessenGreendart

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: New weapon type
« Reply #8 on: August 22, 2014, 01:57:33 am »
Thanks for the replies, guys.

You could technically create a normal weapon, with new model as you described, and make it so that it simply doesn't shoot. Or shoots invisible beam with no damage.

That's what I've done, set it as an energy weapon - level one, with most stats set to zero (but with an added radar range)

@Hammish

Interesting concept, but that'd be hoping that use_radar_dish=1 overruled use_energy_weapons_ability=-3, plus I don't think the level 1 energy weapons have a skill requirement to deny..
If it would mean adding a requirement to all energy weapons, I don't want to do that, for the sake of making my mod give as little impact as possible, to maximise compatibility.
I'm going to have to do some experimenting, and get back to you with that.

Having said all that, I'm beginning to think that setting it to a weapon slot isn't a bad idea, because then you're forced with a decision: Weapon or booster.
If I set the boost to a high enough value (e.g. radar range +50, or a shield array, offering a boost to shield value, or even increasing the amount of device slots) it might be enticing enough to sacrifice a weapon.
Especially if you wanted a freighter or miner instead of a combat ship.