Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 3 4 [5] 6 7 ... 24

Author Topic: Roses' Script, System, and Utilities Collection (07/06/2021)  (Read 91388 times)

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #60 on: January 25, 2016, 08:36:03 pm »

First, it should be able to pick an attack and bodypart at random so you can just sic one unit on another.  Main attacks are 100x more likely than secondary iirc.  Just need to handle the case of disabled attacks (no teeth = no BITE, only checked if the BITE was rolled), where you drop that attack from contention and roll again, ultimately defaulting to a PUSH attack.  I hope that isn't too much work.

Then, a -strict flag can direct "use the parameters I gave if valid, otherwise do nothing."  Without that tag, a bad suggestion defaults to the above random attack.

Maybe a -force flag as well just in case you really did want to BITE with the TAIL for the giggles.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

expwnent

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #61 on: January 26, 2016, 02:28:23 am »

I find that loud error messages by default are a better policy than guessing at what the calling script meant. It helps debugging.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #62 on: January 26, 2016, 08:18:16 am »

I find that loud error messages by default are a better policy than guessing at what the calling script meant. It helps debugging.
In that case, make it pick a random attack only when told to do so, perhaps a -random flag.  If -random is present with an explicit directive, it fills in the parameters not specified by the calling script.  For example, a SCRATCH attack with didn't specify a particular limb.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #63 on: January 26, 2016, 01:25:46 pm »

Hmmm. Choices, choices, choices.

How about this;

Start off with a simple script, just
Code: [Select]
unit/attack -attacker \\UNIT_ID -defender \\UNIT_ID
This will make the attacking unit attack the defending unit, picking the attack at random (weighted to pick a main attack over a secondary) and picking the body part target at random (with weights based off body part size). So that it functions as similar to the in-game attack decision as possible.

Then you start adding options. Things like
Code: [Select]
-target BP_CATEGORY (body part to target e.g. -target UPPERBODY)
Code: [Select]
-attack ATTACK (type of attack e.g. -attack BITE)
Code: [Select]
-velocity # (velocity of the attack e.g. -velocity 1000)
Code: [Select]
-hitchance # (hit chance of the attack e.g. -hitchance 100)
That handles the basic options for one unit attacking another. Then you can get to the more advanced options. Like
Code: [Select]
-weapon Equipped (uses equipped weapon to attack with)
Code: [Select]
-weapon Fake -material MAT_ID -quality # (this will create a fake weapon that lasts for a small duration, long enough for the attack to be carried out, and then disappears e.g. -weapon Fake -material INORGANIC:STEEL -quality 1. Note, this works because the game doesn't actually check where the weapon is or who is holding it when performing an attack)
Code: [Select]
-delay # (how many ticks to wait before the attack is made e.g. -delay 5. Defaults to 1)
Code: [Select]
-number # (how many attacks to make e.g. -number 5. Defaults to 1)
Now the only problem I foresee for this method is the hit chance. Velocity can be calculated (thanks to Urist DaVinci's work) for any given weapon/body part attack, so leaving that blank is fine (i.e. there is a default). But we don't know the formula that the game uses to calculate the hit chance. My gut feeling is to just default the hit chance to 100, so that the attack always hits, but I am open to suggestions.

Thoughts?
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #64 on: January 26, 2016, 01:44:36 pm »

I like the system you have there.  Does this completely bypass dodging, or fit normally within the combat system?

I've never seen an attack with the current script get dodged.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #65 on: January 26, 2016, 01:47:36 pm »

I like the system you have there.  Does this completely bypass dodging, or fit normally within the combat system?

I've never seen an attack with the current script get dodged.

Good questions, and I don't know. I think the hit chance plays into dodging. Meaning that setting hit chance = 100 completely bypasses dodging. But I will test it to see if dodging is taking into account before or after hit chance is defined.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #66 on: January 26, 2016, 02:16:43 pm »

I like the system you have there.  Does this completely bypass dodging, or fit normally within the combat system?

I've never seen an attack with the current script get dodged.

Good questions, and I don't know. I think the hit chance plays into dodging. Meaning that setting hit chance = 100 completely bypasses dodging. But I will test it to see if dodging is taking into account before or after hit chance is defined.
Keep in mind, I've only ever used the current script to start a fight between units that aren't in combat.  It might be hard (or impossible) to dodge that kind of "sneak attack."
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #67 on: January 26, 2016, 02:35:59 pm »

I like the system you have there.  Does this completely bypass dodging, or fit normally within the combat system?

I've never seen an attack with the current script get dodged.

Good questions, and I don't know. I think the hit chance plays into dodging. Meaning that setting hit chance = 100 completely bypasses dodging. But I will test it to see if dodging is taking into account before or after hit chance is defined.
Keep in mind, I've only ever used the current script to start a fight between units that aren't in combat.  It might be hard (or impossible) to dodge that kind of "sneak attack."

Very true. I think I can test that out too.

EDIT: Alright, it's working now, I am still doing some testing though, but I should at least put out this attack script tomorrow. There will be two versions, a stand alone that I will post here, and then a version that will be included with my pack (the reason there will be a different version in my pack is because I use a lot of dfhack.script_environment calls, for the stand alone version I have just copied those functions into the script itself)
« Last Edit: January 28, 2016, 11:46:07 pm by Roses »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #68 on: January 29, 2016, 09:12:06 pm »

Alright, here you go. Tested to work just fine in the arena, all of the options that I mentioned in the above post work except for the creating of a fake item for an attack. You also currently can't use an attack with the incorrect body part (PUNCH attack can't be with your feet). Eventually I will add that option, but for now its not there.

