- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
Difference between revisions of "User:Deon"
Line 163: | Line 163: | ||
creature_template | creature_template | ||
− | + | ||
[OBJECT:CREATURE] | [OBJECT:CREATURE] | ||
− | + | ||
[CREATURE:CREATURE1] | [CREATURE:CREATURE1] | ||
[NAME:creature:creatures:creature] | [NAME:creature:creatures:creature] | ||
[TILE:'C'][COLOR:1:0:1] | [TILE:'C'][COLOR:1:0:1] | ||
[PREFSTRING:prefstring] | [PREFSTRING:prefstring] |
Revision as of 13:06, 21 July 2008
Greetings
I'm a dedicated member of our great community so I wanted to organize a bit some of my things I already wrote for the community which are lost in swarms of forum threads. They may be useful for someone. I don't have a time for now to organize them but I hope they are understandable.
Guides
What is a tileset and how the graphics are determined?
http://www.bay12games.com/forum/index.php?topic=21176.msg227109#msg227109
Essential tags of a creature
http://www.bay12games.com/forum/index.php?topic=21045.msg225768#msg225768
Game Modifications
Middle-Earth mod (39+ compatible)
Mods and components for Mod Base
How to
How to add a new creature
Adding the body
Body template
File with a name body_template.txt
body_template [OBJECT:BODY] [BODY:BODY1] [BP:BP1:bodypart1] [BP:BP2:bodypart2] [BP:BP3:bodypart3]
Let's add a completely new creature with a custom body which will be modular (will not overwrite any content) and will be easy to install. I will use Body tokens, you can read their descriptions there.
I want to make a tripod creature. It has 3 legs, a tentacle as tail and a hand with 3 sharp fingers instead of head with a single eye on the palm.
Let's start with a body. Make a body_tripod.txt text file in your /raw/objects folder. According to the template the first string shold be the file name without the extension (.txt) and then you announce that the type of the content is body ([OBJECT:BODY]). Then we'll add a tripod body with no bodyparts still.
So now we have
creature_tripod [OBJECT:BODY] [BODY:TRIPOD]
Now we want to start to build the body structure. The main rule here is that if some bodypart was connected to another it should be listed after that. I.e. if we had an eye which is connected to the head we should announce head first and eye next.
So we will start with the main "carrier" - upper body, other parts are connected to it or to other parts which are connected to it.
[BP:UB:upper body][UPPERBODY]
- "BP" here indicates that it is a part of the announced BODY structure (TRIPOD).
- "UB" is a unique (inside this creature) identintificator.
- "upper body" is the displayed name. [UPPERBODY] token means that this is the main part where the chest armor would be worn if the creature could wear armor and also it can be "cloven asunder" etc.
[BP:LB:lower body][COBTYPE:UPPERBODY][LOWERBODY]
- [CONTYPE:UPPERBODY] means that this part is connected to the part of this body which has the "UPPERBODY" token. Surprisingly it's UB (upper body) :).
- It could be [CON:UB] also, CONTYPE tries to attach the bodypart to every another part with the listed token while the CON connects to a single bodypart with the indicated unique identificator (UB for the upper body).
Let's add a front leg.
[BP:FL:front leg][CONTYPE:UPPERBODY][LIMB][STANCE]
BP, FL, "front leg", CONTYPE are the same things as before. However there 3 new tokens.
- [LIMB] means that this part is a limb and can be easily lopped off, also it allows wrestling with it.
- [STANCE] means that the creature uses this bodypart to stand. If the half of the total number of STANCE bodyparts is damaged the creature falls on the ground and cannot get up.
Two rear legs are added the same way, but they're connected to the lower body.
[BP:RRL:right rear leg][CONTYPE:LOWERBODY][LIMB][STANCE][RIGHT] [BP:LRL:left rear leg][CONTYPE:LOWERBODY][LIMB][STANCE][LEFT]
"Right" and "left" tokens do not require any special explanation.
Now we want a tail which can be used as a tentacle to wrestle and grap things.
[BP:TAILT:tail tentacle][CONTYPE:LOWERBODY][LIMB][GRASP]
- Here goes the "GRASP" token, it allows creatures to pick up items and grab bodyparts.
So now we have.
creature_tripod [OBJECT:BODY] [BODY:TRIPOD] [BP:UB:upper body][UPPERBODY][LOWERBODY] [BP:FL:front leg][CONTYPE:UPPERBODY][LIMB][STANCE] [BP:RRL:right rear leg][CONTYPE:LOWERBODY][LIMB][STANCE][RIGHT] [BP:LRL:left rear leg][CONTYPE:LOWERBODY][LIMB][STANCE][LEFT] [BP:TAILT:tail tentacle][CONTYPE:LOWERBODY][LIMB][GRASP]
Is it all right? No! We forgot the head-arm with a single eye. We could make more bodyparts to finish the picture but I want to teach you how to use BODYGLOSS.
Simply BODYGLOSS just renames the things while leaving the contents unharmed. Let's use a bit of imagination here. We already have a head on other creatures and a single eye from cyclops.
Bodygloss syntax is:
[BODYGLOSS:ID:original:new]
Where "ID" = unique identificator, "original" = the original name of the "new" is the name which replaces the original one. So you use the already present bodypart but in the creature file but add a bodygloss reference after that. I'll show you.
But we wanted 3 fingers for the palm-head. They are not related to the structure above because they should be connected to the head which is not listed there. So let's make them as a new body.
[BODY:HEAD_3FINGERS] [BP:HF1:first head finger][CONTYPE:HEAD][SMALL][DIGIT] [BP:HF2:second head finger][CONTYPE:HEAD][SMALL][DIGIT] [BP:HF3:third head finger][CONTYPE:HEAD][SMALL][DIGIT]
We use contype because it's safer to connect to an object with any ID and a [HEAD] token (it should definitely be on any kind of head) than to the specialized ID which may appear wrong.
Now let's make the bodygloss I described. Remember the syntax. We rename the usual head to head-palm and the usual cyclops'es eye to "eye on the palm"
[BODYGLOSS:HEAD_PALM:head:head-palm] [BODYGLOSS:EYE_PALM:eye:eye on the palm]
Don't forget that every ID I use I take from my head, you can call it anything you want, just make it reasonable for modders to understand what the heck is that.
The full content of our new body file is.
creature_tripod [OBJECT:BODY] [BODY:TRIPOD] [BP:UB:upper body][UPPERBODY][LOWERBODY] [BP:FL:front leg][CONTYPE:UPPERBODY][LIMB][STANCE] [BP:RRL:right rear leg][CONTYPE:LOWERBODY][LIMB][STANCE][RIGHT] [BP:LRL:left rear leg][CONTYPE:LOWERBODY][LIMB][STANCE][LEFT] [BP:TAILT:tail tentacle][CONTYPE:LOWERBODY][LIMB][GRASP]
[BODY:HEAD_3FINGERS] [BP:HF1:first head finger][CONTYPE:HEAD][SMALL][DIGIT] [BP:HF2:second head finger][CONTYPE:HEAD][SMALL][DIGIT] [BP:HF3:third head finger][CONTYPE:HEAD][SMALL][DIGIT]
[BODYGLOSS:HEAD_PALM:head:head-palm]
[BODYGLOSS:EYE_PALM:eye:eye on the palm]
Note that I leave empty lines between neighbouring structures, it's not necessary but it greatly improves the code's readability.
Let's look a bit forward and describe how the body is added to the creature. If you add no body to the creture it won't have any body parts to damage. The token is [BODY:<contents>]. Remember the order of body parts: if the A is connected to B then B should be listed before A.
We will need organs for our creature, I want a brain, a heart, lungs, organs, spine and guts. They are already present in body_default.txt so I'll use them. Don't be afraid to borrow bodyparts from original file or other files and don't hesistate to use bodygloss.
So a bit later we will have to put the full body in the creature information like this:
[BODY:TRIPOD:HEAD:HEAD_3FINGERS:1EYE:BRAIN:HEART:2LUNGS:ORGANS:GUTS:SPINE]
Notice that I borrowed HEAD, 1EYE, BRAIn, HEART, 2LUNGS, ORGANS, GUTS and SPINE from body_default.txt.
The bodyglosses in creature raws are listed in 1 token and divided by ":" symbols.
[BODYGLOSS:HEAD_PALM:EYE_PALM]
Adding the creature
Creature template
File with a name creature_template.txt
creature_template [OBJECT:CREATURE] [CREATURE:CREATURE1] [NAME:creature:creatures:creature] [TILE:'C'][COLOR:1:0:1] [PREFSTRING:prefstring]