Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Help: How to implement a race mod  (Read 1625 times)

basil

  • Escaped Lunatic
  • Bughunter
    • View Profile
Help: How to implement a race mod
« on: January 07, 2013, 09:35:43 pm »

I've read the mod guides:
http://www.bay12forums.com/smf/index.php?topic=55259
http://dwarffortresswiki.org/index.php/Category:DF2012:Modding
http://www.bay12forums.com/smf/index.php?topic=28829.0
http://dwarffortresswiki.org/index.php/DF2012:Modding
http://www.bay12forums.com/smf/index.php?topic=100707.0

However, none of them go over how to add a playable race mod to adventure mode. As far as I can tell, it involves editing two files in dwarf fortress/raw/objects: the appropriate entity_default.txt and creature_standard.txt.

However, every time i attempt to gen a new world (with an updated creature_standard.txt file) it crashes. I use the original creature_standard along with my custom entity_default.txt file, and it gens but i can't play as my custom race. I got the mod from thebay12forums and edited appropriately.

This is what I added to my entity_default.txt file in /raw/objects:

Spoiler (click to show/hide)


This is what I added to my creature_standard.txt in /raw/objects:

Spoiler (click to show/hide)

What am I doing wrong? How do I add a custom, playable race to adventure mode? I'm using DwarfFortress 34.11, and dfhack/dfusion 0.34.11 r2.
Logged
Time out. I drank his blood. It says human, but he just flipped out for being called out as a vamp. I DRANK HIS BLOOD. IN THE NAME OF ARMOK, AND ALL THAT IS HOLY, HOW DID I DROWN?!!

smakemupagus

  • Bay Watcher
  • [CANOPENDOORS]
    • View Profile
Re: Help: How to implement a race mod
« Reply #1 on: January 07, 2013, 09:53:33 pm »

How do I add a custom, playable race to adventure mode?

Sounds like you're going about it the right way.  Create the creature, create the entity, make sure the entity has [INDIV_CONTROLLABLE] and optionally, an [ADVENTURE_TIER].

From what you say, probably you have errors in your creature.  Do you have error logs?  Try some normal debug process like starting with a copy of a known good creature and making smaller changes incrementally?  Your creature has a lot of fancy magic and interactions, I wonder whether the appropriate interactions are all defined in your raws.

basil

  • Escaped Lunatic
  • Bughunter
    • View Profile
Re: Help: How to implement a race mod
« Reply #2 on: January 07, 2013, 10:30:49 pm »

entity_default.txt has the [ENTITY:EARTH], [INDIV_CONTROLLABLE] and [ADVENTURE_TIER:4] for my race. I don't think there's something wrong with entity_default, as it runs perfectly fine with my edited version. However, after playing around with my custom race in creature_standard.txt, this addition (TWO TAGS) makes DwarfFortress crash:

Code: [Select]
        [CE:INTERACTION:VAMPIRE_BITE]
[CE:COUNTER_TRIGGER:DRINKING_BLOOD:1:NONE:REQUIRED]

From what the mod wiki says about interaction and syndrome usage:
http://dwarffortresswiki.org/index.php/DF2012:Interaction_token

Code: [Select]
In order to actually use an interaction, add the creature token [CAN_DO_INTERACTION:NAME] followed by a series of [CDI:...] tokens. Interactions can also be granted through syndromes using the token [CE_CAN_DO_INTERACTION] (plus the same series of CDI tokens).

The following CDI tokens can be specified:
Token: INTERACTION
Argument: id
Description:
Specifies which interaction can be performed.
Only to be used with syndromes, since CE_CAN_DO_INTERACTION
does not allow specifying the interaction ID directly.

Isn't VAMPIRE_BITE a syndrome? Are the two aforementioned tags used wrong?
« Last Edit: January 07, 2013, 10:52:26 pm by basil »
Logged
Time out. I drank his blood. It says human, but he just flipped out for being called out as a vamp. I DRANK HIS BLOOD. IN THE NAME OF ARMOK, AND ALL THAT IS HOLY, HOW DID I DROWN?!!

smakemupagus

  • Bay Watcher
  • [CANOPENDOORS]
    • View Profile
Re: Help: How to implement a race mod
« Reply #3 on: January 07, 2013, 10:48:01 pm »

I suspect that INTERACTION:VAMPIRE_BITE (or some of the other interactions that your creature use) might not be defined.  That's why I asked about error logs.  If it was defined it would be not in the Creature or Entity file but rather in a file whose first token was [OBJECT:INTERACTION].  If you didn't write or copy such an interaction file, then, that's the problem :)