Code: (unit/attack.lua) [Select]
local utils = require 'utils'

validArgs = validArgs or utils.invert({
 'help',
 'defender',
 'attacker',
 'target',
 'attack',
 'velocity',
 'hitchance',
 'weapon',
 'delay',
 'number',
})
local args = utils.processArgs({...}, validArgs)

if args.defender and tonumber(args.defender) then
 defender = df.unit.find(tonumber(args.defender))
else
 print('No defender selected')
 return
end
if args.attacker and tonumber(args.attacker) then
 attacker = df.unit.find(tonumber(args.attacker))
else
 print('No attacker selected')
 return
end

attack = nil
target = nil

if not args.target then
 local rand = dfhack.random.new()
 local totwght = 0
 local weights = {}
 weights[0] = 0
 local n = 1
 for _,targets in pairs(defender.body.body_plan.body_parts) do
  totwght = totwght + targets.relsize
  weights[n] = weights[n-1] + targets.relsize
  n = n + 1 
 end
 while not target do
  pick = rand:random(totwght)
  for i = 1,n do
   if pick >= weights[i-1] and pick < weights[i] then
    target = i-1
    break
   end
  end
  if defender.body.components.body_part_status[target].missing then target = nil end
 end
else
 for i,targets in pairs(defender.body.body_plan.body_parts) do
  if targets.token == args.target then
   target = i
   break
  end
 end
end
 
if not target then
 print('No appropriate target found')
 return
end
delay = args.delay or 1
number = args.number or 1
hitchance = args.hitchance or 100
 
