PDA

View Full Version : Can Effects Expire at the End of a Turn Instead of the Beginning?



leozelig
September 5th, 2021, 22:40
Hey all,

Quick question for the wizard conclave... Is there a way for an effect to expire at the end of a PC's turn instead of the beginning? I'm working on the DCC ruleset which is based closely on 5E. A DCC spell often gives you a bonus that lasts for 1 round, but the effect expires before it can be applied. For example, the PC casts a spell in round 1 that grants a +1 attack bonus for 1 round, meaning they get the bonus in round 2. If I apply the effect 'ATK: 1' with duration = 1, the effect expires at the beginning of the PC's turn in round 2 and is never applied.

Maybe I'm missing something obvious. If not, is there a script I can modify to make effects expire at the end of the turn instead of the beginning? I have been setting duration to 2, but that's confusing to players when the spell description says it lasts 1 round. It's not a fatal issue, but just curious.

Bonus question: I'm also trying to figure out where the 5E ruleset defines the modifiers that work with effect targeting. I have some custom modifiers in DCC that are not being recognized by IFT conditions, and I suspect this is the issue.

Thanks!

Zacchaeus
September 5th, 2021, 23:42
You need to change the ends on initiate box on the CT so that it comes just after the initiative it was cast on. So if it was cast at initiative 10 then change the number to 9.9 (or any number that comes next in the initiative order). It doesn’t work automatically without extensions.

leozelig
September 6th, 2021, 01:57
You need to change the ends on initiate box on the CT so that it comes just after the initiative it was cast on. So if it was cast at initiative 10 then change the number to 9.9 (or any number that comes next in the initiative order). It doesn’t work automatically without extensions.

Ok sounds good, thanks Z. If anyone else knows another way, let me know…

Moon Wizard
September 6th, 2021, 20:28
Any other mechanism requires changes to the Effects processing. D&D 4E actually has coding for expiring at end of turn or end of next turn.

Regards,
JPG

leozelig
September 6th, 2021, 21:28
Thank you, Moon - I will definitely be looking at that.

leozelig
September 14th, 2021, 16:44
This is how I solved my issue. Effects now expire at the end of the turn instead of the beginning, which is as it should be for DCC. I added a few things to the EffectManagerDCC script, which is almost identical to EffectManager5E.

I added these two lines to the onInit() function:

EffectManager.setCustomOnEffectStartTurn(onEffectS tartTurn);
EffectManager.setCustomOnEffectEndTurn(onEffectEnd Turn);

That registers the custom functions onEffectStartTurn and onEffectEndTurn, which look like this...

function onEffectStartTurn(nodeActor, nodeEffect, nCurrentInit, nNewInit)
local nDuration = DB.getValue(nodeEffect, "duration", 0);
if nDuration > 0 then
nDuration = nDuration - 1;
DB.setValue(nodeEffect, "duration", "number", nDuration);
DB.setValue(nodeEffect, "expire", "string", "end");
end
end

The "expire" value allows the ruleset to distinguish between an effect that never had a duration and one that is set to expire.

function onEffectEndTurn(nodeActor, nodeEffect, nCurrentInit, nNewInit)
local nDuration = DB.getValue(nodeEffect, "duration", 0);
local sExpire = DB.getValue(nodeEffect, "expire", "");
if nDuration <= 0 and sExpire == "end" then
EffectManager.expireEffect(nodeActor, nodeEffect, 0);
return;
end
end

Both functions are necessary to prevent effects from expiring at the beginning of the turn.

Cheers,
Leo