[B18]Range Animal Framework

Started by BrokenValkyrie, January 18, 2018, 05:51:13 AM

Previous topic - Next topic

BrokenValkyrie

Range Animal Framework

Description:
This mods unlocks range attack for animals. Credit to fluffy for the original conception(Animal Range Verb Unlock). I started from here. It is intended for mod animals and currently does not add new animals.

I plan to support more animals. Feel free to make request and suggestion.
Its very likely the mod will need tweaking, feedback will be welcome.

Plans:
Updating behavior so it works better with Run and Gun
Separate mod with range support for mod animals.

Here an example of what the mod can do. Dragon Mod and Red Dragon are show cased here. Credit to Bichang for using my mod.


For Modder:
It is intended that the mod be used as a dependency. The use of Mod Check is recommended. You can just take the animalRangeUnlock.dll and add it to your assemblie folder with the JobDef but keep in mind I'm still updating the mod.


Adding range attack to animal is as simple as adding range verb to new weapons.

Can support multiple verb, use commonality to weight frequency of verb choice. Range of all verb should be kept the same.

Mod is Combat extended compatible, ensure CE verb tags are used instead of vanilla tag.

Patch operation used for adding verbs. Note that Mod Check is used.

See range mega spider for mod example.


  <Operation Class = "PatchOperationSequence">
<success>Always</success>
<operations>
<!--Continue if combat extended does not exist IE patch vanilla-->
<li Class="ModCheck.isModLoaded">
<modName>Combat Extended</modName>
<yourMod>Animal Range Attack</yourMod>
<success>Invert</success>
</li>
  <li Class="ModCheck.FindFile">
<modName>Core</modName>
<file>Races_Animal_Insect.xml</file>
  </li>
      <li Class="PatchOperationAdd">
        <xpath>Defs/ThingDef[defName = "Megaspider"]</xpath>
        <value>
<!--Accuracy needs to be high, because well animal don't have shooting skill-->
<verbs>
  <li>
<verbClass>Verb_Shoot</verbClass>
<accuracyTouch>0.8</accuracyTouch>
<accuracyShort>1</accuracyShort>
<accuracyMedium>0.95</accuracyMedium>
<accuracyLong>0.8</accuracyLong>
<hasStandardCommand>true</hasStandardCommand>
<defaultProjectile>Projectile_Acid</defaultProjectile>
<warmupTime>3.5</warmupTime>
<burstShotCount>1</burstShotCount>
<minRange>4</minRange>
<range>16</range>
<soundCast>Pawn_BigInsect_Call</soundCast>
<muzzleFlashScale>2</muzzleFlashScale>
<!--Commanility determines how frequent this range verb is chosen.-->
<commonality>0.35</commonality>
  </li>

  <li>
   <!--Due to the way its range attack is coded, its advised to keep range stat the same -->
<verbClass>Verb_Shoot</verbClass>
<accuracyTouch>0.65</accuracyTouch>
<accuracyShort>0.75</accuracyShort>
<accuracyMedium>0.6</accuracyMedium>
<accuracyLong>0.55</accuracyLong>
<hasStandardCommand>true</hasStandardCommand>
<defaultProjectile>Projectile_ToxicSpike</defaultProjectile>
<warmupTime>3</warmupTime>
<burstShotCount>3</burstShotCount>
<ticksBetweenBurstShots>7</ticksBetweenBurstShots>
<minRange>4</minRange>
<range>16</range>
<soundCast>Pawn_BigInsect_Call</soundCast>
<muzzleFlashScale>2</muzzleFlashScale>
<commonality>1</commonality>
  </li>
   </verbs>
        </value>
      </li>
  </operations>
  </Operation>


If you intend to make your mod entirely dependent on animal range attack, verb can be added to the animal ThingDef xml tag instead.

For Users:


Range animal behavior:
Animals with range behavior acts differently. Manhunter animal will prioritize targets that are reachable. If it fails to find reachable pawn it will look for shootable target,  this includes target hiding behind embrasure mod.

Tame animals will try to stick close to master to take shots. Tame animal with release trained will seek cover, whether they are released or not. Released animal behave similar to AI defending escorts. Tame animals aren't savvy about avoiding friendly fire, if you have a tame dragon and its about to breath fire, make way.


Updates:

Version 1.2
Removed range mega spider and move it to its own mod.
Removed Dragon Mod range support patch to Dragon Mod.

Acid attack for MegaSpider. There no damage over time but acid damage is similar to burn and in addition pawns will suffer acid toxicity, impairing blood filtration.

Commonality support for range verb. Animal can use multiple verb, commonality can be used to weight how often that attack is chosen.

Supported Mod:

Dragon Mod:  Dropbox Workshop
Red Dragon(Bichang):  Workshop
Frilleus(Bichang):  Workshop
Mega Spider:  DropBox Workshop

License
Use however you wish as long as credits given.

Author/Mod Team
BrokenValkyrie

Download
DropBox
Steam Workshop



Nekokon

I wonder why this topic doesn't get enough attention. This used to be such a huge limitation to animal/creature mods, and now it's finally be resolved.
@Walking Problem: do you plan to restart your pokemon mod with this ? The final piece is here.

Btw anyone know the correct way to tag someone ?

BrokenValkyrie