if args.weapon then
 local item = nil
 if args.weapon == 'Equipped' then
  for _,items in pairs(attacker.inventory) do
   if items.mode == 1 then
    item = items.item
    break
   end
  end
  if not item then
   print('No Equipped Weapon')
   return
  end
 end
 if not args.attack then
  local rand = dfhack.random.new()
  local totwght = 0
  local weights = {}
  weights[0] = 0
  local n = 1
  for _,attacks in pairs(item.subtype.attacks) do
   totwght = totwght + 1
   weights[n] = weights[n-1] + 1
   n = n + 1 
  end
  pick = rand:random(totwght)
  for i = 1,n do
   if pick >= weights[i-1] and pick < weights[i] then
    attack = i-1
    vel_mod = item.subtype.attacks[attack].velocity_mult
    break
   end
  end
 else
  for i,attacks in pairs(item.subtype.attacks) do
   if attacks.verb_2nd == args.attack or attacks.verb_3rd == args.attack then
    attack = i
    vel_mod = item.subtype.attacks[attack].velocity_mult
    break
   end
  end
 end

 if not attack then
  print('No appropriate attack found')
  return
 end

 if args.velocity then
  velocity = tonumber(args.velocity)
 else
  material = dfhack.matinfo.decode(item.mat_type,item.mat_index).material
  weight = math.floor(item.subtype.size*material.solid_density/100000)
  weight_fraction = item.subtype.size*material.solid_density*10 - weight*1000000
  effweight=attacker.body.size_info.size_cur/100+weight*100+weight_fraction/10000
  velocity = attacker.body.size_info.size_base * dfhack.units.getPhysicalAttrValue(attacker,0) * vel_mod/1000/effweight/1000
  if velocity == 0 then velocity = 1 end
 end

 j = 0
 while j < number do
 action = df.unit_action:new()
 action.id = attacker.next_action_id
 attacker.next_action_id = attacker.next_action_id + 1

 action.type = 1
 attack_action = action.data.attack
 attack_action.target_unit_id = defender.id
 attack_action.attack_item_id = item.id
 attack_action.target_body_part_id = target
 attack_action.attack_body_part_id = -1
 attack_action.unk_30 = velocity
 attack_action.attack_id = attack
 attack_action.flags = 7

 attack_action.unk_28 = hitchance
 attack_action.unk_2c = 100
 attack_action.unk_38 = 100
 attack_action.unk_3c = 100
 attack_action.timer1 = delay
 attack_action.timer2 = delay
 for i,x in pairs(attack_action.unk_4) do
  attack_action.unk_4[i] = 7
 end
 attack_action.unk_4.wrestle_type = -1
 attacker.actions:insert('#',action)
 j = j + 1
 end
else
 if not args.attack then
  local rand = dfhack.random.new()
  local totwght = 0
  local weights = {}
  weights[0] = 0
  local n = 1
  for _,attacks in pairs(attacker.body.body_plan.attacks) do
   if attacks.flags.main then
    totwght = totwght + 100
    weights[n] = weights[n-1] + 100
   else
    totwght = totwght + 1
    weights[n] = weights[n-1] + 1
   end
   n = n + 1 
  end
  while not attack do
   pick = rand:random(totwght)
   for i = 1,n do
    if pick >= weights[i-1] and pick < weights[i] then
     attack = i-1
     vel_mod = attacker.body.body_plan.attacks[attack].velocity_modifier
     break
    end
   end
   if attacker.body.components.body_part_status[attacker.body.body_plan.attacks[attack].body_part_idx[0]].missing then attack = nil end
  end
 else
  for i,attacks in pairs(attacker.body.body_plan.attacks) do
   if attacks.name == args.attack then
    attack = i
    vel_mod = attacker.body.body_plan.attacks[attack].velocity_modifier
    break
   end
  end
 end

 if not attack then
  print('No appropriate attack found')
  return
 end
 
 if args.velocity then
  velocity = tonumber(args.velocity)
 else
  velocity = 100 * dfhack.units.getPhysicalAttrValue(attacker,0) / 1000 * vel_mod / 1000
 end

 j = 0
 while j < number do
 action = df.unit_action:new()
 action.id = attacker.next_action_id
 attacker.next_action_id = attacker.next_action_id + 1

 action.type = 1
 attack_action = action.data.attack
 attack_action.target_unit_id = defender.id
 attack_action.attack_item_id = -1
 attack_action.target_body_part_id = target
 attack_action.attack_body_part_id = attacker.body.body_plan.attacks[attack].body_part_idx[0]
 attack_action.unk_30 = velocity
 attack_action.attack_id = attack
 attack_action.flags = 7

 attack_action.unk_28 = hitchance
 attack_action.unk_2c = 100
 attack_action.unk_38 = 100
 attack_action.unk_3c = 100
 attack_action.timer1 = delay
 attack_action.timer2 = delay
 for i,x in pairs(attack_action.unk_4) do
  attack_action.unk_4[i] = 7
 end
 attack_action.unk_4.wrestle_type = -1
 attacker.actions:insert('#',action)
 j = j + 1
 end
