Made a custom gun. Not appearing in game??

Started by Pfluger, March 02, 2014, 11:17:25 PM

Previous topic - Next topic

Pfluger

So I made a colt 1911 and it's not in the debug menu nor spawning on raiders
here is the code from my Weapons_Guns.xml

<ThingDef ParentName="BaseBullet">
<defName>Bullet_1911</defName>
<label>Pistol bullet</label>
<texturePath>Things/Projectile/Bullet_Small</texturePath>
<projectile>
<impactWorld>True</impactWorld>
<damageType>Bullet</damageType>
<DamageAmountBase>15</DamageAmountBase>
<Speed>60</Speed>
</projectile>
</ThingDef>

<ThingDef ParentName="BaseGun">
<defName>Gun_1911</defName>
<label>M1911</label>
<description>The 1911 is a single-action, semi-automatic, magazine-fed, recoil-operated pistol chambered for the .45 ACP cartridge, which served as the standard-issue sidearm for the United States Armed Forces from 1911 to 1985.</description>
<texturePath>Things/Item/Equipment/Default</texturePath>
<interactSound>InteractPistol</interactSound>
<purchasable>True</purchasable>
<basePrice>80</basePrice>
<verb>
<projectileDef>Bullet_Pistol</projectileDef>
<accuracy>6</accuracy>
<warmupTicks>58</warmupTicks>
<range>30</range>
<fireSound>ShotPistol</fireSound>
</verb>
</ThingDefs>

Please note that this is just the part for my gun.
If anyone can help that'd be amazing  ;D

Also my mod folder contains 2 folders which are the
Textures
Defs-ThingDefs-M1911.xml(Which is posted as this)

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


<ThingDef Name="BaseGun" Abstract="True">
<category>Item</category>
<eType>Equipment</eType>
<thingClass>Equipment</thingClass>
<label>Gun</label>
<equipmentType>Primary</equipmentType>
<isGun>True</isGun>
<pathCost>10</pathCost>
<useStandardHealth>True</useStandardHealth>
<selectable>True</selectable>
<maxHealth>100</maxHealth>
<altitudeLayer>Item</altitudeLayer>
<alwaysHaulable>True</alwaysHaulable>
<tickerType>Never</tickerType>
<storeCategories>
<li>Weapons</li>
</storeCategories>
<comps>
<li>
<compClass>CompForbiddable</compClass>
</li>
</comps>
<verb>
<id>Nonnative</id>
<verbClass>Verb_Shoot</verbClass>
<cooldownTicks>30</cooldownTicks>
<label>VerbGun</label>
<description>Verb fires bullets.</description>
<hasStandardCommand>true</hasStandardCommand>
<targetParams>
<canTargetPawns>true</canTargetPawns>
<canTargetBuildings>true</canTargetBuildings>
<worldObjectTargetsMustBeAutoAttackable>true</worldObjectTargetsMustBeAutoAttackable>
</targetParams>
<canMiss>true</canMiss>
</verb>
</ThingDef>

<ThingDef Name="BaseBullet" Abstract="True">
<category>Projectile</category>
<tickerType>Normal</tickerType>
<altitudeLayer>Projectile</altitudeLayer>
<thingClass>Bullet</thingClass>
<label>Bullet</label>
<useStandardHealth>False</useStandardHealth>
<neverMultiSelect>True</neverMultiSelect>
<baseMaterialType>Transparent</baseMaterialType>
</ThingDef>

</ThingDefs>

Thank you so so so so much
Much Love, Pfluger!

Cala13er

#1
    1st. Make sure you have enabled the mod in "mods" on the main menu.
    2nd. For Raiders to spawn with it. You need to make a Raider who has a chance to spawn with it.

    • Go to PawnKindDefs --> PawnKinds_Raiders
    • Make your own raider class and put your guns defname there.

    I made a PawnKind_Raiders for you, download attachment.

    3. If this does not work! Make a download link for your mod. PM me it, And then I'll fix it up for you.

    After further examination :

    • Your bullet has the label Pistol bullet, change that to 1911 Bullet or M1911 Bullet (It doesn't matter I just thought a name change was in order ;)
    • Make sure your texture packs are perfectly accurate. Your guns texture path wants an image called "default" whether this is intended or not decides if this is a problem.
    • Your gun isn't using the bullet class you made. It is using Pistol_Bullet, if you want it to use your bullet, change that to Bullet_1911

[attachment deleted by admin: too old]

SlimeCrusher

If you made a custom raider, im sorry, it will NOT spawn, only if you modify existing raiders... I know they don't spawn for a fact, because i tried adding a "Pyroman" that uses my flamethrower, molotov and T9 IL but it doesn't spawn, only in the debug menu

Also, as Cala13er said, check that you enabled your mod on the Mods thingy on the Rimworld menu (Ingame)

Cala13er

Yeah sorry. I've not added a gun yet. If I was too I'd make it a class file then reference it. And I was unsure about the raider thing because again. I don't plan on adding raiders.so never checled it out.

Architect

Yeah, youll need to go into the file @Cala13er had identified, and modify one of the current dudes already in so for instance with the scavenger:
<possibleStartingWeapons>
<li>Gun_Pistol</li>
<li>Gun_Pistol</li>
<li>Gun_Pistol</li>
<li>Gun_Pistol</li>
<li>Gun_Pistol</li>
<li>Gun_Pistol</li>
<li>Gun_Pistol</li>
<li>Gun_Pistol</li>
<li>Gun_Lee-Enfield</li>
<li>Gun_Pump Shotgun</li>
<li>Gun_1911</li>
</possibleStartingWeapons>
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


Evul

make sure that <ThingDef Name="BaseGun" Abstract="True">...</ThingDefs> and <ThingDef Name="BaseBullet" Abstract="True">...</ThingDefs> is present in your gun file. also that the file starts and end with:
<?xml version="1.0" encoding="utf-8" ?>
<ThingDefs>
...
</ThingDefs>


if you done that right you have a gun present in the Debug menu. if not its not there. :P
Also as the other guys say if you what raiders to use the gun edit the PawnKinds_Raiders. It picks a gun from the list by random. So the more the gun is appearing in the list the larger is the chance the weapon appears.


(... represents code.)

Pfluger

Hmmm tried all of this and it did not work...
If anyone has a skype and can help please add me: fluffymascot123

Evul