PDA

View Full Version : Conditional Action Effects (IF, IFT, and IFA)



Coveny
September 11th, 2020, 22:05
Just want to verify that there is no functionality for this in FG. It looks like "IF" covers the PC and "IFT" covers what the PC is attacking, but there isn't a "IFA" for something attacking the PC. In other words, there isn't any way to do this:

IFA: SIZE(=medium); AC: 1

Also, I can't get CRIT to work with IFT. This coding does not set the crit range correctly when the IFT condition is used:

IFT: TYPE (giant); CRIT: 19

CRIT: 19 works
IFT: TYPE (giant); DMG: 1d8 works

But if when I swap out DMG with CRIT it doesn't work.

For reference, this is all around conditional coding the 5e Feat "Giant Slayer".

LordEntrails
September 11th, 2020, 22:15
IFT is for If Target. There is no way to test for incoming Attacks, etc.

Only certain modifiers can be used with the Target IFT. These should all be marked as such in the wiki. Not sure which ones, but from the behavior you mention I suspect Size is not one of them.

Zacchaeus
September 11th, 2020, 22:19
Both IF and IFT work on both PCs and NPCs. It all depends on where the effect is. If the effect is on a PC the IF refers to the PC and IFT refers to it’s target. Similarly if the effect are on the NPC then IF refers to the NPC and IFT refers to it’s target. The target of IFT can be anything that the PC or NPC targets. You’ll find more details in video five in this series https://www.fantasygrounds.com/forums/showthread.php?41478-Effects-Videos-for-5E

As regards CRIT this will not work with IF or IFT. Only targeted effects can be used in such statements. See the Wiki; in the last colum you will see a T against effects which are targeted effects and so can be used in IF and IFT effects. https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/884913/5E+Effects+for+Advanced+Automation

Zacchaeus
September 11th, 2020, 22:21
IFT is for If Target. There is no way to test for incoming Attacks, etc.

Only certain modifiers can be used with the Target IFT. These should all be marked as such in the wiki. Not sure which ones, but from the behavior you mention I suspect Size is not one of them.


IF and IFT tests for conditions and conditional modifiers. SIZE is a conditional modifier.

Trenloe
September 11th, 2020, 23:03
IFT also works in reverse for defensive targeted modifiers - AC is such a modifier. Think of it as "IF the creature Targeting me.." for defensive modifier effects that can be targeted.

So, IFT: SIZE(medium); AC:1 on a creature will give that creature a +1 to AC when attacked by medium sized creatures.

LordEntrails
September 11th, 2020, 23:39
IF and IFT tests for conditions and conditional modifiers. SIZE is a conditional modifier.
You are right of course, meant CRIT and not SIZE :)

IFT also works in reverse for defensive targeted modifiers - AC is such a modifier. Think of it as "IF the creature Targeting me.." for defensive modifier effects that can be targeted.

So, IFT: SIZE(medium); AC:1 on a creature will give that creature a +1 to AC when attacked by medium sized creatures.
Oh, I didn't know that, or forgot that :)

Coveny
September 11th, 2020, 23:59
Ok so IFT applies to both targeted and attacking I did not know that.

What about the IFT type crit coding?

Zacchaeus
September 12th, 2020, 00:18
As I said above CRIT is not a targeted effect so it can’t be used in an IF or IFT effect.

Kelrugem
September 12th, 2020, 00:40
As I said above CRIT is not a targeted effect so it can’t be used in an IF or IFT effect.

IF works always :) Only IFT stuff needs the targetability of an effect :) See the screenshot:


https://www.fantasygrounds.com/forums/attachment.php?attachmentid=39282&stc=1&d=1599867522



(though I am not sure about conditions as in IFT: ...; invisible; at least in 3.5e/PF1 conditions can never be combined with IFT even when targetable. But could be quickly tested :) )

leozelig
September 6th, 2021, 04:07
Does anyone know where targetable effect modifiers are defined in the 5E ruleset code? I want to add a few custom modifiers for the DCC ruleset if that's possible.

Kelrugem
September 7th, 2021, 13:34
Does anyone know where targetable effect modifiers are defined in the 5E ruleset code? I want to add a few custom modifiers for the DCC ruleset if that's possible.