basil

  • Escaped Lunatic
  • Bughunter
    • View Profile
Re: Help: How to implement a race mod
« Reply #4 on: January 07, 2013, 11:07:30 pm »

Thanks!

I have enough know-how to edit the example interaction_vampire.txt in the /raw/interaction examples folder. So for testing purposes, Im just going to use that example as an example interaction. However, where would I want to save it, in the raw/objects/ folder as interaction_race.txt?

To allow my blood to spread vampirism, would I use:
Code: [Select]
   [USE_MATERIAL_TEMPLATE:BLOOD:BLOOD_TEMPLATE]
   [BLOOD:LOCAL_CREATURE_MAT:BLOOD:LIQUID]
         [MELTING_POINT:10200]
         [BOILING_POINT:10400]
         [ENTERS_BLOOD]
         [SYNDROME]
         [SYN_NAME:vampirism]
         [SYN_AFFECTED_CLASS:GENERAL_POISON]
         [SYN_IMMUNE_CREATURE:ADVENTURER_VAMPIRE:ALL]
         [CE:INTERACTION:VAMPIRE_CURSE] (or [CAN_DO_INTERACTION:VAMPIRE_CURSE])
         [SYN_INJECTED]
         [SYN_INGESTED]
         [SYN_INHALED]
         [CE:COUNTER_TRIGGER:DRINKING_BLOOD:1:NONE:REQUIRED]

would it be [CE:INTERACTION:VAMPIRE_CURSE], [CAN_DO_INTERACTION:VAMPIRE_CURSE] or [CAN_DO_INTERACTION:INTERACTION_RACE]?
Logged
Time out. I drank his blood. It says human, but he just flipped out for being called out as a vamp. I DRANK HIS BLOOD. IN THE NAME OF ARMOK, AND ALL THAT IS HOLY, HOW DID I DROWN?!!

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Help: How to implement a race mod
« Reply #5 on: January 07, 2013, 11:19:05 pm »

You want to put it right below the USE_MATERIAL_TOKEN tag, not the BLOOD tag. That's your main problem.

It would be CE:CAN_DO_INTERACTION:START:0 followed by CE:INTERACTION:VAMPIRE_CURSE.

basil

  • Escaped Lunatic
  • Bughunter
    • View Profile
Re: Help: How to implement a race mod
« Reply #6 on: January 08, 2013, 03:20:27 am »

You want to put it right below the USE_MATERIAL_TOKEN tag, not the BLOOD tag. That's your main problem.

It would be CE:CAN_DO_INTERACTION:START:0 followed by CE:INTERACTION:VAMPIRE_CURSE.

In my /raw/objects/creature_standard.txt, I take your suggestion:

Spoiler (click to show/hide)

However, it still crashes when I attempt to create a new world. My interaction, VAMPIRE_CURSE, is defined in /raw/objects/interaction_standard.txt.

I know this is processed and ok to use because I already edited this file before and it allowed me to gen a world without crashing. I know the example interaction (defined in interaction_standard.txt) works because it's basically what I used and put in objects/interaction_standard.txt:

Spoiler (click to show/hide)

Any ideas?
Logged
Time out. I drank his blood. It says human, but he just flipped out for being called out as a vamp. I DRANK HIS BLOOD. IN THE NAME OF ARMOK, AND ALL THAT IS HOLY, HOW DID I DROWN?!!

basil

  • Escaped Lunatic
  • Bughunter
    • View Profile
Re: Help: How to implement a race mod
« Reply #7 on: January 08, 2013, 12:37:03 pm »

So early this morning, it works (had to reorg some tags), but on my first run through, I started near a hut entered. I always accuse EVERYONE of being a nightcreature, fought three and killed two. The weirdest part was
Spoiler (click to show/hide)

Classic!

Logged
Time out. I drank his blood. It says human, but he just flipped out for being called out as a vamp. I DRANK HIS BLOOD. IN THE NAME OF ARMOK, AND ALL THAT IS HOLY, HOW DID I DROWN?!!

McFeel

  • Bay Watcher
    • View Profile
Re: Help: How to implement a race mod
« Reply #8 on: January 08, 2013, 01:24:31 pm »

As said by smakemupagus the error log is very helpfull for solve this problems, and others that you haven't noticed. If you create a new world, and the are some errors, a txt named errolog will be created in your main DF folder.
Logged