Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - BukTaki

#1
Help / Pain Medicine
March 10, 2019, 07:55:30 PM
I need some guidance i am making a mod that adds medicine. I want to make a painkiller i can see how pain is calculated here. https://rimworldwiki.com/wiki/Pain

What i want is an effect that reduces pain. But i am not sure were to begin i have been searching .xmls all day looking for anything that remotely looks right.Even the pain stopper defs was no help.

It seems there is no direct link to a pawns Pain hat can be accessed or modified threw the stat bases.

I think i will have to use the CompProperties
I Don't really understand what a comp proproperties is though. I See them implemented to add light add heddiff
I want to add a heddiff that reduces pain when when medicine is used during tending but i do not know what compproperties to use in. Is there a list of compproperties and how they are implemented somewhere?


#2
Help / Need help with a sling
February 09, 2019, 01:26:21 PM
I am trying to add more weapons to rim world i added a spear which works fine.
But when i try to do a Sling the pawn misses every time when it range attacks i know i am missing something i just dont know what.


  <ThingDef ParentName="BaseWeaponNeolithic">
    <defName>RangedWeapon_LeatherSling</defName>
    <label>LeatherSling</label>
    <description>Long leather pouch used to fling rocks can used as simple blunt weapon when througher does not release the stone.</description>
    <graphicData>
      <texPath>Things/Weapons/Neolithic/LeatherSling/LeatherSling</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <techLevel>Neolithic</techLevel>
    <weaponTags>
      <li>NeolithicMeleeBasic</li>
    </weaponTags>
    <costStuffCount>5</costStuffCount>
    <statBases>
      <WorkToMake>1600</WorkToMake>
      <Mass>1.25</Mass>
      <AccuracyTouch>0.30</AccuracyTouch>
      <AccuracyShort>0.70</AccuracyShort>
      <AccuracyMedium>0.90</AccuracyMedium>
      <AccuracyLong>0.60</AccuracyLong>
      <RangedWeapon_Cooldown>1.65</RangedWeapon_Cooldown>
    </statBases>
    <verbs>
      <li>
        <verbClass>Verb_Shoot</verbClass>
        <hasStandardCommand>true</hasStandardCommand>
        <defaultProjectile>SlingStoneBullet</defaultProjectile>
        <warmupTime>2</warmupTime>
        <range>22</range>
        <soundCast>Interact_BeatFire</soundCast>
      </li>
    </verbs>
<equippedAngleOffset>0</equippedAngleOffset>
    <stuffCategories>
      <li>Leathery</li>
    </stuffCategories>
    <recipeMaker>
      <recipeUsers>
        <li>CraftingSpot</li>
      </recipeUsers>
    </recipeMaker>
    <tools>
      <li>
        <label>head</label>
        <capacities>
          <li>Blunt</li>
        </capacities>
        <power>6</power>
        <cooldownTime>2</cooldownTime>
      </li>
    </tools>
  </ThingDef>



and the charge is


  <ThingDef ParentName="BaseProjectileNeolithic">
    <defName>SlingStoneBullet</defName>
    <label>Sling Stone Bullet</label>
    <graphicData>
      <texPath>Things/Weapons/Neolithic/LeatherSling/LeatherSlingBullet</texPath>
      <graphicClass>Graphic_Single</graphicClass>
      <shaderType>CutoutComplex</shaderType>
      <drawSize>(1,1)</drawSize>
    </graphicData>
    <projectile>
      <flyOverhead>true</flyOverhead>
      <damageDef>RangedStab</damageDef>
      <damageAmountBase>10</damageAmountBase>
      <stoppingPower>20</stoppingPower>
      <armorPenetrationBase>0.10</armorPenetrationBase>
      <speed>26</speed>
    </projectile>
  </ThingDef>
#3
Help / 0.0.0 Interaction Point
January 22, 2019, 08:23:10 PM
I am having a problem with 1x1 sprite and a (0,0,0). I thought that the pawn would face the direction of the Interaction point but when i do (0,0,0) the pawn just faces north.  I tried resizing to 3 to 3; Anybody know a work around?
#4
Help / Work bench not Working
January 20, 2019, 03:07:19 PM
Work bench not Working

Pawns wont build and i can't right click and prioritize any help would be greatly appreciated


  <ThingDef ParentName="BenchBase">
    <defName>MedievalShieldBench</defName>
    <label>Medieval Shield Crafting Bench</label>
    <description>A workbench for crafting shields by hand</description>
    <thingClass>Building_WorkTable</thingClass>
    <graphicData>
      <texPath>Things/Building/Production/ShieldBench</texPath>
      <graphicClass>Graphic_Single</graphicClass>
      <drawSize>(2,2)</drawSize>
      <damageData>
        <cornerTL>Damage/Corner</cornerTL>
        <cornerTR>Damage/Corner</cornerTR>
        <cornerBL>Damage/Corner</cornerBL>
        <cornerBR>Damage/Corner</cornerBR>
      </damageData>
    </graphicData>
    <castEdgeShadows>true</castEdgeShadows>
    <staticSunShadowHeight>0.20</staticSunShadowHeight>
    <costList>
      <Steel>100</Steel>
      <WoodLog>50</WoodLog>
