kjeron Posted April 30, 2022 Posted April 30, 2022 45 minutes ago, DavidW said: If this is for FPEE, you don’t need to bother with the EVAL anyway: we’re using AUTO_EVAL_STRINGS. It was code I already had, I've been ripping unrelated bits of code out (while trying not to break it). I don't use AUTO_EVAL_STRINGS, it's poorly documented, not universal, and doesn't eliminate EVAL entirely. Only some variables are affected by it, and only for a single level of EVAL. Just now, Luke said: Excluding the fact that op206's feedback string is bugged as of now, String #26011 is "There was leather hide found, and tannin was smelled on the killer!". Guess you meant some other strref...? I never got around to looking up/making the correct string since it wasn't working. Just now, Luke said: PATCH_IF $x(4) = 3 BEGIN (when iterating over array "slayer") I mean, that's certainly true since it is preceded by "PATCH_IF $x(4) != 3 BEGIN", so I'm not sure about the intent here... PATCH_IF !IS_AN_INT $x(2) BEGIN (~alter_poly_item~) This should probably be skipped when you're iterating over array ~slayer~, shouldn't it? Otherwise you'll grant protection against non-existing resources... Just more sloppy code removal. The first became redundant, the second should skip. Quote
DavidW Posted April 30, 2022 Posted April 30, 2022 5 hours ago, kjeron said: Only reason for a variable to be in the function definition is if you need it to have a default value. Strong disagree. Encapsulation isn't everything, but it's a huge advantage for avoiding and catching bugs. Quote
Luke Posted May 2, 2022 Posted May 2, 2022 On 4/30/2022 at 7:24 PM, kjeron said: I never got around to looking up/making the correct string since it wasn't working. Fair enough. I'm defaulting to one of the two values that actually works, i.e. 0xF00080 (Unaffected by effects from <RESOURCE>). Having said that, I'm not sure why the `duration` field is set to 180... Is this correct...? @kjeron OK, some final comments / questions (before committing): [bg2ee] Cloak of the Sewers, Mustard Jelly form: should not share the same ITM resref as WIZARD_POLYMORPH_MUSTARD_JELLY. I made a clone of "plyjelly.itm" [sod] SHAPECHANGE_MIND_FLAYER: should not use "mindflay.itm" (since that is used by enemy/NPC Mind Flayers) I made a clone of "mindflay.itm" ("cdmindfl.itm") [bgee] WILD_SURGE_POLYMORPH_SPIRIT_WOLF: should not share the same ITM resref as WIZARD_POLYMORPH_WOLF. I made a clone of "cdwolfm.itm" ("wswolf.itm") Slayer Change / IWDEE Druid Shapeshift Heal: shouldn't this healing be applied by opcode #18 (p2=0 | update both current and max HP) in the ITM file (as equipped effect)...? In so doing, it can act as temporary bonus hit points if the caster is already at full health... I must admit it is still not clear to me the following block Spoiler COPY_EXISTING_REGEXP ~^.+\.\(spl\|itm\)$~ override PATCH_IF !VARIABLE_IS_SET $POLYFORM_abort(~%SOURCE_RES%~) BEGIN LPF CLONE_EFFECT INT_VAR silent = 1 match_opcode = 111 opcode = 326 parameter2 = $splprot(~POLYMORPH=1~) timing = 0 duration = 0 STR_VAR resource = ~SPINHUMW~ END END BUT_ONLY END Assuming it's only relevant when a contingency (since op135 automatically disables arcane / divine spell casting) with, say, Phantom Blade triggers while you're polymorphed (under the effects of op135, p2=0): SPINHUMW.SPL op318 => this is supposed to block EFF file "*PINHUMW.EFF". However, it will never be able to block it since the following op326 effect (which applies a SPL file that in turn applies the EFF file "*PINHUMW.EFF") is not delayed (timing=4, duration=0). op326 (no filter) => applies SPL file "SPINHUMR". SPINHUMR.SPL op177 => "SPINHUMW.EFF" (revert to natural form and remove magically created weapon – you should be immune to it but that's not actually the case...) op177 => "SPINHUMS.EFF" (remove Slayer Change delayed damage) op215 => visual effects To sum up: is it supposed to block the Slayer Change delayed damage and cancel the current polymorph ability (including the Slayer)...? But then why is it supposed to block "SPINHUMW.EFF"...? I fear I'm missing something here... Quote
kjeron Posted May 2, 2022 Posted May 2, 2022 2 hours ago, Luke said: Having said that, I'm not sure why the `duration` field is set to 180... Is this correct...? SPIN823 normally gives SPIN822 back after a 180s delay. This way SPIN822 is blocked for 180s rather than removed and given back later, as it seems like that process got interrupted on occasion (people complaining about permanently losing the ability). 2 hours ago, Luke said: OK, some final comments / questions (before committing): [bg2ee] Cloak of the Sewers, Mustard Jelly form [sod] SHAPECHANGE_MIND_FLAYER [bgee] WILD_SURGE_POLYMORPH_SPIRIT_WOLF No arguments. 2 hours ago, Luke said: Slayer Change / IWDEE Druid Shapeshift Heal: shouldn't this healing be applied by opcode #18 (p2=0 | update both current and max HP) in the ITM file (as equipped effect)...? In so doing, it can act as temporary bonus hit points if the caster is already at full health... As an equipped effect that would heal them every time you load the game with it active. 2 hours ago, Luke said: I must admit it is still not clear to me the following block Reveal hidden contents COPY_EXISTING_REGEXP ~^.+\.\(spl\|itm\)$~ override PATCH_IF !VARIABLE_IS_SET $POLYFORM_abort(~%SOURCE_RES%~) BEGIN LPF CLONE_EFFECT INT_VAR silent = 1 match_opcode = 111 opcode = 326 parameter2 = $splprot(~POLYMORPH=1~) timing = 0 duration = 0 STR_VAR resource = ~SPINHUMW~ END END BUT_ONLY END It patches all non-polymorph spells/items (Flame Blade, MMM, Shillelagh, etc...) that use opcode 111, to ensure things like Slayer damage get removed. 2 hours ago, Luke said: Assuming it's only relevant when a contingency (since op135 automatically disables arcane / divine spell casting) with, say, Phantom Blade triggers while you're polymorphed (under the effects of op135, p2=0): Contingency, Sequencer, or Item activation, yes. Non-polymorph Weapon-Creation spells cast SPINHUMW, which casts SPINHUMR while blocking it's first EFF (op135), but not the rest. It has to block the op135 EFF, because otherwise op135 would remove the Magical Weapon that is being created by the spell. If this wasn't working, your new Magical Weapon would disappear immediately. The new magical weapon will terminate the polymorph on it's own, as it replaces the polymorph weapon. Slayer Change (SPIN823) casts SPINHUMS, which casts SPINHUMR while blocking it's second EFF (op312->SPIN823), as again it would remove all the effects of SPIN823 that are about to be applied. SPIN823 has it's own leading op321 to prevent stacking itself. Quote
Luke Posted May 3, 2022 Posted May 3, 2022 21 hours ago, kjeron said: SPIN823 normally gives SPIN822 back after a 180s delay. This way SPIN822 is blocked for 180s rather than removed and given back later, as it seems like that process got interrupted on occasion (people complaining about permanently losing the ability). I see, good to know. 21 hours ago, kjeron said: As an equipped effect that would heal them every time you load the game with it active. Yes, it can be exploited to heal yourself. Better to put an op17 effect in the SPL and an op18 (p2=3|Increment, don't update current HP) effect in the ITM. 21 hours ago, kjeron said: Non-polymorph Weapon-Creation spells cast SPINHUMW, which casts SPINHUMR while blocking it's first EFF (op135), but not the rest. 21 hours ago, kjeron said: Slayer Change (SPIN823) casts SPINHUMS, which casts SPINHUMR while blocking it's second EFF (op312->SPIN823) Here is the magic part. I thought it would not work as intended because that op318 has a duration of 0, and the EFF it is meant to block is not in the current effect stack (since it is applied by the SPL file cast by op326). I mean, it reminds me of the current implementation of "Vitriolic Sphere", where the main SPL file ("spwi432") is supposed to block the splash damage ("spwi432y", cast by op326) for the initial target. In this case the op318 effect targeting "spwi432y" has a very short duration (timing=10, duration=2)... I'm not sure if `duration=0` would work the same or not... Just wanted to know whether the two scenarios are comparable or not... Quote
Dan_P Posted May 3, 2022 Posted May 3, 2022 6 hours ago, Luke said: Yes, it can be exploited to heal yourself. Better to put an op17 effect in the SPL and an op18 (p2=3|Increment, don't update current HP) effect in the ITM. Just adding a note, since you mentioned IWD for this. IWDEE should not get op18. It's supposed to be just normal healing and that's how it's written in the descriptions as well. Quote
DavidW Posted May 5, 2022 Posted May 5, 2022 On 4/30/2022 at 1:24 PM, kjeron said: I don't use AUTO_EVAL_STRINGS, it's poorly documented, not universal, and doesn't eliminate EVAL entirely. Only some variables are affected by it, and only for a single level of EVAL. All true. But it makes function-heavy code massively easier to write. Quote
Luke Posted May 6, 2022 Posted May 6, 2022 On 5/4/2022 at 1:31 AM, Dan_P said: Just adding a note, since you mentioned IWD for this. IWDEE should not get op18. It's supposed to be just normal healing and that's how it's written in the descriptions as well. Yeah, you're right. Having extra temporary HP while polymorphed would be cool IMHO, but that's not developer intent... Quote
Luke Posted May 6, 2022 Posted May 6, 2022 (edited) @kjeron Committed. Spoiler I made the following changes / additions: Added missing ~%CLERIC_ELEMENTAL_TRANSFORMATION_FIRE%~ and ~%CLERIC_ELEMENTAL_TRANSFORMATION_EARTH%~ As far as "When the Druid returns to human form, <PRO_HESHE> is also healed 3d10 Hit Points." is concerned, I used the usual 'op318 + EFF' trick, i.e.: Before casting ""SPINHUMR.SPL", "SPINHUM.SPL" (universal Natural Form) casts another subspell (I called it "SPINHUME.SPL") "SPINHUME.SPL" has a leading op177 effect ("SPINHUME.EFF" => op318, resource="SPINHUME", parent_resource="*PINHUME") protecting the caster from healing "DRUFIR.ITM" and "DRUEAR.ITM" grant the caster protection from that EFF (op318, timing=2, resource="*PINHUME"), so that he can be healed 3d10 HP when returning to its natural form. Edited visual / audio effects so as to match BG / IWD style (depending on the current game). ~%WIZARD_POLYMORPH_SELF%~, ~%WIZARD_SHAPECHANGE%~ I'm not sure why you put a leading op321 effect here... I mean, you can't really prevent self stacking because op171 does not leave behind a removable effect... As a result, I recreated vanilla behavior, i.e.: I added two op206 effects granting protection to ~%SOURCE_RES%~ and ~%WIZARD_SHAPECHANGE%~ / ~%WIZARD_POLYMORPH_SELF%~ respectively (so that you can't use them together and cannot cast the same spell until when the current casting runs out) As far as instantaneous effects (op171, op172, op146, op321, op326) are concerned, I opted for `timing=1, duration=0` instead of `timing=0, duration=0` No particular reason, just a personal preference... Slightly edited subspells naming scheme. When iterating over Hostile / Limited polymorphs, I skipped subspell if permanent duration (f.i. "Bolt of Polymorphing", "Wand of Polymorphing", etc...) That is, I put `op111, timing=4, duration=0` instead of `op146, timing=4, duration=0` (with the subspell applying `op111, timing=1, duration=0`) Edited May 6, 2022 by Luke Quote
Trouveur80 Posted May 12, 2022 Posted May 12, 2022 I'm not a modder, but from a user point of view, it would be great to have the same behavior for unmodded shape-shifting and for the ones add by mods, like the druid ones from IWDification. Quote
Luke Posted May 12, 2022 Posted May 12, 2022 1 hour ago, Trouveur80 said: I'm not a modder, but from a user point of view, it would be great to have the same behavior for unmodded shape-shifting and for the ones add by mods, like the druid ones from IWDification. Sure, the other mods will need to adapt to the new system... Quote
subtledoctor Posted May 12, 2022 Posted May 12, 2022 1 hour ago, Luke said: Sure, the other mods will need to adapt to the new system... This thread is a bit long and I can't casually follow all the code snippets to fully understand things. Like, all my mods use different "Natural Form" abilities for different categories of shapeshifting (druid innates, psionic metamorphosis, HLAs, etc.) If the FP standardizes the vanilla resources in a way we could glom onto so that all different kinds of shapeshifting would work interchangeably and reliably, that would be great. Glancing at the commit, I see this does not roll up all the "Natural Form" abilities into a single spell that works with various abilities. Can you describe in plain English what this new system is and how to adapt to it? Or, at any rate, could there be such a description written up once the FP is released? Quote
Luke Posted May 12, 2022 Posted May 12, 2022 34 minutes ago, subtledoctor said: Can you describe in plain English what this new system is and how to adapt to it? Will do tomorrow (mod-added spells such as an hypothetical custom version of Phantom Blade will need to be slightly edited as well...) Quote
Luke Posted May 13, 2022 Posted May 13, 2022 (edited) On 5/12/2022 at 6:01 PM, subtledoctor said: Like, all my mods use different "Natural Form" abilities for different categories of shapeshifting (druid innates, psionic metamorphosis, HLAs, etc.) So, the key points are the following ones: Spoiler Unlimited / self polymorphs (templates: Shapeshift: Sword Spider, Shapeshift: Wolf, Polymorph Other, etc...) They only need to apply 2 effects (excluding cosmetic effects): the first one is op146 to cast a subspell (namely "SPINHUMR") this subspell will cancel any previous polymorph and the Slayer Change delayed damage (you know, the "You feel your control slipping..." damage...) the second one is op111 to give your character the specified "claw" weapon Important: this effect needs to be coded as such: timing=4, duration=0 (Instantaneous delay) this is needed to bypass a bug with op135 (namely: when you shapechange between two different non-natural forms, all your equipment will be considered as "unequipped" – in particular, you will lose passive bonuses/maluses granted by your Rings, Amulet, Helmet and the like. Might be annoying with undroppable items such as Nalia's Ring or Edwin's Amulet...) Limited polymorphs (templates: Cloak of the Sewers, Fire / Earth Elemental Transformation, etc...) They only need to apply 2 effects (excluding cosmetic effects): the first one is op146 to cast a subspell (namely "SPINHUMR") this subspell will cancel any previous polymorph and the Slayer Change delayed damage (you know, the "You feel your control slipping..." damage...) the second one is another op146 to cast a second subspell (name it as you want) Important: this effect needs to be coded as such: timing=4, duration=0 (Instantaneous delay) this is needed to bypass a bug with op135 (namely: when you shapechange between two different non-natural forms, all your equipment will be considered as "unequipped" – in particular, you will lose passive bonuses/maluses granted by your Rings, Amulet, Helmet and the like. Might be annoying with undroppable items such as Nalia's Ring or Edwin's Amulet...) this second subspell will apply op111 (timing=0, duration = whatever you want) to give your character the specified "claw" weapon Poly "claw" weapon op135, timing=2, p2=0 (Change into), res = a CRE file of your choice – Animation, Strength, Dexterity, Resistances (excluding Poison and Magic Damage), Base AC, Specific AC (Crushing/Slashing/Piercing/Missile), and Base APR will be inherited from this CRE file note: no need to apply op145 (Disable spellcasting) / op60 (Casting Failure) – op135, p2=0 will automatically do that for you op335, timing=2, p1=IDS_OF_SYMBOL ("SPLSTATE" "NATURAL_FORM_ABILITY"), p2="-1", res="SPINHUM", special="-1" this effect will grant you "SPINHUM.SPL" (universal Natural Form ability) as soon as you equip the "claw" weapon... "SPINHUM.SPL" will automatically remove itself from your character's memory upon returning to your natural form (or character's death...) Of course, if this is a hostile polymorph (such as Wand of Polymorphing – see "squirp.itm"), then you might want to skip this effect... op335, timing=2, p1=IDS_OF_SYMBOL ("SPLSTATE" "POLYMORPH_TEMPORARY_ABILITY"), p2="-1", res = <some special ability unique to this particular form>, special="-1" (Optional) template: Shapechange: Mind Flayer this effect will grant you some special ability unique to this particular form as soon as you equip the "claw" weapon... this special ability will automatically remove itself from your character's memory upon returning to your natural form (or character's death / changing into another form...) this particular SPL file should apply op172 / op171 as casting feature effects (i.e., it should be castable at will) template: Psionic Blast ("spin974.spl") op144, timing=2, p2=7 (Disable Talk Button) Any other (global) effect you wish Custom magically created weapons (templates: Chill Touch, Melf's Minute Meteors, etc...) they need to apply an op326 effect (condition: STAT POLYMORPHED = 1, res="SPINHUMW") right before op111 "SPINHUMW.SPL" will basically cancel the Slayer Change delayed damage (you know, the "You feel your control slipping..." damage...) if any Since op135, p2=0 automatically disable arcane/divine spell casting, this is only relevant when casting from scrolls / activating a sequencer / contingency while being polymorphed That's it (as you can see, 2 splstates are needed.. but it is certainly worth it IMHO!) If you're looking for custom Polymorph Self / Shapechange spells (i.e. "for the duration of the spell, the caster can transform into any of the new forms at any time and as many times as <PRO_HESHE> wishes."), then there's something more to know (let me know if you need these details as well...) Edited May 13, 2022 by Luke Quote
subtledoctor Posted May 13, 2022 Posted May 13, 2022 So every shapechange and polymorph form use SPINHUM.spl to go back to natural form? What does that one look like? Does it specifically handle every shapechange ability (so I would need to add 321 effects or something) or does it just zero everything out? 1 hour ago, Luke said: needed to bypass a bug with op135 Eh, I've been using op53 lately anyway, attached to the claw/weapon to set the animation. And then whatever stats would normally be controlled by a .CRE resource, I just set manually. A bit more work but more reliable... Quote
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.