Ludeon Forums

RimWorld => Releases => Mods => Outdated => Topic started by: BrokenValkyrie on January 18, 2018, 05:51:13 AM

Title: [B18]Range Animal Framework
Post by: BrokenValkyrie on January 18, 2018, 05:51:13 AM
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 (https://ludeon.com/forums/index.php?topic=16091.0). 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.
(https://steamuserimages-a.akamaihd.net/ugc/920291799816967108/3ED652420CA4A54D27D09945B5F20A963B6C2BD3/)

For Modder:
It is intended that the mod be used as a dependency. The use of Mod Check (https://ludeon.com/forums/index.php?topic=36534.0) 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 (https://www.dropbox.com/s/am81bhtmhfkyl1u/Dragon%20Mod.zip?dl=0) Workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=1214454061)
Red Dragon(Bichang):  Workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=1231153652)
Frilleus(Bichang):  Workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=1268011256)
Mega Spider:  DropBox (https://www.dropbox.com/s/4u7cxgm8a5zcwud/MegaSpider%20Range%20Attack.zip?dl=0) Workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=1280670227)

License
Use however you wish as long as credits given.

Author/Mod Team
BrokenValkyrie

Download
DropBox (https://www.dropbox.com/s/fwkh5b5wmsvyr3g/RangeAnimalFramework.zip?dl=0)
Steam Workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=1263611490)

(http://verify.modsync.ninja?78067134-b029-42ba-ad15-464478b55644) (http://www.modsync.ninja)
Title: Re: [B18]Animal Range Attack
Post by: 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 ?
Title: Re: [B18]Animal Range Attack
Post by: 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.
Title: Re: [B18]Animal Range Attack
Post by: Canute on January 20, 2018, 04:00:56 AM
Believe me, animal mod authors allready got aware of this mod ! :-)

Just give them some time.
Title: Re: [B18]Animal Range Attack
Post by: Roolo on January 20, 2018, 05:30:08 AM
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 :)
Title: Re: [B18]Animal Range Attack
Post by: BrokenValkyrie on January 20, 2018, 09:24:21 PM
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.
Title: Re: [B18]Animal Range Attack
Post by: Sarge on January 23, 2018, 01:12:43 PM
Are there non-Steam options to download the dragon mods?
Title: Re: [B18]Animal Range Attack
Post by: Harry_Dicks on January 23, 2018, 01:33:40 PM
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?
Title: Re: [B18]Animal Range Attack
Post by: BrokenValkyrie on January 24, 2018, 12:08:49 AM
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.
Title: Re: [B18]Animal Range Attack
Post by: WalkingProblem on January 24, 2018, 01:57:35 AM
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?
Title: Re: [B18]Animal Range Attack
Post by: 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.
Title: Re: [B18]Animal Range Attack
Post by: Canute on January 24, 2018, 03:41:10 AM
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.
Title: Re: [B18]Animal Range Attack
Post by: BrokenValkyrie on January 24, 2018, 03:43:28 AM
Oh I completely forgot about ModSync. I'll look into supporting it.
Title: Re: [B18]Animal Range Attack
Post by: WalkingProblem on January 24, 2018, 01:38:30 PM
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)
Title: Re: [B18]Animal Range Attack
Post by: BrokenValkyrie on January 24, 2018, 11:19:25 PM
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.
Title: Re: [B18]Animal Range Attack
Post by: WalkingProblem on January 25, 2018, 03:57:48 AM
Quote from: BrokenValkyrie on January 24, 2018, 11:19:25 PM
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.

Kk, I will study it and see how to implement for my mods. Thanks thanks
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on January 30, 2018, 11:05:19 AM
I'm completely new to modding and have just started creating a mod that aims to add a variety of weird and wonderful monsters to the RimWorld, varying from over-sized versions of existing or extinct creatures, to tech-infused cyborgs and fantasy inspired theme-park attractions gone wrong.

