Bay 12 Games Forum

Dwarf Fortress => DF Modding => Topic started by: Kuli on March 13, 2008, 05:45:00 pm

Title: New creature causing crashes
Post by: Kuli on March 13, 2008, 05:45:00 pm
Well, I'm a total modding newbie.  I had a cool idea for a new creature - a cursed sword that was animated through foul magic.  I wanted it so that you could kill the thing, then use its corpse as a new weapon.  That way you would actually get a reward for an adventure mode quest for once.

I made the thing, generated a world, and eventually got a quest to go kill Fima Morningmeadow the haunted sword.  I find the thing, exchange a few blows, then the game crashes.  I tried again a few times and very consistently the game would crash after a few rounds of combat.

I look to you more experienced DF modders for assistance.  Where do you think I went wrong?  Here's the creature entry:

code:
[CREATURE:SWORD_HAUNTED]
   [NAME:haunted sword:haunted swords:haunted sword]
   [TILE:'/'][COLOR:7:7:1]
   [SEMIMEGABEAST]
   [GENPOWER:5]
   [BUTCHERABLE_NONSTANDARD]
   [FANCIFUL]
   [CANOPENDOORS]
   [PREFSTRING:deadliness]
   [BODY:BASIC_SWORDBODY]
   [FLIER]
   [NOT_BUTCHERABLE]
   [NOPAIN][EXTRAVISION][NOBREATHE][NOBLEED][NOSTUN][NONAUSEA][NOEMOTION]
       [RECKLESS][NOSTUCKINS][SEVERONBREAKS][NOSKULL][NOSKIN][NOBONES][NOMEAT]
       [NOTHOUGHT][NOEXERT]
   [BUILDINGDESTROYER:2]
   [DAMBLOCK:10]
   [NOFEAR]
   [SIZE:10]
   [ATTACK:MAIN:BYTYPE:BLADE:cut:cuts:1:2:SLASH][ATTACKFLAG_WITH]
   [ATTACK:MAIN:BYTYPE:BLADE:stab:stabs:1:3:PIERCE][ATTACKFLAG_WITH]
   [EQUIPS]
   [DIURNAL]
   [BIOME:ANY_LAND]
   [ITEMCORPSE:SWORD:NO_SUBTYPE:METAL:SILVER]
   [ITEMCORPSE_QUALITY:5]
   [NO_DRINK][NO_EAT][NO_SLEEP]
   [NO_GENDER]
   [MATERIAL:METAL:SILVER]
   [SWIMS_LEARNED][SWIM_SPEED:2500]

This part should be okay.  I pretty much just copied the Bronze Colossus entry, changed the size, attacks, and corpse item, then added the [FLIER] tag.  I figured [FLIER] would be necessary since it doesn't have any legs.  There isn't a [LEVITATE] tag or anything like that is there?

I suspect the problem is with its body_default entry, because here is where I don't really know what I'm doing.

code:

[BODY:BASIC_SWORDBODY]
[BP:UB:blade][UPPERBODY][HEAD]
[BP:LB:hilt][CON:UB][LOWERBODY][STANCE]

The theory was that the hilt would control movement, so damaging it would be like damaging another creature's feet or legs.  Thus the [STANCE] tag.  The blade acts as the head so that the creature dies when the blade is destroyed.

So guys, how can I make a sword-creature that works?

[ March 13, 2008: Message edited by: Kuli ]

Title: Re: New creature causing crashes
Post by: Untelligent on March 13, 2008, 05:54:00 pm
Anything with a [STANCE] tag is technically a leg, so you don't need a [FLIER].

As to your problem, I think it's your Itemcorpse. There is no TYPE entitled SWORD, according to the wiki. Although I've had faulty itemcorpses before, they've never crashed the game, though I've never had a faulty TYPE section before...

The only thing I can think of offhand would be [ITEMCORPSE:WEAPON:SWORD:METAL:SILVER]. The wiki doesn't have anything listed under SUBTYPE (where the SWORD is in that token I just showed you), but it's worth a shot, and if it doesn't work at least it *shouldn't* crash your game this time.

