Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [Premium Dwarf Fortress] Can you add/remove CAN_LEARN on combat start/end?  (Read 579 times)

Chain

  • Bay Watcher
  • When God closes a door, punch him through it!
    • View Profile

Hello I'm new to modding and am the Author of the Brave Cavies Steam Workshop mod.
https://steamcommunity.com/sharedfiles/filedetails/?id=2904475791

Idea 1:
I did read through the modding wiki and examples and therefore think it is possible with a combination of interactions/syndromes, but I can't wrap my head around how to check for combat start and end to add or remove the token.

The Cavies should add to them selves the [CAN_LEARN] token when they enter combat, and after combat remove the token again. So they can breed like normal animals and also acquire skills through combat.

Idea 2:
Alternatively permanently adding CAN_LEARN to only War/Hunting animals. But I have even less of a clue if this is possible. I didn't see anything that lets me specify something like that in the Creature tokens.

I put my creature file in here as well so you see what I already have. The CAN_LEARN token gets removed from the file once I figured out how to do what I want.

Any insight and help is greatly appreciated.
Thanks

#EDIT: Current Creature TXT found below
« Last Edit: December 28, 2022, 04:24:53 am by Chain »
Logged

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: [Premium Dwarf Fortress] Can you add/remove CAN_LEARN on combat start/end?
« Reply #1 on: December 27, 2022, 06:03:43 pm »

You can add a self-targeting interaction with USAGE_HINT:DEFEND which adds the CAN_LEARN tag for a short period of time.
Note that whether a creature is considered sapient with respect to eating it is determined by whether it has CAN_LEARN when it dies, so any of these creature which die in combat will not be eaten by dwarves.

Chain

  • Bay Watcher
  • When God closes a door, punch him through it!
    • View Profile
Re: [Premium Dwarf Fortress] Can you add/remove CAN_LEARN on combat start/end?
« Reply #2 on: December 27, 2022, 10:15:31 pm »

You can add a self-targeting interaction with USAGE_HINT:DEFEND which adds the CAN_LEARN tag for a short period of time.
Note that whether a creature is considered sapient with respect to eating it is determined by whether it has CAN_LEARN when it dies, so any of these creature which die in combat will not be eaten by dwarves.

Thanks this was another Idea I had too :D.
I figured I could somehow create 2 interactions. The first adding CAN_LEARN if the cavy does not have CAN_LEARN and is in combat with defend. And the second to remove the CAN_LEARN if it has it and is not in combat.

I don't understand syndromes yet maybe you can clarify a few questions I have.
Do syndromes have a way to do something like remove CAN_LEARN if the requirements don't match anymore? Or if the time for it ran out and is not refreshed anymore? In programming I would probably use a fall through else if condition.
And another question regarding Interactions is how low should I set the cool down? And if I set it too low will it impact the game performance?

#UPDATE: I've just implemented your idea, lets hope this works and there are no side effects :). Thanks again for helping. I did put the creature and interaction file down below, possibly helping someone trying to do the same.

Thanks

Creature txt:
Spoiler (click to show/hide)

Interaction txt:
Spoiler (click to show/hide)
« Last Edit: December 28, 2022, 04:23:36 am by Chain »
Logged