what precisely do you mean? Do you have an example? The effect manage of 5e is good script to look at, there the logic is defined. The strings of the effects like ATK are usually defined in the scripts where they get called, like attack manager for ATK :)

leozelig
September 7th, 2021, 17:15
Here’s the effect I’m looking at…

IFT:CUSTOM(Hunt’s quarry); DIEATK:1

The effect DIEATK is unique to the DCC ruleset and in the example bumps your attack die from a d20 to a d24. That’s a common DCC mechanic. So, I looked at the EffectManagerDCC script but don’t see an obvious definition of what effects are targetable. The conditional is reading correctly, and it works for ATK but not DIEATK.

I can look at the ActionAttack script, but I don’t recall that defining what’s targetable either. Could be wrong, I’ll check it out. Thanks for the response Kelrugem :)

Kelrugem
September 7th, 2021, 21:01
Here’s the effect I’m looking at…

IFT:CUSTOM(Hunt’s quarry); DIEATK:1

The effect DIEATK is unique to the DCC ruleset and in the example bumps your attack die from a d20 to a d24. That’s a common DCC mechanic. So, I looked at the EffectManagerDCC script but don’t see an obvious definition of what effects are targetable. The conditional is reading correctly, and it works for ATK but not DIEATK.

I can look at the ActionAttack script, but I don’t recall that defining what’s targetable either. Could be wrong, I’ll check it out. Thanks for the response Kelrugem :)

ist DIEATK a targetable effect? If not, then this may be the reason :) Then IFT won't work; usually the IFT and CUSTOM codes are in the effect managers. If you look at IFT's code, then there is usually something like if not rTarget then return; (or something like this, to stop the for-clause there; rTarget the typical name of the target's node information). In other words, if there is no information about a target, then the effect will return false and anything after IFT won't get activated. This makes sense because IFT needs target information to do its stuff :)

So, my "educated guess" would be that you look indeed into the attack manager for the call of DIEATK. If the code calling for DIEATK does not proceed the target information, then this effect would not work with IFT, thence, you would need to change the code in such a way that target information is proceeded :) (may be as simple as simply adding the rTarget information; but depends on the code, I have no idea about DCC :D)

leozelig
September 7th, 2021, 23:24
That’s a good thought, I can look at the ActionAttack script.

DIEATK is not a targetable effect modifier since it only exists in the DCC ruleset. I’m trying to figure out how to make it a targetable modifier, but maybe that just isn’t possible. I spent a lot of time looking at EffectManagerDCC yesterday, and there is a call to a function in the EffectManager script in CoreRPG that is maybe one line of code and returns true or false for targetable or not - but I can’t tell how it’s deciding that. I’ll post the code I’m talking about in case it helps.

Thanks again for your suggestions!

Kelrugem
September 8th, 2021, 07:43
That’s a good thought, I can look at the ActionAttack script.

DIEATK is not a targetable effect modifier since it only exists in the DCC ruleset. I’m trying to figure out how to make it a targetable modifier, but maybe that just isn’t possible. I spent a lot of time looking at EffectManagerDCC yesterday, and there is a call to a function in the EffectManager script in CoreRPG that is maybe one line of code and returns true or false for targetable or not - but I can’t tell how it’s deciding that. I’ll post the code I’m talking about in case it helps.

Thanks again for your suggestions!

You're welcome https://www.fantasygrounds.com/forums/images/smilies/smile.png

Ah, I see; if it is rather based on CoreRPG, then IFT would have to be coded since IFT does not exist in CoreRPG code :) For example codes you can look into the effect manager of 5e or 3.5e for "IFT"; but if the effect manager of DCC has nothing in that direction, then there is certainly some work now needed for the code, I think :)

Cassandra Botil
September 8th, 2021, 15:07
Did you setle that stuff?
How did you wrap the issue?
Just interested.

Trenloe
September 8th, 2021, 16:46
That’s a good thought, I can look at the ActionAttack script.