The first creature that I'm creating is the Inferno Beetle, which should be able to fire incendiary launcher shots.
I understand that in order to do that, I need to include this mod into my own, either as dll in the Assembly (which is what I've currently got), or by copying over certain parts of the XML.

I'm struggling to work out exactly what bits I need, if any other parts, and how to set the creature to actually use the attack. Could someone please explain it to me?

Thanks in advance.

EDIT: I have almost everything about the creature working, so this should be one of the final details.
Title: Re: [B18]Range Animal Framework
Post by: Harry_Dicks on January 30, 2018, 03:22:11 PM
Are you trying to have an animal use the incendiary launcher, or have an animal have a ranged attack that is similar to the incendiary launcher?
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on January 30, 2018, 03:59:05 PM
QuoteAre you trying to have an animal use the incendiary launcher, or have an animal have a ranged attack that is similar to the incendiary launcher?

I managed to get it working perfectly.
I transferred over the AnimalRangeUnlocker.dll to my Assemblies folder, transfered the AnimalRangedJob.xml to my JobDefs and am currently implementing the patch for CE.
EDIT 2: I'll be looking into compatibility with "A Dog Said", "Combat Extended", "Giddy Up" and "Run and Gun".
I'm unlikely to catch up in a timely fashion on compatibility lists if once I have a backlog of creatures, so it makes sense to get them all sorted and in a routine from the start. It also gives me longer to come up with another creature, since I started with only one creature idea.

I created a new shoot verb for the Inferno Beetle that fires an incendiary launcher projectile, using the bullet type from the base game.
My animal effectively has an in-built Incendiary Launcher from the base game, and with nearly double the accuracy, since the creatures don't benefit from shooting skills.

I tested it and it very nicely burned the quicktest colonists.

Not sure if I'll publish the mod with only one monster, (here's a link to my help thread (https://ludeon.com/forums/index.php?topic=38879.msg395229#msg395229)), but when I do publish it, I'll be sure to let you all know to add the Monster Mash to the list of mods that are using this fantastic tool.

Thank you very much.
Title: Re: [B18]Range Animal Framework
Post by: Harry_Dicks on January 30, 2018, 06:05:50 PM
Quote from: ilikegoodfood on January 30, 2018, 03:59:05 PM
I managed to get it working perfectly.

-snip-

I tested it and it very nicely burned the quicktest colonists.

Nice! I think if you decide you are finished working on your mod, that you should release it. It may not be a lot to you, but I can guarantee that if you don't mind, others will use yours as a "framework" (am I using that word correctly?) and build some of their own creatures with the work you've done! That is just my suggestion, at least. Why not give back to such a great community, and put a little more good in the world? ;)
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on January 30, 2018, 07:25:27 PM
QuoteI think if you decide you are finished working on your mod, that you should release it.

I have finished the one creature, but I hope to come up with and add many more once I sort out a production routine.

I would like to sort out compatibility with "A Dog Said", "Combat Extended", "Giddy Up" and "Run and Gun", before adding any more creatures (I haven't come up with a second yet anyway).
It would allow me to create a creature, process the compatibility mods for it and then create a new creature. A simple routine that shouldn't be too hard to follow. I feel like if I wait with the compatibility until I have more creatures, I'll loathe having to work on them all as a big bath of duplicate code.

EDIT: I think that, once I've sorted all of the compatibilities for the Inferno Beetle, I may well release a one-monster alpha.
Title: Re: [B18]Range Animal Framework
Post by: BrokenValkyrie on January 30, 2018, 11:24:34 PM
Giddy up, and "run and gun" supports animal range attack. Animal don't run and gun often, I'll try to work on it sometime within the next week.
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on January 31, 2018, 02:05:22 PM
I think that I have the Combat Extended Patch working as I want it too, all except for a single pair of errors, that may be to do with this mod, and not my patch.

So, using the CE_Patch from the Megaspider sample mod as a guide, and updating it to match CE's core patch for the Incendiary Launcher, I get the following verb addition for the shot:
<li Class="PatchOperationAdd">
<xpath>*/ThingDef[defName = "InfernoBeetle"]</xpath>
<value>
<!--Accuracy needs to be high, because well animal don't have shooting skill-->
<verbs>
<li Class="CombatExtended.VerbPropertiesCE">
<recoilAmount>0.5</recoilAmount>
<verbClass>Verb_Shoot</verbClass>
<!--<verbClass>CombatExtended.Verb_ShootCE</verbClass>-->
<hasStandardCommand>true</hasStandardCommand>
<defaultProjectile>Bullet_30x64mmFuel_Incendiary</defaultProjectile>
<warmupTime>2.5</warmupTime>
<range>15</range>
<burstShotCount>0</burstShotCount>
<soundCast>Pawn_BigInsect_Call</soundCast>
<soundCastTail>GunTail_Medium</soundCastTail>
<muzzleFlashScale>1</muzzleFlashScale>
<targetParams>
<canTargetLocations>true</canTargetLocations>
</targetParams>
</li>
</verbs>
</value>
</li>


Now as you can see, I have two possible verbClass lines, that each present a different error when used.
The currently active one (<verbClass>Verb_Shoot</verbClass>) allows the creature to target enemies and behave accordingly, but I get a System.InvalidCastException when it tries to fire the shot.
The commented-out option (<verbClass>CombatExtended.Verb_ShootCE</verbClass>) Throws up an AI error when the Inferno Beetle turns manhunter.

I believe that what has happened, is that the way the shot is called, the verb, has been changed from the a17 to the b18 version of CE, so it no longer recognizes Verb_Shoot, however, the JobDef provided by this Range Animal Framework requires it. This bit is an educated guess, as I'm still very new to this.

Could someone please help me squash this bug-duo?

Thanks in advance.

Here's the error logs:
Verb_Shoot
Exception ticking InfernoBeetle22076: System.InvalidCastException: Cannot cast from source type to destination type.
  at Verse.Verb_LaunchProjectile.TryCastShot () [0x00000] in <filename unknown>:0
  at Verse.Verb_Shoot.TryCastShot () [0x00000] in <filename unknown>:0
  at Verse.Verb.TryCastNextBurstShot () [0x00000] in <filename unknown>:0
  at Verse.Verb.WarmupComplete () [0x00000] in <filename unknown>:0
  at Verse.Verb_LaunchProjectile.WarmupComplete () [0x00000] in <filename unknown>:0
  at Verse.Verb_Shoot.WarmupComplete () [0x00000] in <filename unknown>:0
  at Verse.Stance_Warmup.Expire () [0x00000] in <filename unknown>:0
  at Verse.Stance_Busy.StanceTick () [0x00000] in <filename unknown>:0
  at Verse.Stance_Warmup.StanceTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn_StanceTracker.StanceTrackerTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()


CombatExtended.Verb_ShootCE
Exception in Verse.AI.ThinkNode_Priority TryIssueJobPackage: System.NullReferenceException: Object reference not set to an instance of an object
at CombatExtended.Verb_LaunchProjectileCE.CanHitTargetFrom (Verse.IntVec3,Verse.LocalTargetInfo,string&) <0x001f3>
at CombatExtended.Verb_LaunchProjectileCE.CanHitTargetFrom (Verse.IntVec3,Verse.LocalTargetInfo) <0x00056>
at CombatExtended.Verb_ShootCE.CanHitTargetFrom (Verse.IntVec3,Verse.LocalTargetInfo) <0x00088>
at AnimalRangeAttack.ARA_AttackTargetFinder.CanShootAtFromCurrentPosition (Verse.AI.IAttackTarget,Verse.AI.IAttackTargetSearcher,Verse.Verb) <0x000b0>
at AnimalRangeAttack.ARA_AttackTargetFinder.BestAttackTarget (Verse.AI.IAttackTargetSearcher,Verse.AI.TargetScanFlags,System.Predicate`1<Verse.Thing>,single,single,Verse.IntVec3,single,bool) <0x004f4>
at AnimalRangeAttack.ARA__ManHunter_Patch.Prefix (RimWorld.JobGiver_Manhunter&,Verse.AI.Job&,Verse.Pawn&) <0x002bd>
at (wrapper dynamic-method) RimWorld.JobGiver_Manhunter.TryGiveJob_Patch1 (object,Verse.Pawn) <0x00072>
at Verse.AI.ThinkNode_JobGiver.TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams) <0x00021>
at Verse.AI.ThinkNode_Priority.TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams) <0x000a2>

Verse.Log:Error(String)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_Conditional:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_Tagger:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_Subtree:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage(Pawn, JobIssueParams)
Verse.AI.Pawn_JobTracker:DetermineNextJob(ThinkTreeDef&)
Verse.AI.Pawn_JobTracker:TryFindAndStartJob()
Verse.AI.Pawn_JobTracker:EndCurrentJob(JobCondition, Boolean)
Verse.AI.MentalStateHandler:TryStartMentalState(MentalStateDef, String, Boolean, Boolean, Pawn)
Verse.AI.Pawn_MindState:StartManhunterBecauseOfPawnAction(String)
Verse.AI.Pawn_MindState:Notify_DamageTaken(DamageInfo)
Verse.Pawn_HealthTracker:PreApplyDamage(DamageInfo, Boolean&)
Verse.Pawn:PreApplyDamage(DamageInfo, Boolean&)
Verse.Thing:TakeDamage(DamageInfo)
CombatExtended.BulletCE:Impact(Thing)
CombatExtended.ProjectileCE:TryCollideWith(Thing)
CombatExtended.ProjectileCE:CheckCellForCollision(IntVec3)
CombatExtended.ProjectileCE:CheckForCollisionBetween()
CombatExtended.ProjectileCE:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on February 01, 2018, 10:01:13 AM
My mod, with only one creature right now, is up, both here on the Forums (https://ludeon.com/forums/index.php?topic=38918.0) and the Steam Workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=1288174761).

Since it uses the Range Animal Framework and since you've been helping me with it, I thought you might like to know.
Thank you for the help.
Title: Re: [B18]Range Animal Framework
Post by: CrazyMalk on February 01, 2018, 12:39:01 PM
Oh man! Why didn't I discover this before! Amazing!
Title: Re: [B18]Range Animal Framework
Post by: Harry_Dicks on February 01, 2018, 12:44:15 PM
Quote from: CrazyMalk on February 01, 2018, 12:39:01 PM
Oh man! Why didn't I discover this before! Amazing!

Because it just came out, silly! ::)
Title: Re: [B18]Range Animal Framework
Post by: CrazyMalk on February 01, 2018, 12:48:05 PM
Ha! Now it makes sense! I always tried to use the mechanoid/custom gun technique!
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on February 10, 2018, 05:46:46 AM
I have a small question for you BrokenValkyrie...

Does this mod add support to animals for defensive ability, similar to smokepop belts and/or shields?
If it doesn't, would this be something that you are interested in adding to the framework?

The reason I'm asking is because I recently made the Land Kraken for my Monster Mash mod, and it would be cool if it could squirt ink (mechanically a smokepop belt) to defend itself from bullets.
Title: Re: [B18]Range Animal Framework
Post by: Harry_Dicks on February 11, 2018, 12:44:16 AM
Mister or Miss BrokenValkyrie, I think it's really strange how a handful of mods that I had been looking at, all happened to be yours or maintained by you! I wanted to ask, would you please consider putting your other mods onto dropbox as well? I am very interested in these mods especially: Dermal Regenerator, both Beast Men patches, Dragons, Disinfectant Stand, and definitely Septic Tank. I actually made a post a long time ago asking about if we could have a septic tank, and dubwise said he didn't want it in the mod anymore.

Anyway, I would hope that you would please consider my request. I also wanted to thank you for all of your mods that you put out, and I definitely appreciate your work. I think other users would appreciate your work posted off of Steam as well! Thanks ;D
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on February 18, 2018, 07:51:01 AM
I have discovered an unidentified bug with my duplicate of the MegaSpider RangeAttack's patch to add the shoot verb.

I've been trying to solve it over on on my own thread. The following quote is of my latest post, but it should also act as a link back to the others, which includes the code, if you need it.

Thanks for your help.

EDIT: Managed to find a workaround by isolating each PathOperationAdd in their own sub-sequence. It's tacky but it works for now.

Quote from: ilikegoodfood on February 18, 2018, 06:57:52 AM
wwWrith, do you remeber that when we switched the patch operation for the RangeAnimalFramwork from <success>Always</success> to <success>Normal</success>, we received a log for a phantom error that didn't seem to have any impact, so we ignored it?

Well, further investigation of the current issue shows that the error is preventing the patch sequence from continuing.
This means that, if I have more than one animal with a ranged attack, only the first one listed is implemented.
The code is an exact copy, with different figures, from the template mod provided by BrokenValkyrie along with the RangeAnimalFramework, the MegaSpider Range Attack mod. That mod only adds a range attack to a single creature, so I suspect he/she/other may be unaware of the issue.

I'm going to re-subscribe to the Dragon mod, since it has multiple creatures, and see if that presents a solution.
Unfortunately, because of the way that RangeAnimalFramework calculates attack jobs, I'm probably going to have to remove the ranged attack from the Sanguine Drake anyway, but this bug really need squashing first.

Thanks again for your help.

EDIT: There was a tiny variation, one line to be exact, but that hasn't solved the issue.
I'm beginning to wonder if it's an issue with my using the inclusive assembly instead of making a direct reference to a separately installed mod, as all of BrokenValkyrie's sub-mods do. I'm going to quote this whole discussion (not much of a discussion with only 1 poster at the moment :P) over and ask for help directly.
He/other/she hasn't responded to my previous question yet though... We'll see.
Title: Re: [B18]Range Animal Framework
Post by: BrokenValkyrie on February 20, 2018, 06:36:34 PM
Quote from: Harry_Dicks on February 11, 2018, 12:44:16 AM
Mister or Miss BrokenValkyrie, I think it's really strange how a handful of mods that I had been looking at, all happened to be yours or maintained by you! I wanted to ask, would you please consider putting your other mods onto dropbox as well? I am very interested in these mods especially: Dermal Regenerator, both Beast Men patches, Dragons, Disinfectant Stand, and definitely Septic Tank. I actually made a post a long time ago asking about if we could have a septic tank, and dubwise said he didn't want it in the mod anymore.

Anyway, I would hope that you would please consider my request. I also wanted to thank you for all of your mods that you put out, and I definitely appreciate your work. I think other users would appreciate your work posted off of Steam as well! Thanks ;D

Sorry I was on a warframe binge for a while. Currently job hunting so I might not have much time for the forum. I'll consider it, but I can't put dragon mod on drop box, as I only have permission to update it. The mod is not mine and belongs to Wagwansugar on steam.

@ilikegoodfood
Sorry for the absence, I'll have a look at your problem.
The mod doesn't support  defensive ability like smokepop belt. I might look into it, seems feasible but no guarantee.

You already talked a bit about
<success>Always</success> and <success>Normal<success>

My experience with <success>Normal<success> with it is that it stops at the next operation and doesn't continue until it meets another success criteria. This has caused me so many headache wondering why patch operation isn't applying the changes. I only use <success>Normal<success> under certain circumstance. Usually I'll put other form of check to discontinue patch operation, usually with mod check.
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on February 21, 2018, 06:39:14 AM
Quote from: BrokenValkyrie on February 20, 2018, 06:36:34 PM
Sorry I was on a warframe binge for a while.
I used to play that game all the time, thousands of hours in it. I started playing on the 1st day of open beta and continued playing for the following three years. A bit of a love-hate relationship, mostly to do with initial promises the developers made and still haven't fulfilled, or acknowledged having publicly made at all.
It's also the only game that I have ever found myself displaying addictive tenancies towards, so after three years of frustration I quit and have never allowed myself to go back. I see adds for it every so often, or mentions such as this, and spend days, even weeks, resisting the temptation to re-install it and wasting a few thousand hours more...

Quote from: BrokenValkyrie on February 20, 2018, 06:36:34 PM
My experience with <success>Normal<success> with it is that it stops at the next operation and doesn't continue until it meets another success criteria. This has caused me so many headache wondering why patch operation isn't applying the changes. I only use <success>Normal<success> under certain circumstance. Usually I'll put other form of check to discontinue patch operation, usually with mod check.

I have only been using it in order to try and find which operation in a sequence that is failing is the culprit, as it sometimes reveals error messages relating to the failed operation. This is why I had previously ignored the error, since it didn't seem to effect the patch sequence.

Unfortunately, it does seem to prevent the sequence continuing even when set to <success>Always</success>, which is why I've now isolated the patches in their own sub-sequences as a work-around.

Thank you for considering smoke-pop belts and shields and thank you for your help.

A slight aside, Melee attack verbs can be tied to body parts, thus when the body part is destroyed or damaged the attack is unavailable or weekend. Am I correct in thinking that RimWorld's Ranged verbs have no such equivalent system?

Thanks again.
Title: Re: [B18]Range Animal Framework
Post by: BrokenValkyrie on February 21, 2018, 08:39:31 PM
You are correct, range verbs has no equivalent system to tied body parts. I'll consider it, but this one is very likely to be beyond my ability. The biggest barrier is tying the body part to the verb in xml. I hadn't quite figured out how xml data are read by the game.
Title: Re: [B18]Range Animal Framework
Post by: BrokenValkyrie on February 21, 2018, 10:21:58 PM
@ilikegoodfood

Could you elaborate on the patch issue. Is it that you can't patch both sanguine drake and bombardier beetle in one patch sequence? Another experience I have with patching is I find you can't patch definition from different files in a single sequence.

If you look at dragon mod, you would see I have two distinct separate for dealing with this situation. The first sequence looks for a file called Race_Animal_Dragon.xml, the second sequence looks for a file called Races_Animal_Dragon_2.xml.

I notice that beetle and drake are defined in two separate files.
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on February 22, 2018, 03:53:40 AM
Quote from: BrokenValkyrie on February 21, 2018, 10:21:58 PM
You are correct, range verbs has no equivalent system to tied body parts. I'll consider it, but this one is very likely to be beyond my ability. The biggest barrier is tying the body part to the verb in xml. I hadn't quite figured out how xml data are read by the game.

I didn't meant to ask you to implement it, I was simply after confirmation that it didn't exist.

Quote from: BrokenValkyrie on February 21, 2018, 10:21:58 PM
Could you elaborate on the patch issue. Is it that you can't patch both sanguine drake and bombardier beetle in one patch sequence?
Yes, exactly this.

Quote from: BrokenValkyrie on February 21, 2018, 10:21:58 PM
Another experience I have with patching is I find you can't patch definition from different files in a single sequence.
That I didn't notice. I just went through my other patches and found that my various bug-fixes have resulted in every single sequence working in only a single file.
That is almost certainly the issue then and it means that my solution wasn't a tacky work-around but actually the correct implementation.

That solves that one.
Thank you.
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on February 27, 2018, 04:15:59 PM
I've been looking into tying a body part group to a ranged attack, for the grand total of an hour, on an impulse, and what I've found is that the Melee Verbs in C# directly utilize the average efficiency of the linked body part group, if there is one, but that the ranged verbs are structured very differently.

To summarize my digging, the ranged verbs create a 2D vector from the pawn firing the projectile to the pawn being hit. The path is modified by certain values that, hidden deep in works somewhere, includes the ShootingAccuracy stat. Once the projectile is fired it is free to ranomly intercept with any pawn, wall or cover in its path, again, controlled in some way I don't fully understand.

Now, what this means is that it's impossible to directly insert a value for bodypartgroup average efficiency, unless you can work out where and how the pawn's accuracy is inserted into the equation and insert it into that step.
It also means that there is no need to modify it in C# at all. It can be done through XML only.

In order to do this you would need to create a new capacity. This capacity, just like my hidden bleed rate capacity that facilitates the sanguine drake's anti-coagulant hediff, doesn't require a capacityDefOf or any other C# identifier. Using a harmony patch, you can add that capacityOffset, by name, to the existing list of capacity offsets in the ShootingAccuracy stat.

In order to make the body parts effect the shooting skill, simply tag them as body parts required for that hidden capacity, and when they become damaged, the capacity will drop and the shooting skill will be diminished.

Seeing as you're busy and I think I know exactly what I need to do, I could create it myself and send you the code, BrokenValkyrie, or, if you would rather implement it yourself, I can wait.

Hope to hear from you soon.


EDIT:
Okay. That didn't work.
Using a hediff to modifiy a capacity or stat directly works just fine, however, since the ShootingBodyPart capacity didn't have a workerClass, it doesn't automatically sub-divide the total capacity between the body parts with the tags and implement changes.

Getting it working would require the creation of a CapacityDefOf in C# and a workerClass for it, in addition to the XML patch that adds that capacity as a factor to the ShootingAccuracy stat, and that is something I spent a fair amount of time trying avoiding when I worked on the bleeding rate modifier.

I know from someone else that it is possible but complicated, and they didn't have the template that they used last time to hand. This situation doesn't lend itself to that particular solution.

If you are interested in implemented that functionality, I could ask them for you, or you could find their post in my thread yourself and ask them, but I don't think I want to get into the whole thing. If I am unable to resist this unwillingly self-set challenge, I may continue to look into it, but I really shouldn't sink time into it.

EDIT 2:
Most of edit 1 is only true if you tried to implement it as a capacity. If you used a harmony patch to adjust the accuracy values, then it would be unnecessary.
On a related note, even if you could tie the shot to the bodypartgroup, how would it know to stop using the shot once the damage became too severe? Otherwise, it'll just keep shooting with a 0% hit chance...

I have found the method that splits the accuracy into it's constituent parts (touch, short,long etc.), but I've been following it through and all of references lead to the hit reporter. I don't know if/how that is then passed to the shot itself.
I should either stop here or go and open a help thread...
Title: Re: [B18]Range Animal Framework
Post by: SargBjornson on September 01, 2018, 02:32:27 AM
I have updated this to use it on Genetic Rim! If you want the files, tell me!
Title: Re: [B18]Range Animal Framework
Post by: ilikegoodfood on September 03, 2018, 06:01:07 AM
Quote from: SargBjornson on September 01, 2018, 02:32:27 AM
I have updated this to use it on Genetic Rim! If you want the files, tell me!

Thank you for the update. I've burrowed the updated .dll from the latest GeneticRim for use in my MonsterMash mod.

Do you know if there's a way to check what all the code changes were, aside from digging through everything manually? I've never had to update a mod between versions before...

Thanks.
Title: Re: [B18]Range Animal Framework
Post by: SargBjornson on September 03, 2018, 06:40:36 AM
As far as I know, there is no detailed changelog :(