</costList>
    <altitudeLayer>Building</altitudeLayer>
    <fillPercent>0.5</fillPercent>
    <useHitPoints>True</useHitPoints>
    <statBases>
      <WorkToBuild>1000</WorkToBuild>
      <MaxHitPoints>180</MaxHitPoints>
  <WorkTableWorkSpeedFactor>0.5</WorkTableWorkSpeedFactor>
      <Flammability>0.75</Flammability>
    </statBases>
    <size>(2,2)</size>
    <designationCategory>Production</designationCategory>
    <passability>PassThroughOnly</passability>
    <pathCost>70</pathCost>
    <hasInteractionCell>True</hasInteractionCell>
    <interactionCellOffset>(1,0,0)</interactionCellOffset>
    <surfaceType>Item</surfaceType>
    <constructionSkillPrerequisite>3</constructionSkillPrerequisite>
    <inspectorTabs>
      <li>ITab_Bills</li>
    </inspectorTabs>
    <comps>
      <li Class="CompProperties_AffectedByFacilities">
        <linkableFacilities>
          <li>ToolCabinet</li>
        </linkableFacilities>
      </li>
    </comps>
    <building>
      <spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
    </building>
    <constructEffect>ConstructMetal</constructEffect>
    <designationHotKey>Misc7</designationHotKey>
    <placeWorkers>
      <li>PlaceWorker_ShowFacilitiesConnections</li>
    </placeWorkers>
<researchPrerequisites>
      <li>MedievalShield</li>
    </researchPrerequisites>
  </ThingDef>
#5
Unfinished / (WIP) version 1 Shield Mod
December 16, 2018, 10:32:17 PM
Huge thank you to Mehni for the help with harmony
Huge thank you to Skullywag the origional author

Stand alone

https://steamcommunity.com/sharedfiles/filedetails/?id=1630607556

Updates

*** Brand new inventory swapping *** let me know if you encounter bugs
*** Fixed Weights ***




#6
Help / Help with Harmony
December 05, 2018, 08:12:20 PM
I am trying to get harmony to with my shield script and its pretty mind Bending. I keep getting errors with and i Dont think i am using the tool right.


using Harmony;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Verse;
using Verse.AI;

namespace Shield
{
    [StaticConstructorOnStartup]
    class ShieldHarmony
    {
        private static readonly Type shieldPatchType = typeof(ShieldHarmony);

        static ShieldHarmony()
        {
            HarmonyInstance h = HarmonyInstance.Create("ShieldHarmony");

            h.Patch(AccessTools.Property(typeof(Pawn_InventoryTracker), nameof(Pawn_EquipmentTracker.PrimaryEq)).GetGetMethod(),
                new HarmonyMethod(shieldPatchType, nameof(JobEquip_Start)));         
        }

        public static void JobEquip_Start(Pawn_EquipmentTracker _instance, ref CompEquippable _referance)
        {
            if (_referance != null)
            {
                Pawn owner = _instance.pawn;
                bool canepuipshield = false;
                bool hasShieldEquiped = false;
                bool hasShieldinInventory = false;
                Def defShieldequiped = null;
                Def defshieldininventory = null;
                Apparel e = null;
                Apparel i = null;
                foreach (Apparel a in owner.apparel.WornApparel)
                {
                    if (a.def.apparel.tags.Contains("shield"))
                    {
                        hasShieldEquiped = true;
                        defShieldequiped = a.def;
                        e = a;

                    }
                }

                foreach (Thing t in owner.inventory.innerContainer)
                {
                    Apparel a = t as Apparel;
                    if (a.def.apparel.tags.Contains("shield"))
                    {
                        hasShieldinInventory = true;
                        defshieldininventory = a.def;
                        i = a;

                    }
                }

                if (!hasShieldEquiped && !hasShieldinInventory)
                {
                    return;
                }

                if (owner.equipment.Primary != null && hasShieldinInventory && !hasShieldEquiped)
                {
                    if (owner.equipment.Primary.def.IsMeleeWeapon)
                    {
                        canepuipshield = true;
                    }
                    if (owner.equipment.Primary.def.defName.Equals("Gun_Pistol"))
                    {
                        canepuipshield = true;
                    }
                    if (owner.equipment.Primary.def.defName.Equals("Gun_PDW"))
                    {
                        canepuipshield = true;
                    }
                    if (owner.equipment.Primary.def.defName.Equals("Gun_HeavySMG"))
                    {
                        canepuipshield = true;
                    }
                    if (owner.equipment.Primary.def.defName.Equals("Gun_HeavySMG"))
                    {
                        canepuipshield = true;
                    }
                    if (owner.equipment.Primary.def.weaponTags.Contains("MedievalShields_ValidSidearm"))
                    {
                        canepuipshield = true;
                    }
                    canepuipshield = false;
                }


                if (canepuipshield && hasShieldinInventory && i != null)
                {
                    owner.apparel.Wear(i);
                }

                if (hasShieldEquiped && !canepuipshield && e != null)
                {
                    owner.inventory.innerContainer.TryAddOrTransfer(e as Thing, false);
                }

                return;
            }
        }
    }
}