DIEATK is not a targetable effect modifier since it only exists in the DCC ruleset. I’m trying to figure out how to make it a targetable modifier, but maybe that just isn’t possible. I spent a lot of time looking at EffectManagerDCC yesterday, and there is a call to a function in the EffectManager script in CoreRPG that is maybe one line of code and returns true or false for targetable or not - but I can’t tell how it’s deciding that. I’ll post the code I’m talking about in case it helps.

Thanks again for your suggestions!
Exact functionality of an effect is coded in the various manager_action_<action name>.lua scripts in the ruleset where the effect could apply to that action. Exactly which effect handler is called within the action manager (in 5E these are usually called through the EffectManager5E global script package) with exact functionality being determined by the effect handler called and the arguments used.

For example, we can see from the 5E effect page (https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996642031/5E+Effects+for+Advanced+Automation) that INIT is not a targetable effect, whereas ATK is. Looking in the manager_action_init.lua and manager_action_atk.lua handlers we can see that both use the EffectManager5E.getEffectsBonus function, but use different arguments"

INIT uses EffectManager5E.getEffectsBonus(rActor, {"INIT"})
ATK uses EffectManager5E.getEffectsBonus(rSource, {"ATK"}, false, aAttackFilter, rTarget)


As eluded to by @Kelrugem, the difference here is that a target record (rTarget) is passed to the ATK EffectManager5E.getEffectsBonus API call, thus allowing the code to include targetable operations.

Note that in addition, for attacks, there are effects calculated on the defender in ActorManager5E.getDefenseValue - this is where effects relevant to the defender are applied. A good example of this is the Invisible condition - the 5E effects Wiki says it's targetable but the effect line in the manager_action_atk.lua attack action only has EffectManager5E.hasEffectCondition(rSource, "Invisible") - which doesn't include the target at all. However, if we look at the ActorManager5E.getDefenseValue function, we can see that there are two places where the Invisible condition is checked for:


if EffectManager5E.hasEffect(rAttacker, "Invisible", rDefender, true) then
bADV = true;
end

And:


if EffectManager5E.hasEffect(rDefender, "Invisible", rAttacker) then
bDIS = true;
end

The first checks if the attacker is invisible to the defender - in which case the attacker has advantage on the attack. The second checks if the defender is invisible to the attacker - in which case the attacker has disadvantage on the attack.

Hope the above helps to point you in the right direction. As the DCC ruleset is in the vault I can't give direct examples for that ruleset.

Kelrugem
September 9th, 2021, 20:19
Did you setle that stuff?
How did you wrap the issue?
Just interested.

Leozelig asked Moon Wizard on the Discord to look at that, and Moon Wizard also suggested what I suggested above that leozelig could try to simply add the target information to the call of the DIEATK :) (in that case the target information is seemingly saved as rDefender, not as rTarget; so, a different label)

But I do not know whether Leozelig already tried that code :)

leozelig
September 14th, 2021, 16:30
Does anyone know where targetable effect modifiers are defined in the 5E ruleset code? I want to add a few custom modifiers for the DCC ruleset if that's possible.

Just a follow up to my question in case anyone runs into this. I ended up passing the target info to the EffectManagerDCC script, and that worked. It didn't work for damage because the targeting is set to "all" instead of "each" in the GameSystem script. Here is the code I changed in my ActionAttack script (added text in bold):


local nDiceChainMod, nDiceChainCount = EffectManagerDCC.getEffectsBonus(rSource, {"DIEATK"}, true, aAttackFilter, rTarget);


Kelrugem, you were exactly right. I thought I tried this already, but apparently not.

Cheers!
Leo

Kelrugem
September 14th, 2021, 18:45
Just a follow up to my question in case anyone runs into this. I ended up passing the target info to the EffectManagerDCC script, and that worked. It didn't work for damage because the targeting is set to "all" instead of "each" in the GameSystem script. Here is the code I changed in my ActionAttack script (added text in bold):


local nDiceChainMod, nDiceChainCount = EffectManagerDCC.getEffectsBonus(rSource, {"DIEATK"}, true, aAttackFilter, rTarget);


Kelrugem, you were exactly right. I thought I tried this already, but apparently not.

Cheers!
Leo

Nice :)