Ambrosia Garden Archive
    • Missile launchers using multiple ammo types?


      Look, yet ANOTHER question!

      What I'm trying to do, is make "Mod Kits" for the different missile systems in the shipyard, which allow the player to use a missile launcher to fire an alternative type of ammunition. For example, if you bought the "Flak Missile Mod Kit" you would be able to fire Flak Missiles without having to buy a seperate launcher (of course the Mod Kit would have to be a launcher, but using little or no mass and costing less). In order to do this however, the Mod Kits would need to evaluate wether or not the player owns the launcher, and if so how many.

      This could be partialy done using the outfit Require bits, but I dont know of any way to limit the number of outfits for purchase based on how many of a particular outfit is owned. Is there any way of doing this, or am I going to have to make a bunch of different launchers just to use the different ammo?

    • Better solution:
      The base missile launcher outfit gives you invisible weapon outfits, one for each type of missile ammo possible - and on sell takes these away. The weapons are set not to show up unless they have ammo (there's a flag for this somewhere in the weap resource). And each type of ammo requires that you have the appropriate mod kit installed before you can buy it.
      Issue: ships with any of these weapons as default equipment will need some tinkering with the giving the player outfits on purchase to fill out what the player would've gotten from buying the stuff in the outfitter.

      Another option: Say a mod kit only converts one launcher - and makes that launcher unusable for the default ammo. Then the initial weapon is actually a 'fake' outfit - it has mass, max number, but behind the scenes grants an invisible outfit that's the actual weapon. Then mod kits are only available if one of these invisible outfits is present, and, on purchase, remove one of them. Like the first option, you'll have to do some tinkering with ship outfit lists or onpurchase/oncapture fields.
      Major ugliness to this method: the onsell field for the main launcher 'fake' outfit. You can't just remove one of the invisible outfits - there might not be any there. So you'd have to grant a temporary invisible outfit whose sole purpose is to cause one run of a cron that cleans things up. Not pretty, and will let the player buy launchers, sell launchers, and then buy modkits - that will be removed by the cron as soon as the player takes off.

      I think, overall, the second solution is better. Try one out and see if you can make it work - and don't make the invisible outfits actually invisible until you're sure it all works!

      Good luck.

    • You could use the "Increase Max" ModType. Set the mod kit's max to 0, then have the launchers you want to modify increase that by one every time you purchase one. That way, you can have one mod kit for every launcher. As stated above, the kits would actually be invisible launchers with little or no mass. Use ModTypes 2-4 to have up to three kits modify one launcher.

    • PBoat101, on Sep 26 2004, 12:19 AM, said:

      You could use the "Increase Max" ModType. Set the mod kit's max to 0, then have the launchers you want to modify increase that by one every time you purchase one. That way, you can have one mod kit for every launcher. As stated above, the kits would actually be invisible launchers with little or no mass. Use ModTypes 2-4 to have up to three kits modify one launcher.

      There's a problem with that theory - it would have to be the only one with the "is turret" or "is fixed gun" flag checked in the outf resource.

      I can't believe you people looked over the obvious - the MaxAmmo field of the weap resource. It allows you to set the maximum amount of ammo for each one of that weapon.

    • orcaloverbri9, on Sep 26 2004, 07:49 PM, said:

      There's a problem with that theory - it would have to be the only one with the "is turret" or "is fixed gun" flag checked in the outf resource.

      I can't believe you people looked over the obvious - the MaxAmmo field of the weap resource. It allows you to set the maximum amount of ammo for each one of that weapon.
      View Post

      The modkit isn't the ammo for launcher, so it wouldn't be affected by the MaxAmmo field. Unless I'm misinterpreting what you're saying.

      As for the "Increase Maximum" theory - it actually acts as a multiplier rather than an adder, so you'd have to set the max of the modkit to 1 and then make it require at least one launcher. So you buy one launcher, the modkit becomes available and it's maximum is multiplied by the 1 launcher to still give 1. You buy a second launcher and the max is multiplied by 2 to give 2. I've used something like this before for a turret "addon" to make it fire faster.

      This post has been edited by Guy : 27 September 2004 - 12:04 AM

    • Guy, on Sep 27 2004, 05:00 AM, said:

      The modkit isn't the ammo for launcher, so it wouldn't be affected by the MaxAmmo field. Unless I'm misinterpreting what you're saying.

      Indeed you are. The modkit is a weapon. So, you put the MaxAmmo in the modkit's weap resource so that each modkit can hold X amount of ammo.

    • orcaloverbri9, on Sep 28 2004, 12:47 AM, said:

      Indeed you are. The modkit is a weapon. So, you put the MaxAmmo in the modkit's weap resource so that each modkit can hold X amount of ammo.
      View Post

      But the point is to limit the number of modkits so that you can only buy one for every launcher you already have, is it not?

    • Guy, on Sep 28 2004, 01:28 AM, said:

      But the point is to limit the number of modkits so that you can only buy one for every launcher you already have, is it not?
      View Post

      Yes, that would be the plan.

    • Picquilarius, on Sep 28 2004, 02:40 AM, said:

      Yes, that would be the plan.
      View Post

      Great, so the increase maximum idea will work.

      And for orcaloverbri9 (I've just worked out what you meant about the gun and turret flags), we're talking about modtype 27 - "increase maximum" - which increases the maximum amount of another outfit, rather than modtype 45 or 46 - "modify max guns" or "modify max turrets".

      This post has been edited by Guy : 27 September 2004 - 10:28 PM

    • This is a neat idea. But, would the base launcher need to be non-sellable for this to work properly?That is, if there are multiple mod kit types for the base launcher.

    • slouch, on Sep 28 2004, 11:11 AM, said:

      This is a neat idea. But, would the base launcher need to be non-sellable for this to work properly?That is, if there are multiple mod kit types for the base launcher.
      View Post

      A good point. The easiest way is to do it is to make the base launcher unsellable. You could enable selling by having multiple copies of the base launcher (one for every possible combination of kits) and one copy of every mod kit for every type of base launcher and making heavy use of Availability and OnSell. However, this would take up a lot of resources and would be difficult to say the least.

    • PBoat101, on Sep 29 2004, 01:27 AM, said:

      A good point. The easiest way is to do it is to make the base launcher unsellable. You could enable selling by having multiple copies of the base launcher (one for every possible combination of kits) and one copy of every mod kit for every type of base launcher and making heavy use of Availability and OnSell. However, this would take up a lot of resources and would be difficult to say the least.
      View Post

      Of course, if you just left it at one type of modkit then you wouldn't have half the problems.