end

Example uses
Code: [Select]
unit/attack -attacker 0 -defender 1
unit/attack -attacker 0 -defender 1 -target UB
unit/attack -attacker 0 -defender 1 -attack PUNCH
unit/attack -attacker 0 -defender 1 -target RH -weapon Equipped

I also tested the hit chance calculations. Even with hitchance = 100 you can both still miss and be dodged. The higher your skill in the weapon the less likely you are to miss, the higher the defenders dodge skill the more likely they are to dodge. With Legendary dodging and a hitchance of 100 around 80 to 90 of 1000 attacks were dodged and another 100 or so were missed.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #69 on: February 02, 2016, 09:51:56 am »

Thanks Roses!

Disturbing creatures hidden in the stone should get considerably more dangerous now.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #70 on: February 11, 2016, 09:36:53 am »

A couple small updates for the attack script due to the naming of unknown attributes:

attack_action.unk_30 -> attack_action.attack_velocity
attack_action.unk_3c -> attack_action.attack_accuracy

(My guess is that these were named based on your work.)
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #71 on: February 11, 2016, 12:07:02 pm »

The former based on mine, the latter based on Roses', I think. I didn't even know about attack_accuracy, but I was using unk_30 for Sparking for a while as attack velocity.

attack_accuracy is actually going to be very helpful...

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #72 on: February 11, 2016, 04:54:34 pm »

A couple small updates for the attack script due to the naming of unknown attributes:

attack_action.unk_30 -> attack_action.attack_velocity
attack_action.unk_3c -> attack_action.attack_accuracy

(My guess is that these were named based on your work.)

Thanks for the update, I also noticed in error in the script, I have unk_28 = hitchance, it should be unk_3c = hitchance.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #73 on: February 11, 2016, 05:42:17 pm »

In my particular case I run it with the defaults for accuracy and velocity, but more flexibility is always better.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Roses

  • Bay Watcher
    • View Profile
Re: Roses' Script, System, and Utilities Collection v0.1 (10/27/2015)
« Reply #74 on: February 11, 2016, 09:01:59 pm »

So I finally decided to dust off the random creature creation script that I had created before. I have added a GUI and many other features. See the GUI below, and read how the script works. It is almost ready for release, with just a few more options that need to be moved from the black box of the code into easily configurable options. Let me know what you think!

Spoiler (click to show/hide)

Types of Templates:
Code: [Select]
ATTACK
BIOME
CASTE
EXTRACT
INTERACTION
MATERIAL
TYPE
SUBTYPE
HEAD
TORSO
LEG
ARM
HAND
FOOT
EYE
EAR
NOSE
MOUTH
ORGANS
SKELETAL
ATTACHMENT_HEAD
ATTACHMENT_TORSO
ATTACHMENT_LIMBS
ATTACHMENT_MISC

Template Template:
Code: [Select]
[TEMPLATE:-type-:-ID-]
 {DESCRIPTION:-desc-}
 {NAME:-names-}
 {ATTACKS:-attacks-}
 {ARGS:-args-}
 {TOKENS:-tokens-}
 {LINK:-tokens-}
 {EXCEPT:-tokens-}
 {PERCENT:-tokens-}
 {BODY:-body parts-}
 -raws-

Each template can have as many or as few of the above entries.

-type- is one of the above types
-ID- is the designation you give the template, must be unique
-desc- is a string which may be used in the creatures description (more below)
-names- complex behavior, see below
-attacks- is a list of attacks that is associated with the template, all attacks associated with templates will be added to the creature (seperated by commas)
-tokens- a list of self declared tokens which are added to the creature (more below)
-body parts- a list of body parts which are added to the [BODY:--] token of the creature
-raws- any additional raws that are added to the creature, the additions are done in a specific order (more below)