If that doesn't work either, try taking the itemcorpse off temporarily and see what happens.

Oh, and yeah, look at the errorlog.

[ March 13, 2008: Message edited by: Untelligent ]

Title: Re: New creature causing crashes
Post by: Dwarmin on March 13, 2008, 06:01:00 pm
What does your errorlog say? You might find the problem there.
Title: Re: New creature causing crashes
Post by: Kuli on March 13, 2008, 06:07:00 pm
well, let's see...

Unrecognized Item Token: SWORD
Unrecognized Item Token: SWORD
Unrecognized Item Token: SWORD
Unrecognized Item Token: SWORD

Okay, I imagine that has something to do with it.  Heh.

Oh, I see.  The game is crashing when it dies because there's no such thing as a "sword."  It has to be a short sword or a scimitar, or something like that.  I think replacing the itemcorpse SWORD with SWORD_LONG shoud do it, right?

This also means it's dying way too easily.  Better make it stronger too.

[ March 13, 2008: Message edited by: Kuli ]

Title: Re: New creature causing crashes
Post by: Untelligent on March 13, 2008, 06:15:00 pm
I doubt that'd work. As I said in my last post, I don't know about the other three, but I'm VERY SURE you need to replace SWORD with WEAPON.
Title: Re: New creature causing crashes
Post by: Kuli on March 13, 2008, 06:17:00 pm
Oh, the sword has to be the subtype of the itemcorpse weapon.  Gotcha.

Thanks a lot for your help.

Title: Re: New creature causing crashes
Post by: Sean Mirrsen on March 13, 2008, 06:17:00 pm
The proper syntax is [ITEMCORPSE:WEAPON:ITEM_WEAPON_SWORD_LONG:METAL:SILVER], assuming you need a silver longsword. The subtype is the item ID.
Title: Re: New creature causing crashes
Post by: Untelligent on March 13, 2008, 06:22:00 pm
^ Yeah, I had a feeling my guess about the subtype was wrong in some way.
Title: Re: New creature causing crashes
Post by: Helmaroc on March 13, 2008, 06:24:00 pm
Would you mind posting the working file? It sounds like an interesting creature.
Title: Re: New creature causing crashes
Post by: Kuli on March 13, 2008, 07:28:00 pm
Hooray, I got it to work!  Thanks, everyone.

(http://i5.photobucket.com/albums/y181/kulihooray/kulisword1.jpg)

I wonder why the sword has the grey background, though?  Anyone know how I might get rid of it?

(http://i5.photobucket.com/albums/y181/kulihooray/kulisword2.jpg)

A successful death.  No crashes.  Considering I cut the hilt off, I probably shouldn't get an intact sword, but oh well.  Gameplay above realism, I always say.

Helmaroc, I'll post the final creature when I've tweaked it a bit.  Right now the haunted sword is much too easy to kill.

Title: Re: New creature causing crashes
Post by: Wiles on March 13, 2008, 07:35:00 pm
change his colour from 7:7:1 to 7:0:0 (light grey) or 0:0:1 (dark grey) to make it grey without a background.

EDIT or 7:0:1 if you wanted it white

[ March 13, 2008: Message edited by: Wiles ]

Title: Re: New creature causing crashes
Post by: Kuli on March 13, 2008, 07:39:00 pm
Thanks.  I wasn't sure what the color-related numbers meant.  I just copied the color from silver the metal.
Title: Re: New creature causing crashes
Post by: Gaulgath on March 13, 2008, 07:49:00 pm
Haha! Very unique monster. I suppose it earned its name (in the screenshot) from killing a past adventurer?
Title: Re: New creature causing crashes
Post by: Kuli on March 13, 2008, 07:56:00 pm
It gets a name because it has the [SEMIMEGABEAST] tag.  Just like minotaurs and ettins and other such beings.  I was tempted to use [MEGABEAST], but thought it might be weird to have a fortress get invaded by a floating sword.