Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Interactions Targeting Oneself  (Read 850 times)

Derpy Dev

  • Bay Watcher
  • Normal Person Doing Normal Things
    • View Profile
Interactions Targeting Oneself
« on: April 28, 2017, 03:57:32 pm »

So I am screwing around with interactions and trying to figure out how they work. I have created an interaction that changes the display tile of whatever uses it.
Code: [Select]
[INTERACTION:A_SYNDROME]
[I_SOURCE:CREATURE_ACTION]
[I_TARGET:A:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[I_EFFECT:ADD_SYNDROME]
[IE_TARGET:A]
[IE_IMMEDIATE]
[SYNDROME]
[SYN_NAME:EPIC_SYNDROME_BRO]
            [SYN_AFFECTED_CLASS:GENERAL_POISON]
            [CE_DISPLAY_TILE:TILE:228:4:0:0:PROB:100]

Code: [Select]
[CAN_DO_INTERACTION:A_SYNDROME]
[CDI:ADV_NAME:Improve yourself]
[CDI:TARGET:SELF_ONLY]
[CDI:WAIT_PERIOD:999999]
[CDI:FREE_ACTION]
It does work, creatures I gave the above code to are able to use A_SYNDROME. But they don't do it in the arena unless they see something they want to attack. And if they do, the creature they are attacking also gets the syndrome. Anybody know why? After posting this message I am gonna check it out in fortress mode to see if that makes a difference.

EDIT: Since I made this post, I have concluded that every creature on the map is affected by this syndrome. That means that if a dwarf decides to punch an aardvark, a carp on the other side of the map has its display tile changed. Interesting.
« Last Edit: April 28, 2017, 04:30:31 pm by Derpy Dev »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: Interactions Targeting Oneself
« Reply #1 on: April 28, 2017, 09:48:43 pm »

Your CDI:TARGET is wrong, it should be CDI:TARGET:A:SELF_ONLY. Right now there is no target type so it targets everyone in range, and since your range isn't specified it targets everyone.
Logged

Derpy Dev

  • Bay Watcher
  • Normal Person Doing Normal Things
    • View Profile
Re: Interactions Targeting Oneself
« Reply #2 on: April 29, 2017, 04:23:58 pm »

Your CDI:TARGET is wrong, it should be CDI:TARGET:A:SELF_ONLY. Right now there is no target type so it targets everyone in range, and since your range isn't specified it targets everyone.

Thank you very much! I made the change you said to, switching out [CDI:TARGET:SELF_ONLY] for [CDI:TARGET:A:SELF_ONLY]. It still only uses the interaction during combat though, so I'm thinking I might take a page from the pokemon mod's book and just give them the syndrome when they are born.

D_E

  • Bay Watcher
    • View Profile
Re: Interactions Targeting Oneself
« Reply #3 on: April 30, 2017, 02:57:55 pm »

Thank you very much! I made the change you said to, switching out [CDI:TARGET:SELF_ONLY] for [CDI:TARGET:A:SELF_ONLY]. It still only uses the interaction during combat though, so I'm thinking I might take a page from the pokemon mod's book and just give them the syndrome when they are born.

Yep, my understanding is that only the combat AI tries to use interactions, in much the same way that only the combat AI climbs walls/trees/jumps etc.
Logged
Mods I've done:
Zelda mod-mod, Beta in the Wild DF 47.04
Illithid Empire mod DF 31.25 (update canceled)
Spotter's Guide to Illithids (Genesis mod-mod) genesis 3.19a4 (update canceled)