PDA

View Full Version : Not sure what aEffectVarMap["nInit"] is for / being used



Varsuuk
March 9th, 2020, 20:19
For ==>CoreRPG<==

I see the comparisons to trigger start and end effect callbacks but other than setting to "0" (the only value I ever see it as), it calling the START at the start of a round, I have no idea how it is used.

I have tried searching on "nInit" and "dbField" but not finding where it is set by name (vs through loop of k,v) - what does this portion of the effect on CT mean? The initiative roll (segment, if you will) when the effect TAKES place, TOOK place, etc?

How does it get set? Is there a field when modifying the effect for this?

===============

For ==> 2E <==

In this ruleset I see a field with tooltip "initiative to adjust on". That field can be hand edited (not sure if needs to for certain scenarios) and will be set to the value of the character's initiative roll + cast time (init mod on the spell) of the spell being cast if the player clicks on initiative roll button for the spell.


This seems to set a cool "casting ..." (and if I drag the effect target, it tells me "targeting ..." also) on the effects tab of char along with (c) and there is the "initiative to adjust on" set to == char's initiative value. Duration is always 1, so it poofs past that initiative point. Is that there just to be triggered if character takes damage before his turn?

So, I see how it "triggers" start when hits that point - but how does it trigger "end"? The effect poofs as soon as that segment hits so end never comes into play? Is this something that is a potential coding in CoreRPG just not used? How would it BE used with only a single "init" entry on the effect - I could not see how to add duration to the casting effect. I can imagine this might be used to click a button where a spell triggers an effect on you with 2 rounds duration on init segment 7, so it ticks down to 1 round on next rounds segment 7 or beyond and 0 on following segment 7. The thing is I cannot see how to create such a scenario?

>> Could anyone walk me through steps on creating the spell/effects/scenario to understand this?


>>> Have not yet searched through 2E forum to see where Celestian describes the spell effects functionality. I suspect he has such a page cos he writes up nice graphic filled examples, but unfortunately they have not been collected into a "manual" on the documentation for rulesets page yet. Probably cos it was all still in flux then.

Moon Wizard
March 9th, 2020, 21:52
aEffectVarMap is used to identify which fields should be included with effects when transferring between records and between clients. The "nInit" is the effect variable that determines when the nDuration should be decremented. The effect manager gets the nInit value from the "init" number field in the effect database record, which is what EffectManager.getEffect does is convert a database record into a effect record/table in memory. When an effect action is encoded into a "roll" for the ActionsManager, all the attributes are converted in a string EffectManager.encodeEffectAsText, which gets decoded in the roll resolution.

Regards,
JPG

Varsuuk
March 10th, 2020, 03:15
The first part I get with dbField and sSourceChangeSet mapping.

The thing I am asking, is how does that init field get set? I paused in writing this because I was testing in 2E. But I just put on a manual effect, cast a spell effect etc - but in all cases, a 0 appears in that field.

Could you give me any example of what to do, cast what spell, how to get something to appear in that field other than 0. Thats the part I do not understand how it is used. Apparently it is used to compare to trigger onStartEffect AND onEndEffect etc. I just am not getting what to do to test this. I put in all sorts of printfs to trace but can't seem to get the init magic to fill except when using 2E's cast with modifier button but that didn't work as I expect either.

Anyone with any example like Mage casts Blur and rolls initiative then ... etc?


I totally understand the fields. I mentioned that in my request. It is how it gets populated and triggered that I don't see. I also didn't notice anyone engaging the "end effect" callback (especially since it seems to be removed before that check in the onStart check.) but that is a gravy question.

Moon Wizard
March 10th, 2020, 17:59
It's set in the individual ruleset code; so I'll have to let Celestian answer for 2E.

JPG

celestian
March 10th, 2020, 18:53
It's set in the individual ruleset code; so I'll have to let Celestian answer for 2E.

JPG

I pointed him to an extension I wrote for 5e that I hope will explain what he needs. It https://www.fantasygrounds.com/forums/showthread.php?43430-5E-Change-Initiative-Update-Effects for when 5E players use the optional "roll initiative each round" rule.

celestian
March 10th, 2020, 18:54
It's set in the individual ruleset code; so I'll have to let Celestian answer for 2E.

JPG

I pointed him to an extension I wrote for 5e that I hope will explain what he needs. It will adjust the initiative value for an effect (https://www.fantasygrounds.com/forums/showthread.php?43430-5E-Change-Initiative-Update-Effects) for when 5E players use the optional "roll initiative each round" rule.