Ludeon Forums

Ludeon Forums

  • December 05, 2022, 09:46:34 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17  (Read 8149 times)

Jaxxa

  • Super Tester
  • Planetologist
  • ***
  • Posts: 1236
  • Refugee
    • View Profile
[MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« on: August 06, 2014, 01:44:51 AM »

Turret Ammo

About:
This mod adds a new Rail-gun turret and a Boomrat turret that is powerful but requires a supply of ammunition to keep firing.

I am open to sugestions on ballancing.
It is also designed as a demonstration and instructions on how to add turrets that require ammunition into other mods.

To use:
Firstly install and activate the mod.

Then Build the turret added by this mod "ElectroMagnetic RailGun"
Then build one or more hoppers next to the turret and fill it with the required ammunition. In this turret it will need 5 shells to fire, this should be shown in the info panel.

Once the ammunition is delivered you will be able to power up the turret.
Each time it fires it will remove the ammunition from one of the Hoppers. If there is insufficient ammo the turret will powerdown and will not be able to be reactivated until it is supplied with ammo again.

I have also added a turret that uses Boomrats to fire something similar to inferno rounds.

Modding:
To add ammo usage to another "Building_TurretGun" object follow these instructions:

Add Class="TurretAmmo.TurretAmmoThingDef"  to the ThingDef so it looks like:
<ThingDef Class="TurretAmmo.TurretAmmoThingDef" ParentName="BuildingBase">


Change the thingClass to be "TurretAmmo.Building_TurretGun_Ammo"
<thingClass>TurretAmmo.Building_TurretGun_Ammo</thingClass>

Between the <building> </building> tags add:

<wantsHopperAdjacent>true</wantsHopperAdjacent>

Add the following Tags: (without the comment lines)

/// This is the Type of Ammunition that this Turret Requires
<ammoType>Shells</ammoType>

/// This is the amount of ammunition that this turret requires for each salvo
<ammoAmountUsedToFire>1</ammoAmountUsedToFire>

/// Should the turret have an internal Ammunition supply
<internalAmmoEnabled>true</internalAmmoEnabled>

/// The limit of the internal ammunition supply
<internalAmmoMAX>80</internalAmmoMAX>

/// Each time an ammoType object is taken from a hopper this is how much the internalAmmoCurrent should go up by, use this to allow 1 shell to fire the turret multiple times.
<internalAmmoMultiplier>1</internalAmmoMultiplier>

/// The starting amount of ammunition when it is built
<internalAmmoCurrent>40</internalAmmoCurrent>

These are what type of Ammunition and how much is needed for each volly.

You will currently also need to add a power requirement to each turret.

ChangeLog:
0.01
   - Private Version
0.02
   - Initial Public release
0.03
   - Renamed Mod to TurretAmmo
   - Renaming classes and variables to be more Generic
   - Altered range to remove error related to drawing too big a radius
0.04
   -Renamed the mod
   -Internal Ammo Storage Option
   -Enhanced messaging to avoid messages running off the end of a line.
   
Planned:
   - SingleShot Railgun
   - AutoLoader - Hopper Alternative?
      -Better compatibility with mods that change Hoppers
   - Stunned Boomrats?
   - Ammunition Production buildings? - Using Stone?

Legal:
This work is licensed under http://creativecommons.org/licenses/by/4.0/
Boomrat turret top graphic by Kirid
Thanks to Architect for sharing some code that was helpful.

If you have any questions let me know.

Download:
Log in and select the version you want at the end of the post.
    ||
    ||
   \||/
    \/

[attachment deleted by admin: too old]
« Last Edit: September 25, 2014, 09:45:38 PM by jaxxa »
Logged

Jaxxa

  • Super Tester
  • Planetologist
  • ***
  • Posts: 1236
  • Refugee
    • View Profile
Re: [MOD] (Alpha 5) EMRG 0.03 - Turret Ammo + Boomrat Turret - 2014-08-08
« Reply #1 on: August 07, 2014, 07:32:33 PM »

Added a turret that fires Boomrat meat.
« Last Edit: August 09, 2014, 07:27:47 AM by jaxxa »
Logged

Jaxxa

  • Super Tester
  • Planetologist
  • ***
  • Posts: 1236
  • Refugee
    • View Profile
Re: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« Reply #2 on: August 16, 2014, 11:30:13 PM »

Updated to Alpha 6

Zeta Omega

  • Colonist
  • ***
  • Posts: 300
  • Mechanoid General
    • View Profile
Re: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« Reply #3 on: August 16, 2014, 11:52:00 PM »

Now...im not saying this is HORRIBLE or evil..its great really the idea of using ammunition and missiles for some turrets/launchers...I just hope we never have ammo for the weapons.... Great job though
Logged

Kirid

  • Colonist
  • ***
  • Posts: 372
  • Resident Polemicist
    • View Profile
Re: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« Reply #4 on: August 17, 2014, 12:34:45 AM »

HAHA! Fantastic! It's a bit odd having the cage full of boomrats attached to the side while it requires boomrat meat for ammo. I wonder if you couldn't change the ammo to require actual boomrats somehow. And the shots that are fired to be boomrats. But I like it! Nice sound effects and explosion effect.
Logged
You can't rollerskate in a muffalo herd

Jaxxa

  • Super Tester
  • Planetologist
  • ***
  • Posts: 1236
  • Refugee
    • View Profile
Re: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« Reply #5 on: August 17, 2014, 01:11:16 AM »

Now...im not saying this is HORRIBLE or evil..its great really the idea of using ammunition and missiles for some turrets/launchers...I just hope we never have ammo for the weapons.... Great job though
Thanks, Yeah, I agree that there is no need to count the Ammo of every small arms weapon. Although if pawns could get a limited ammo rocket launcher...

HAHA! Fantastic! It's a bit odd having the cage full of boomrats attached to the side while it requires boomrat meat for ammo. I wonder if you couldn't change the ammo to require actual boomrats somehow. And the shots that are fired to be boomrats. But I like it! Nice sound effects and explosion effect.

Yeah, that is easily done. Just change the ammoType value in the XML.
The boomrat cannon is a bit of a work in progress. It also doesn't make sense for the boomrat to explode when you kill it and then explode again when fired from the cannon.

Ideally I will make a stun gun that you fire at boomrats and then turns them into a unconscious boomrat resource without exploding that you can then fire from the cannon.

Reaper

  • Colonist
  • ***
  • Posts: 121
  • Reveried Refugee of The Northern Rim
    • View Profile
Re: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« Reply #6 on: September 21, 2014, 04:22:41 PM »

can you make TTMs soon to be included domesticated boom rats work? with the mod? Can you get that ammo loader working? As it is can't use the normal rail-gun because the hopper is overwritten.
Logged

Jaxxa

  • Super Tester
  • Planetologist
  • ***
  • Posts: 1236
  • Refugee
    • View Profile
Re: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« Reply #7 on: September 21, 2014, 07:22:40 PM »

can you make TTMs soon to be included domesticated boom rats work? with the mod? Can you get that ammo loader working? As it is can't use the normal rail-gun because the hopper is overwritten.

There probably wont be another update until after Alpha7 is out.
I will create a new type of hopper then so that it wont be overwritten.

I probably wont get around to working on fixing up the boomrats for a while. I am planning to integrate this mod with my Shields mod at some stage so it may happen then.

Killaim

  • Colonist
  • ***
  • Posts: 237
  • Refugee
    • View Profile
Re: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« Reply #8 on: September 21, 2014, 08:09:07 PM »

oh firing live boomrats would be uber if they made their little squeek the intire distance flying

bwhahahah
Logged

Jaxxa

  • Super Tester
  • Planetologist
  • ***
  • Posts: 1236
  • Refugee
    • View Profile
Re: [MOD] (Alpha 6) TurretAmmo 0.04 - 2014-08-17
« Reply #9 on: September 25, 2014, 09:52:13 PM »

This is my reply to the  Mortar Hoppers thread (http://ludeon.com/forums/index.php?topic=6148.15), but i figured it would be better over here.

It won't change them out of the box. But it should only need some changes to the xml def. You may also have to add a power requirement even if it is only 1 watt, because that is the system it usses to sit it down. If you know a bit about modding you should be able to set it up with the instructions on the page. Of not let me know and I can help, or just make the mod.

thanks, i'll check it out later. (i'm currently looking into gameplay vids of this game someone recommended in the off-topic sub called.. "starsector". it looks so awesome..   :o )

anyways, which xml defs should i be looking at (asides from Buildings_Security) ?

edit : i checked it out, trying to compare a normal mortar turret to one of your turret artillery cannons : (sorry not much experience making mods on rimworld other than very basic stuff)

questions galore :

* verb? how does this work? (not familiar with this, is there a tutorial/ruleset for making custom verbs?)
* also there's ThingDef Name, and ThingDef ParentName for both the gun and the bullet. how does this work? why the need to separate?
* your turret comps are different from the default mortar comps (does this control self-destruct explosions?)
* e-type changed to equipment (normal mortars don't seem to have this tag)
* label,equipmentType,isGun, weaponTags tags? (mortars doesn't seem to have it, what does these do?)
* alwaysHaulable (is this the tag that allows hoppers attached to this to accept hauled items?)
* tickerType or cooldownTicks (does this control the reload/downtime?) or wait.. is it the warmupTicks and the cooldownTicks that control reload?
* what's the difference between combatTargetBuilding, from targetParams like canTargetPawns,canTargetBuildings?
* hasStandardCommand true? (do mortars need this tag?)
* the forcedMissRadius tag is attached to the mortar rather than the bullet? so does this mean i need different mortars to get different accuracy, instead of just switching to more accurate ammo types?
* also, i can't seem to find which tag requires the electricity part..

i'm still pretty much confused.. lol

So I am not certain about a lot of those things, but if you are only looking to add ammo usage to the Mortar you are making it 10 time more complex than it has to be.

All you really need to do is:
  • Install This mod, mainly to get the DLL's
  • Copy the Turret that you want to add an ammo requirement to. In your case copying the Mortars from core
  • Go through the modding instructions on page 1, the goes through what to do to change the thing def and thing type and additional stats that it currently uses.
  • You will also need a power CompPowerTrader, probably have a look at the improvised turret for examples on that
  • Changes to the Hopper to make it take ammo should already be in place from the mod

That should get you a Mortar turret that needs ammunition. For the specifics on customizing the turrets you would probably be best posting in the mod help forum.

Let me know how you go with that.