Ludeon Forums

RimWorld => Releases => Mods => Outdated => Topic started by: milon on June 06, 2016, 06:01:12 PM

Title: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: milon on June 06, 2016, 06:01:12 PM
Quote from: JuliaEllie on January 26, 2015, 02:17:26 AM
(http://i.imgur.com/WYGlJoy.png)

Hey guys,

this is the new mod - the Holy Hand Grenade of Antioch. Its single use but very powerful.

" And the Lord spake, saying, "First shalt thou take out the Holy Pin. Then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in My sight, shall snuff it. " - Book of Armaments, chapter two.

Have fun!

This mod was made during stream - thanks to everyone who was there <3

Now updated for Alpha 13 goodness!

(https://www.dropbox.com/s/9meloqdrsfnsy02/DropboxDownloadButton.png?raw=1) (https://www.dropbox.com/s/p1dfhfhjqyylz0w/Antioch.zip?raw=1)

This mod adds a single grenade-type weapon to the game, and "should" be compatible with virtually every other mod.  It is untested with other mods, so please report any problems!

Known Issues

License
Anyone is free to to include this mod in modpacks, examine the code, make their own versions, adapt segments of it, etc.  Credit & notification must be given to JuliaEllie (https://ludeon.com/forums/index.php?action=profile;u=11828) (original author).  Crediting and/or notifying me is optional.
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: Dynastiew on June 07, 2016, 06:08:30 AM
Excelent mod!

So when will we see the banana bomb from worms   ;D.
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: RazorHed on June 07, 2016, 06:53:50 AM
Interesting.  Is there a way to have a weapon that disappears like a triple rocket launcher have a set number of uses instead of one time only?
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: milon on June 07, 2016, 07:29:38 AM
With only XML edits, no.  You can specify a melee weapon, a regular ranged weapon, or a one-shot ranged weapon.  Anything else would require a C#/dll mod (and you can do pretty much anything once you get into that).
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: RazorHed on June 07, 2016, 07:43:34 AM
But thats magic , and I don't have a wand !
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: Listen1 on June 07, 2016, 08:05:25 AM
That's very nice.

Might I suggest that your next mods is an event?

Something like...
(https://terrymalloyspigeoncoop.files.wordpress.com/2012/04/killer_rabbit.jpg)

And this
http://vignette4.wikia.nocookie.net/villains/images/3/3c/Monty_Python_killer_rabbit_zpse790d266.gif/revision/latest?cb=20140409192641
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: Dynastiew on June 07, 2016, 08:33:37 AM
replace the beaver by rabbits and the tree by pawns :).
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: milon on June 07, 2016, 01:05:37 PM
I've definitely been thinking along those lines.  And I'm not getting into C# stuff.

Unfortunately the AlphaBeaver incident is hardcoded to summon Alpha Beavers.  :(

I could go the manhunter route, but that requires the manhunting Animal to be a native to that biome.  In other words, there could be cute & cuddly killer rabbits that don't bother your pawns unless you try hunting them.  I'll have to think on this more...

In the meantime, I'm not an artist, but I could make use of RimWorld-style graphics for a Killer Rabbit or a Legendary Black Beast of Aaaaarrrrrrggghhh or something.  *wink, wink*
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: Listen1 on June 07, 2016, 01:24:20 PM
"This is nothing but a flesh wound" Thought

Yeah... I can see a mounty python mod
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: joaonunes on June 07, 2016, 08:22:36 PM
Quote from: Flying Rockbass on June 07, 2016, 01:24:20 PM
"This is nothing but a flesh wound" Thought

Yeah... I can see a mounty python mod

*loses both arms and both legs*
"Lets call it a draw" +5 mood

But seriously, adding some kind of area similar to the ones that hold "ancient dangers" but with a killer rabbit guarding it would be great :D
And of course the rabbit could only be killed by the grenade ;)
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: joaonunes on June 07, 2016, 08:31:33 PM
Quote from: milon on June 07, 2016, 01:05:37 PM
I've definitely been thinking along those lines.  And I'm not getting into C# stuff.

Unfortunately the AlphaBeaver incident is hardcoded to summon Alpha Beavers.  :(

I could go the manhunter route, but that requires the manhunting Animal to be a native to that biome.  In other words, there could be cute & cuddly killer rabbits that don't bother your pawns unless you try hunting them.  I'll have to think on this more...

In the meantime, I'm not an artist, but I could make use of RimWorld-style graphics for a Killer Rabbit or a Legendary Black Beast of Aaaaarrrrrrggghhh or something.  *wink, wink*

Sooo wouldn't it be possible to create a similar event but with rabbits? How hardcoded is it? How did the guys who made "Crash Landing" do their mod? Maybe different mechanics hence the hardcoded event?
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: milon on June 08, 2016, 08:14:43 AM
I just added the license to the OP.  My bad.  ^_^

Anyway, the AlphaBeaver event is hardcoded in that the game activates workerClass "IncidentWorker_Alphabeavers" which isn't defined within the XML content.  It's defined in the compiled libraries, which puts it in the C# realm and out of my reach.  I don't do C# stuff, and I realize now that I didn't actually say that above.  Sorry for the confusion!

The Crash Landing mod is also a C# mod, which lets you accomplish virtually anything you can think of.  Anyone with C# knowledge could copypasta the AlphaBeavers incident into a wandering Rabit of Caerbannog incident.  I'm just saying it's beyond me, and it's not a skill that I'm going to be pursuing.  But anyone who is skilled/interested is most certainly welcome to do so!  (See the newly added license.)
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: joaonunes on June 08, 2016, 08:19:23 AM
Quote from: milon on June 08, 2016, 08:14:43 AM
I just added the license to the OP.  My bad.  ^_^

Anyway, the AlphaBeaver event is hardcoded in that the game activates workerClass "IncidentWorker_Alphabeavers" which isn't defined within the XML content.  It's defined in the compiled libraries, which puts it in the C# realm and out of my reach.  I don't do C# stuff, and I realize now that I didn't actually say that above.  Sorry for the confusion!

The Crash Landing mod is also a C# mod, which lets you accomplish virtually anything you can think of.  Anyone with C# knowledge could copypasta the AlphaBeavers incident into a wandering Rabit of Caerbannog incident.  I'm just saying it's beyond me, and it's not a skill that I'm going to be pursuing.  But anyone who is skilled/interested is most certainly welcome to do so!  (See the newly added license.)

I could try... just need to remove the random number generator so only one spawns and change the messages, right? :P

...the problem is making them stronger or making them unkillable except by the grenades, that is beyond my current skills...
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: milon on June 08, 2016, 09:05:59 AM
I assume you'd need to either remove and RNG or else find a way to specify that it should spawn 1 creature.

And stronger is easy - any vanilla animal is fairly easy, and you just give it more health/speed/whatever.

And making them unkillable except by the grenade should be possible as an xml-only.  :)
Steps:
#1 - Create a new damage type (ie. Holy)
#2 - Create a new animal that's invulnerable to Blunt, Electric, Sharp, and maybe Heat.  See <ArmorRating_Blunt> etc. The value for invulnerable would likely be 10 or 100, testing needed.
#3 - Profit!  (The new animal isn't immune to Holy, and neither is anything else.)  Mwa ha ha!

If you want to do that, I'll help you out if you need it.  Also, see my A13 xml auto-documentation (link in sig).
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: joaonunes on June 08, 2016, 09:42:52 AM
Alright. Maybe after all the exams I'll start development in both my mod and this idea, whichever sounds faster to accomplish :)

EDIT: To be honest, I try to avoid c# but I'd more easily rush into a c# only mod than to a mod where I'd need to use xml files... I need to learn how to get the tags from the xml files :P

EDIT 2: The xml on your signature helps A LOT though, should have found it earlier xD

EDIT 3: There is a damage type called "IgnoreArmor", which does exactly what it sounds like. It acts as if there wasn't any armor at all and the pawn receives full damage from the attack. Making the rabbit resistant to all damage types (except IgnoreArmor of course) either by making him invulnerable or by boosting his armor stats by ridiculous amounts should work :D

I don't really mind doing a bit of c# coding, next week I'll even have c# classes (lucky me xD up until now I was having JSP and PHP...), but I could use a hand at the xml files :D
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: milon on June 08, 2016, 02:26:24 PM
Quote from: joaonunes on June 08, 2016, 09:42:52 AM
EDIT 3: There is a damage type called "IgnoreArmor", which does exactly what it sounds like. It acts as if there wasn't any armor at all and the pawn receives full damage from the attack. Making the rabbit resistant to all damage types (except IgnoreArmor of course) either by making him invulnerable or by boosting his armor stats by ridiculous amounts should work :D

The IgnoreArmor thing sounds useful, but the term "IgnoreArmor" doesn't show up in the xml for A12 or A13 (I keep a concatenated copy for easy searching & reference).  And "ignore" doesn't find anything armor-related.  I really can't find what you're referring to.  Are you maybe thinking of a different game or a different term?
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: joaonunes on June 08, 2016, 04:12:37 PM
"IgnoreArmor" is a damage type that exists in the damage types enumeration in the game engine (c# side, not xml), and is both used in the vanilla engine and in the Combat Realism damage handling. It is there, and it should be recognized if any weapon uses that damage type.
        public enum DamageArmorCategory : byte
{
IgnoreArmor, //  <--- This damage type exists and works!
Blunt,
Sharp,
Heat,
Electric
}


By inspecting some Combat Realism xml and dll files I have reached some conclusions...
I have no idea what to do next, but this could be a start:

<DamageDef ParentName="LocalInjuryBase">
    <defName>Bullet</defName>
    <label>bullet</label>
    <externalViolence>true</externalViolence>
    <battleWound>true</battleWound>
    <deathMessage>{0} has been shot to death.</deathMessage>
    <hediff>Gunshot</hediff>
    <harmAllLayersUntilOutside>true</harmAllLayersUntilOutside>
    <impactSoundType>Bullet</impactSoundType>
    <armorCategory>Sharp</armorCategory>
</DamageDef>


Replace "Sharp" by "IgnoreArmor"
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: milon on June 09, 2016, 10:15:40 AM
Ooh, nice find!  A 5th armorCategory!

Okay, so here's how this works.  <armorCategory> is a bit of a misnomer from my perspective.  None of those DamageArmorCategory things are actually armors, but rather the type of damage it causes.  For example, "Bullet" falls into the "Sharp" damage category and is affected by the <ArmorRating_Sharp> of the thing it hits.  Some <DamageDef> entries don't even have an <armorCategory>, notably the Repair and various Operation actions.

What you want to do is create a new <DamageDef> that ignores armor, and you want to assign that to the holy hand grenade.  There are 2 ways to try it: 1) is to replace Sharp with IgnoreArmor like you said, and 2) is to just delete the armorCategory line (untested, may work or fail or act strangely).

Either way, we need a little more code to make a complete DamageDef file, and we need to know exactly where put it - RimWorld is super picky about where to find all its definitions.  In the Antioch\Defs folder, make a new folder called DamageDefs.  Now you have DamageDefs, RecipeDefs, ResearchProjectDefs, etc all side-by-side.

Inside the DamageDefs folder, create a file with an .xml extension.  You can name it whatever you want, but for sanity choose a sensible name like "DamageDefs.xml".  This is what goes in that file:

Code (Mods\Antioch\Defs\DamageDefs\DamageDefs.xml) Select

<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<DamageDef Name="LocalInjuryBase" Abstract="True">
<workerClass>DamageWorker_AddInjury</workerClass>
</DamageDef>

<DamageDef ParentName="LocalInjuryBase">
<defName>Bullet</defName>
<label>bullet</label>
<externalViolence>true</externalViolence>
<battleWound>true</battleWound>
<deathMessage>{0} has been shot to death.</deathMessage>
<hediff>Gunshot</hediff>
<harmAllLayersUntilOutside>true</harmAllLayersUntilOutside>
<impactSoundType>Bullet</impactSoundType>
<armorCategory>IgnoreArmor</armorCategory>
</DamageDef>
</Defs>


This is just a start.  Since you've modded before (I think?), I'm sure you can work out most of the rationale here.  The file is in the correct folder, has an xml header, and is in the correct "container" element (<DamageDef> items are always defined within a <Defs> container).

The <defName> needs to be replaced with a unique name, like how a variable name must be unique, and it's what you'll use in the holy hand grenade to link it to this new damage type.  I haven't extensively tested what's acceptable for a defName, but I generally just stick to alphabet names.  I think alphanumeric (potentially starting with a letter) is fine too.  The <Label> and <deathMessage> text still needs to be updated.  The <hediff> and <impactSoundType> elements could be changed to something more appropriate (your call, see my auto-documentation file for acceptable examples).

Finally, note that the following is equivalent to the above:

Code (Mods\Antioch\Defs\DamageDefs\DamageDefs.xml) Select

<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<DamageDef>
<workerClass>DamageWorker_AddInjury</workerClass>
<defName>Bullet</defName>
<label>bullet</label>
<externalViolence>true</externalViolence>
<battleWound>true</battleWound>
<deathMessage>{0} has been shot to death.</deathMessage>
<hediff>Gunshot</hediff>
<harmAllLayersUntilOutside>true</harmAllLayersUntilOutside>
<impactSoundType>Bullet</impactSoundType>
<armorCategory>IgnoreArmor</armorCategory>
</DamageDef>
</Defs>


Rather than inherit 1 property from a parent abstract, we can just define it all in 1 block.  This makes more sense for a single-item mod, but if you want to expand into multiple definitions, it's less/cleaner code to inherit some stuff from a parent.  Anything inherited can be overwritten in the child, FYI.


So, now the damage type is defined.  To add it to the holy hand grenade, open up the file Mods\Antioch\Defs\ThingDefs\Weapons_Grenades.xml, and look at line 22: "<damageDef>Bomb</damageDef>"

Replace the word "Bomb" with whatever you called the new damage type in its <defName> tag.  Save, and you're all set!  Try it out!  And feel free to post results here or in a new mod thread if that's the direction you're going (and if so, stick a link here so I can find it).  :)
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: joaonunes on June 09, 2016, 09:25:23 PM
Nicely done :) will put my hands on it right after I finish my mod, or whenever I have the time.

About me being a modder, no I never modded before except my mustache mod which I created about a couple of months ago and it wasn't even my full creation, all the code was made by someone else (go to my mod page and see the credits), only now I am trying to create new functionalities on my own, the only thing I do know is a bit of c# programming and basic understanding on how xml files work. My biggest problem at this moment is for me to understand how exactly this game works and what to change/use to reach my goal... I am slowly getting there though (I hope xD)

Off-topic, if you'd like to know how is the development of my mod going or if you want to lend a hand visit this:
https://ludeon.com/forums/index.php?topic=20561.0 (https://ludeon.com/forums/index.php?topic=20561.0)
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: milon on June 10, 2016, 06:56:11 AM
I'll take a look at it.

One more tidbit that took me a while to figure out: in XML modding, you can't overwrite individual Core parameters (except through Parent/inheritance as stated above). You overwrite & replace an entire Def. For example, if I wanted to add Boom Rats to the Ice Sheet biome, I'd have to rewrite the entire Ice Sheet biome.  (Knowing this from the start of my modding would have saved me hours.)
Title: Re: [A13] The Holy Hand Grenade of Antioch - JuliaEllie - A13Update
Post by: NephilimNexus on June 10, 2016, 05:53:40 PM
You laugh but I've had a colonist killed by a mad squirrel before.