Example Template:
Code: [Select]
[TEMPLATE:EXTRACT:VENOM_1]
{DESCRIPTION:It has a painful venom.}
{ARGS:SEV,END}
    {TOKENS:TOXIC_CREATURE}
{PERCENT:VENOM}
    {LINK:VENOM}
    {EXCEPT:TOXIC_CREATURE}
[USE_MATERIAL_TEMPLATE:VENOM:CREATURE_EXTRACT_TEMPLATE]
[STATE_NAME:ALL_SOLID:frozen #NAME venom]
[STATE_ADJ:ALL_SOLID:frozen #NAME venom]
[STATE_NAME:LIQUID:#NAME venom]
[STATE_ADJ:LIQUID:#NAME venom]
[STATE_NAME:GAS:boiling #NAME venom]
[STATE_ADJ:GAS:boiling #NAME venom]
[PREFIX:NONE]
[ENTERS_BLOOD]
[REACTION_CLASS:VENOM]
[SYNDROME]
[SYN_NAME:#NAME venom]
[SYN_INJECTED]
[SYN_CONTACT]
[CE_PAIN:SEV:#ARG1:PROB:100:RESISTABLE:SIZE_DILUTES:LOCALIZED:VASCULAR_ONLY:START:0:PEAK:10:END:#ARG2]
[EXTRACT:LOCAL_CREATURE_MAT:VENOM]
TOKENS vs. LINK vs. EXCEPT vs. PERCENT
-tokens- specified in {TOKENS} are added to the creature when the template is selected
-tokens- specified in {LINK} are checked against when a template is considered, if the LINK tokens are present the template is selected, if not the template is passed
-tokens- specified in {EXCEPT} work exactly the opposite of {LINK}, if present the template is passed, if not the template is selected
-tokens- specified in {PERCENT} are assigned at the onset of creature creation depending on values that the user defines in the creature creation GUI

Note that there are specific special tokens used internally, these tokens are precedded with an '#' and are;
Code: [Select]
#VERMIN - Checks if the creature is the correct size for vermin (defined by Size: Vermin)
#TINY - Checks if the creature is the correct size for tiny vermin (defined by Size: Tiny)
#TRADER - Checks if the creature is the correct size for a trading animal (defined by Size: Trade)
#MALE - Used for defining male castes in TEMPLATE:CASTE - LINK
#FEMALE - Used for defining female castes in TEMPLATE:CASTE - LINK
#DESC - Used to fill in the creature description when creating raws, very little use for this as the script currently creates a description for each caste already
#NAME - Used to fill the the creatue name when creating raws, very useful, allows for naming of things directly in the templates
#ARG1, #ARG2, #ARG3, etc... - Used to fill in the arguments provided in TEMPLATE - ARGS
#SWIMMING_GAITS - If this tag is present in a creature (no matter which template the creature recieved it from) will alter the gaits, flipping the WALK and SWIM gaits
#ONLY_SWIMMING - Same effect as above, but removes all other gaits (WALK, CLIMB, CRAWL, FLY)
#FLYING_GAITS - If this tag is present in a creature (no matter which template the creature recieved it from) will alter the gaits, moving WALK to FLY and CRAWL to WALK
#ONLY_FLYING - Same effect as above, but removes all other gaits (WALK, CLIMB, CRAWL, SWIM)
#NOARMS - Removes the CLIMB gait
#NOLEGS - Removes the WALK gait

Creation Process:
Step 1: Generate all numbers based on user input. This includes argument numbers, size, age, population numbers, attributes, and any other number based entries.
Step 2: Calculate {PERCENT} tokens based on random number generation (e.g. if randint(1,100) < PERCENT add -tokens-)
Step 3: Select the TYPE template to be used for the creature. This is the first template to be selected
Step 4: Select the BIOME template
Step 5: Begin selecting body templates.
 Start by selecting 1 TORSO, 1 HEAD, 1 LEG, 1 ARM, 1 HAND, and 1 FOOT template
 Then select 1 ORGANS and 1 SKELETAL template
 Next select 1 EYE, 1 EAR, 1 MOUTH, and 1 NOSE template
 Finally select a number of ATTACHMENT_TORSO, ATTACHMENT_HEAD, ATTACHMENT_LIMBS, and ATTACHMENT_MISC templates based on a user defined limit
 Note that each of these templates is checked against the {LINK} and {EXCEPT} and the -tokens- of the creature. The order is specific, so a   HEAD template can not forbid a TORSO template, but a TORSO template can forbid a HEAD template
Step 6: Select the MATERIAL template
Step 7: Select the CASTE templates, by default a single template with {LINK:#MALE} and a single template with {LINK:#FEMALE} will be selected. This is configurable by changing the number of female, male and neutral castes in the GUI
Step 8: Select the SUBTYPE templates. The number of SUBTYPE templates chosen is between 0 and Max Subtypes which is configurable in the GUI
Step 9: Select and EXTRACT templates. These templates are chosen differently than others. Instead of randomly picking one, all templates that meet the {LINK} and {EXCEPT} criteria are added to the creature
Step 10: Select the INTERACTION templates. In the gui the maximum number of interactions a single creature can have is specifiable. In addition you can specify the percent chance that each individual INTERACTION template has for being added.
Step 11: Get all of the {ATTACKS} from each template that has been selected for the creature
Step 12: Now all of the templates have been selected, the actual creation of the creature begins. The format of the creation is (entries with an '#' are generated as described below)

Code: [Select]
[CREATURE:--]
 [NAME:#NAME]
 [CREATURE_TILE:--]
 [COLOR:--:--:--]

=> TYPE template -raws- go here

=> SUBTYPE templates -raws- go here

=> BIOME template -raws- go here

=> all numbers generated in Step 1: go here (e.g. [MAX_AGE:--:--], [BODY_SIZE:--:--:--], [CHILD:--], etc...)

 [APPLY_CREATURE_VARIATION:#SPEED]

 [BODY:#BODY]

=> MATERIAL template -raws- go here

=> EXTRACT templates -raws- go here

=> INTERACTION templates -raws- go here

=> ATTACK templates -raws- go here

=> CASTE template -raws- go here, additionally [DESCRIPTION:#DESC] and [CASTE_NAME:#CASTE_NAME] are added here as well

#DESC is generated by using the various -desc- provided in the templates. The actual method for how they are added is
 body_dc = torso_dc + ' ' + torsoa_dc + ', ' + head_dc + ' ' + heada_dc
 limb_dc = arm_dc + ' ' + hand_dc + ' and ' + leg_dc + ' ' + foot_dc
 face_dc = eye_dc + ', ' + nose_dc + ', ' + mouth_dc + ', and ' + ear_dc
 description = type_dc + subtype_dc + '. ' + material_dc + ' with ' + body_dc + ' and ' + face_dc + '. It has ' + limb_dc + '. It ' + biome_dc + '. ' + extract_dc + '. ' + interaction_dc
Note that, while not perfect, it does generate reasonable descriptions, for example;
"A ferocious animal found only in the most savage of landscapes. A scaled creature with a four part body, three heads and eight eyes, a large trunk, no visible mouth, and one ear. It has four upper tentacles with claws and four legs and feet with four toes each. It Is only found underground."

#BODY is generated by combining the {BODY} -body parts- from each template. They are added together TORSO -> HEAD,ARM,LEG -> HAND,FOOT,EYE,EAR,NOSE,MOUTH -> ORGANS,SKELETAL -> all others

#SPEED is calculated for each GAIT (WALK, CLIMB, CRAWL, SWIM, and FLY) based on the numbers provided in the GUI. The speeds are then altered depending on the special tokens present on the creature. This allows for you to generate land and water animals in the same group by switching the WALK/SWIM gaits depending on which they are.

#NAME and #CASTE_NAME are generated in one of two ways. Either randomly by a chosen DF language file. Or based on the templates {NAME}. Currently the {NAME} feature is bugged, but I am hoping to have it working soon.
Logged
Pages: 1 ... 3 4 [5] 6 7 ... 24