Probably doesn't get much attention due to timing and the possibility of the novelty must of worn off long time ago. I think there a good reason fluffy abandoned the original mod. As of the moment there isn't much of a demand for animal range attack. Better late than never I guess. With the existence of the mod on the forum I am hoping it would encourage the creation of more creature.

I don't think you can tag people, message Walking Problem if you really want a response.

Canute

Believe me, animal mod authors allready got aware of this mod ! :-)

Just give them some time.

Roolo

#4
This mod deserves more attention as the potential is great, especially with modded animals. I'll update the Giddy-up series, and my RunAndGun mod so that they work nicely together with your mod. One minor note: it would even be cooler if the acid attack would behave more like acid instead of being just an explosion, but I understand that would be harder to implement, and it's already nice as it is. Keep up the good work!

Edit:
Just released an update for RunAndGun and for Giddy-up! so that those mods can be used in combination with your mod. i.e., your colonists can finally ride fire spewing dragons (or other animals) to batte :)

BrokenValkyrie

That is awesome, I was planning to make it compatible but you already did it.

Last item on the list for animal range attack is proper support for multi verbs. Its already coded to support multi verb but it does not take weighting like melee tools.

Sarge

Are there non-Steam options to download the dragon mods?

Harry_Dicks

Man I can't wait to see what modders will do with this. We can finally have pawns riding fire breathing dragons that can attack on the move! Holy Shit!!! Hydralisks from StarCraft!

Hypothetically, could someone recreate the Frozen Orb spell from Diablo with these tools?

BrokenValkyrie

#8
The only limit is what can be done with verb cast. I already tested with orbital power beam, those can be fired from animal.

Basically, can be shot from weapon, can be shot from animal.

WalkingProblem

Quote from: Nekokon on January 19, 2018, 02:43:50 PM
I wonder why this topic doesn't get enough attention. This used to be such a huge limitation to animal/creature mods, and now it's finally be resolved.
@Walking Problem: do you plan to restart your pokemon mod with this ? The final piece is here.

Btw anyone know the correct way to tag someone ?

The whole fucking world is telling me about this~ LOL

Yes, I will be definitely using this.

Quote from: BrokenValkyrie on January 20, 2018, 02:05:27 AM
Probably doesn't get much attention due to timing and the possibility of the novelty must of worn off long time ago. I think there a good reason fluffy abandoned the original mod. As of the moment there isn't much of a demand for animal range attack. Better late than never I guess. With the existence of the mod on the forum I am hoping it would encourage the creation of more creature.

I don't think you can tag people, message Walking Problem if you really want a response.

Dun worry, people are aware, its "viral".

So is this meant to be use like a framework?  Like I just add dependency on this mod?

BrokenValkyrie

#10
Initially it was intended to act like dependency, in similar fashion to HughLibs.

All that is needed is the AnimalRangeUnlocker.dll file and the JobDefs folder. I'm still updating the mod. So dependent mod might need to occasionally update their .dll file with the more recent one.

All that is needed afterwards is to add appropriate range verb to animal, in similar fashion where you add verb to range weapon. I have patch example for Megaspider. Patching isn't required if the mod is entirely dependent on animal range attack, you can simple add the verb to the xml file instead.

Canute

Quote from: BrokenValkyrie on January 24, 2018, 03:29:49 AM
I'm still updating the mod.
Would be nice if you made it modsync compactible, so people know when they need to update.

BrokenValkyrie

Oh I completely forgot about ModSync. I'll look into supporting it.

WalkingProblem

Quote from: BrokenValkyrie on January 24, 2018, 03:29:49 AM
Initially it was intended to act like dependency, in similar fashion to HughLibs.

All that is needed is the AnimalRangeUnlocker.dll file and the JobDefs folder. I'm still updating the mod. So dependent mod might need to occasionally update their .dll file with the more recent one.

All that is needed afterwards is to add appropriate range verb to animal, in similar fashion where you add verb to range weapon. I have patch example for Megaspider. Patching isn't required if the mod is entirely dependent on animal range attack, you can simple add the verb to the xml file instead.

Actually I think its probably better if the AnimalRangeUnlocker.dll is based on your mod (just load yours above); rather then copy and paste and create duplications of the same dll.

Because I had pondered about making my own animal range thingy... but I think no point waste time reinventing the wheel.

So I havent check out what in this mod exactly yet - it would be nice if you create one that is the framework alone (just to allow modders to set the framework is a "required mod") rather than the current one, that is with content. Since I think, some people may not be happy with having ranged megaspider in their infestation event. LOL 

Let me know if you would make one, of should I just duplicate the codes for my own use.

(disclaimer, i really havent look at the mod deeply, so I am talking purely based on what I have read/understand)

BrokenValkyrie

#14
Due to the way code is loaded, only one copy of .dll file is loaded, many copies of AnimalRangeUnlocker.dll can loaded. Similar reason why many copy of Harmony.dll doesn't mess up rimworld.

I decided to split the content and make the current framework standalone. Mod will be renamed to range animal framework. Although its probably one of the lightest framework. Currently the frame works unlocks range verb for animals, provide new behavior range animals. Provide two custom projectile base to better support range animals.

Range mega spider is just an example of what the mod can do. The patch and code will be moved to their respective animal.