the error i get is
Could not execute post-long-event action. Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Shield.ShieldHarmony ---> System.NullReferenceException: Object reference not set to an instance of an object
  at Shield.ShieldHarmony..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Runtime.CompilerServices.RuntimeHelpers:RunClassConstructor (intptr)
  at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (RuntimeTypeHandle type) [0x00000] in <filename unknown>:0
  at Verse.StaticConstructorOnStartupUtility.CallAll () [0x00000] in <filename unknown>:0
  at Verse.PlayDataLoader.<DoPlayLoad>m__2 () [0x00000] in <filename unknown>:0
  at Verse.LongEventHandler.ExecuteToExecuteWhenFinished () [0x00000] in <filename unknown>:0
Verse.Log:Error(String, Boolean)
Verse.LongEventHandler:ExecuteToExecuteWhenFinished()
Verse.LongEventHandler:UpdateCurrentAsynchronousEvent()
Verse.LongEventHandler:LongEventsUpdate(Boolean&)
Verse.Root:Update_Patch1(Object)
Verse.Root_Entry:Update()

Any help would be greatly appreciated.

The ultimate end goal is to have an action or function "JobEquip_Start" called using harmony or some other event. I tried using the sidearms and survival tools source to try to figure it out. But no dice.

#7
Help / Item and equipment swapping
November 01, 2018, 06:33:26 PM
I need help with my shield mod as of right now i can add shields to the Pawns inventory using the


this.Wearer.inventory.innerContainer.TryAddOrTransfer(this as Thing, false);


the problem is i cant retrieve it when the pawn switches weapons. Is there a delegate or function that is called when when a pawn switches its primary weapon? I can listen for. any ideas would be greatly appreciated.

#8
Help / Adding Custom Values to a Def
October 27, 2018, 05:07:19 PM
I have a def

<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThingDef ParentName="Buckler_Shield">
    <defName>Test_Buckler</defName>
<colorable>False</colorable>
<thingClass>Shield.Apparel_Shield</thingClass>
<label>Test Buckler</label>
    <description>This Is a Test</description>
    <graphicData>
      <texPath>Things/Item/Equipment/Apparel/Accessory/Shield/Buckler/buckler</texPath>
      <graphicClass>Graphic_Single</graphicClass>
</graphicData>
    <costList>
<WoodLog>20</WoodLog>
<Steel>5</Steel>
    </costList>
<recipeMaker>
<recipeUsers>
<li>CraftingSpot</li>
</recipeUsers>
</recipeMaker>
    <statBases>
  <WorkToMake>500</WorkToMake>
  <Mass>10</Mass>
  <MaxHitPoints>100</MaxHitPoints>
      <Flammability>1.0</Flammability>
      <DeteriorationRate>1</DeteriorationRate>
  <ArmorRating_Blunt>0.2</ArmorRating_Blunt>
      <ArmorRating_Sharp>0.2</ArmorRating_Sharp>
    </statBases>
    <useHitPoints>True</useHitPoints>
<smeltable>True</smeltable>
</ThingDef>

</Defs>


i want to add a variable to Shield.Apparel_Shield that can be set in the xml and i cant find any info on it.
#9
Help / Texture colors
October 25, 2018, 04:03:57 PM
Here is a problem i cant figure out how to stop a textures colors from being changed by the build materials is a way to prevent that in the Defs. i have a shield texture that gets a brown tint added because its made out of wood but it tints the emblem on it as well.
#10
Help / Shield Mod
October 24, 2018, 02:18:41 PM
I am working skully's shield mod

I need to get the shield above the pawn but below weapon layer. I just don't know what altitude the weapons are on when the pawn changes directions

as it stands i have it as



{
                    if (this.Wearer.Rotation == Rot4.South)
                    {
                        vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead);
                        vector.x += 0.2f;
                        vector.z -= 0.2f;
                    }
                    else
                    {
                        if (this.Wearer.Rotation == Rot4.East)
                        {
                            vector.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn);
                            vector.z -= 0.2f;
                            num = 90f;
                        }
                        else
                        {
                            if (this.Wearer.Rotation == Rot4.West)
                            {
                                vector.y = Altitudes.AltitudeFor(AltitudeLayer.MoteOverhead);
                                vector.z -= 0.2f;
                                num = 270f;
                            }
                        }
                    }
                }


Right now the shield hides the weapon.

any help is greatly appreciated.