Skip to content

Blazing Inferno

AasimAasim Member Posts: 591
Cool spell, isn't it? :)
Anyhow, back on my first playthrough of SoD I've noticed that this spell doesn't affect creatures immune to fire.
No damage animation or (even worse) spell failure due to it, nothing; as if the spell didn't work at all. Now, in that run I was playing a Cavalier, he had 100% Fire res from his armor and a potion.
I also had Spell Revisions installed. SR makes some spells work similar to what happens with Inferno, but that only works for spells like Pro Fire; which make you immune to fire based spells.
But my Cavalier had no Pro Fire on himself, and SR couldn't take into account Blazing Inferno.
Hence I was curious; how does this spell work? In vanilla game, short of a baldur.bcs hack, I can't think of a way. So I found out it's a new opcode being used. A lot of SoD spells (like Shaman's Writhing Fog) work this way. If you're Cold immune (from any source), Writhing Fog is completely useless.
I tought, why not make all spells work this way?
So, I took my time, made a small mod that patches the new effect on all spells (well, not all - I didn't take all mod-added spells into account when making this - it's made on an EET spells list as a base). In effect, what this does is as shown below.
W/o this mod:



Poor Dragon Disciple, despite having 100% immunity to fire, still rolls a save and is suffering from damage animation. Why oh why? Even old ToBex had an option to make all casting succesfull on zero-damage instances. Unfortunately, this isn't possible in EE.

Hence, my mod does this:



Provided you're fire-immune, no damage animation, no spell failure, nada.

I took a Fireball as an example here, but it works for most of the in game spells - from Grease to Cone of Cold, from Confusion to Dragon's Breath.
There are some instances which aren't black or white (should Death Ward give immunity to Finger of Death's damage effect as well as instakill?) but I think I've got the most ground covered.
I've made this so it will work for both vanilla and Spell Revisions installs.
I'm willing to go an "extra mile" for SR concerning this opcode; but more on that later...I should have the mod ready to download tomorrow.
«1

Comments

  • The user and all related content has been deleted.
  • AasimAasim Member Posts: 591
    "an approximation" indeed.... :)
    Kind of.
    It's not complicated, it's just (it WAS :D ) a very time-consuming task.
    Look at the code example (I think this is Burning Hands vs fire-immunity):

    ACTION_IF FILE_EXISTS_IN_GAME ~spwi103.spl~ THEN BEGIN // fire immune
    COPY_EXISTING ~spwi103.spl~ ~override~
    LPF ADD_SPELL_EFFECT
    INT_VAR
    opcode = 324
    target = 2
    power = 0
    savingthrow = 0
    parameter1 = 0
    parameter2 = 3
    duration = 1
    timing = 0
    insert_point = 0
    STR_VAR
    resource = spwi103
    END
    END


    Now, I had to manually go through cca 2500 spells. Then it's just copy-paste the code, alter spell name at all three instances; but it's (WAS!) a huge ammount of work just going through spells.
    One can patch either 318 or 324 onto them, both work. I think the important part is that power of the effect is 0 (to bypass spell level immunity/protections).
    On a (bad) sidenote - even most of SoD spells don't work like this. :(
    Example; Dragon Fear. If you're fear immune, you shouldn't suffer from this spell's effects imo. Yet you do. You get a THAC0 penalty and whatever else is there even if you won't start panicking - I assume THAC0 penalty is there since you're *afraid*.
    Seeing this brings back not so fond memories of old Solaufein mod from Weimer - his Vampire Fear aura would indefinitely stack THAC0 penalty, even on fear-immune critters...
    Bleh - I'll include SoD spells as well then.
    As per Cat's Grace, no, I've just noticed Evasion opcode while browsing; so I was curious f this would work in BG. I can't get it to work as it should; but it's not important, I've got some rather bold ideas about making Evasion a bit more interesting and I don't even need the opcode to work at all for this crazy idea I have - I'll see if I can mingle something out in the next few days.
  • AasimAasim Member Posts: 591
    Btw, I'm positive you and I had a discussion on this - you asked me to exclude Rage spells; which I did. :) Kind of fits anyway. Berserker shouldn't be "immune to spwi401 (confusion)"; he should be immune to it's *effects*.
  • kjeronkjeron Member Posts: 2,368
    edited May 2017
    While the idea works, you shouldn't use that SPLPROT entry, it only checks if Fire Resistance is >100.
    The problem is that negative resistance occupies values 128-255. So you have also made anything weak towards fire immune to the spell.

    You need 3 SPLPROT entries:
    "rowA# 14 100 2" // Fire Resistance < 100
    "rowB# 14 128 4" // Fire Resistance >=128
    "rowC# 0x104 rowa# rowb#" // NOT (less than 100 or greater than 127).

    rowc is what you would use in opcode 324.
    Post edited by kjeron on
  • [Deleted User][Deleted User] Posts: 0
    edited May 2017
    The user and all related content has been deleted.
  • AasimAasim Member Posts: 591
    kjeron said:

    While the idea works, you shouldn't use that SPLPROT entry, it only checks if Fire Resistance is >100.
    The problem is that negative resistance occupies values 128-255. So you have also made anything weak towards fire immune to the spell.

    Hmm. So if a creature has negative fire resistance, it would get fireball immunity? Incredible...even more incredible since even SoD spells don't abide that - the effect I use is virtually a carbon copy of what Blazing Inferno/Withering Fog uses. Bleh.

    You're going to hate to hear this, but for basic wizard/priest (and even innates) spells it might be better to operate on spell.ids entries, rather than .spl files, so you can catch anything altered by mods using ADD_SPELL.
    Or maybe this is overkill...

    I'm not sure why I'd use ids entries here? I go on a spell-by-spell basis; if a mod decides to alter spwi304 which is a Fireball to an acidic-damage type attack, then yes, this won't work as it should. I cannot patch this ability to spells I have no idea how they function. I took vanilla spells as a base, then checked for SR changes and added spells (like Vitriolic Sphere/Icelance); and that was that. There isn't a single mod-added spell this changes.
  • AasimAasim Member Posts: 591
    kjeron said:


    "rowC# 104 rowa# rowb#" // NOT (less than 100 or greater than 127).

    rowc is what you would use in opcode 324.

    And this I would code how?
  • The user and all related content has been deleted.
  • AasimAasim Member Posts: 591
    @subtledoctor

    Tnx, I'll see what I can do about that - I haven't really looked at splprot.2da.
  • kjeronkjeron Member Posts: 2,368
    edited May 2017
    I initially posted an incorrect value in one of those columns, the last row should be "0x104" or "260", not "104".
    This will add the entries to SPLPROT and assign the necessary row# to a variable for each damage type:
    DEFINE_ACTION_FUNCTION	ADD_SPLPROT	INT_VAR	stat = 0	value = 0	relation = 0	RET	new_row		BEGIN
    	ACTION_IF	(stat > 278)	BEGIN	WARN	~SPLPROT.2DA - Stat out of Bounds.~	END
    	ACTION_IF	((stat != 259) AND (stat != 260) AND (relation > 11))	BEGIN	WARN	~SPLPROT.2DA - Relation out of Bounds.~	END
    	COPY_EXISTING ~SPLPROT.2DA~	~override~
    		COUNT_2DA_COLS	cols
    		COUNT_2DA_ROWS cols rows
    		TEXT_SPRINT check_row ~~
    		TEXT_SPRINT check_stat ~~
    		SET new_row = 0
    		FOR(current_row = 0; current_row < rows; ++current_row)	BEGIN	READ_2DA_ENTRY current_row 1 cols check_stat
    			PATCH_IF (~%check_stat%~ STRING_EQUAL ~%stat%~)	BEGIN	READ_2DA_ENTRY current_row 2 cols check_value
    				PATCH_IF (~%check_value%~ STRING_EQUAL ~%value%~)	BEGIN	READ_2DA_ENTRY current_row 3 cols check_relation
    					PATCH_IF (~%check_relation%~ STRING_EQUAL ~%relation%~)	BEGIN	new_row = current_row	current_row = rows	END
    				END
    			END
    		END
    		PATCH_IF (new_row = 0)	BEGIN
    			FOR(current_row = 0; current_row < rows; ++current_row)	BEGIN	READ_2DA_ENTRY current_row 1 cols check_stat
    				PATCH_IF (~%check_stat%~ STRING_EQUAL ~*~)	BEGIN	new_row = current_row	current_row = rows	END
    			END
    			PATCH_IF (new_row = 0)	BEGIN	new_row = rows	INSERT_2DA_ROW rows cols ~%new_row%		   %stat%		   %value%		   %relation%~
    			END	ELSE	BEGIN	SET_2DA_ENTRY new_row 1 cols ~%stat%~	SET_2DA_ENTRY new_row 2 cols ~%value%~	SET_2DA_ENTRY new_row 3 cols ~%relation%~	END
    		END
    	BUT_ONLY
    END
    //	Array of Restistance / Stat#
    ACTION_DEFINE_ASSOCIATIVE_ARRAY	DMG_ARRAY	BEGIN
    	~CRUSH~		=>	22
    	~ACID~		=>	17
    	~COLD~		=>	15
    	~ELEC~		=>	16
    	~FIRE~		=>	14
    	~PIERC~		=>	23
    	~POISN~		=>	74
    	~MAGIC~		=>	73
    	~MSSL~		=>	24
    	~SLASH~		=>	21
    	~MFIRE~		=>	19
    	~MCOLD~		=>	20
    END
    ACTION_PHP_EACH	DMG_ARRAY AS one => two	BEGIN
    	LAF	ADD_SPLPROT	INT_VAR	stat = two	value = 100	relation = 	2	RET	min = new_row	END
    	LAF	ADD_SPLPROT	INT_VAR	stat = two	value = 128	relation = 	4	RET	max = new_row	END
    	LAF	ADD_SPLPROT	INT_VAR	stat = 260	value = min	relation = 	max	RET	EVAL ~%one%~ = new_row	END
    END
    // Sets a variable, named after the string (CRUSH, ACID, COLD, etc..) to the row# to be used for opcode 324/318.  For each spell you would do something like this:
    	COPY_EXISTING	~spwi304.spl~	override		//Fireball
    		LPF	ADD_SPELL_EFFECT
    			INT_VAR
    				insert_point = 0
    				opcode = 324
    				target = 2
    				parameter2 = FIRE
    				duration = 1
    			STR_VAR
    				resource = EVAL ~%SOURCE_RES%~
    		END
    	BUT_ONLY IF_EXISTS
  • AasimAasim Member Posts: 591
    @kjeron

    Incredible. I'll need to redo all my work from scratch (well, bar the NI browsing for spells), but this is outstanding.
    I cannot thank you enough - I've just flash-tested this in practice and works like a Swiss clock. :)
    There may not be many negative resistances used in this game, but seeing a Fireball failing to affect Mummies was very dissapointing for me. I'll make good use of it.
  • AasimAasim Member Posts: 591
    A question - should True seeing or being blind protect one against attacks such as Sun Soulbeam, Sunray, Nature's Beauty and similar?
  • [Deleted User][Deleted User] Posts: 0
    edited May 2017
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • AstroBryGuyAstroBryGuy Member Posts: 3,437
    Aasim said:

    A question - should True seeing or being blind protect one against attacks such as Sun Soulbeam, Sunray, Nature's Beauty and similar?

    Sun Soulbeam/Sunray: No. Being blind doesn't make you immune to sunburn (the damage is from the energy of the sunbeam). And, they aren't illusionary, so True Seeing shouldn't help.

    Nature's Beauty: Yes, True Seeing or Blindness should protect against Nature's Beauty.

    I'd also allow True Seeing to protect against Spook (but not Blindness, Spook could manifest as an auditory illusion as well and affect a blind opponent).

  • AasimAasim Member Posts: 591
    Fair points @AstroBryGuy . Spook is already thwarted by TS with SR I think.
  • AasimAasim Member Posts: 591
    Ok, I think I've got this 99% done; at least non-SR version.
    SR version will take a bit more time (I hope to finish the core conversion tomorrow, then move to more advanced stuff) - while it's 80% copy-paste; there are some spells which must be handled with care since SR changes the core mechanics of some spells like Flame Arrow, Chain Lighting etc.
    SR version will have a few (optional) extras; such as True Seeing working much more efficiently vs illusions and similar (it should be renamed into SI:Illusion anyway); more on that when I get to work on it. For now, let's just say that my plan is to include some rather daring changes in the way saving throw system is handled in this game (if you're *held* and cannot move (or dodge an attack), how can you *dodge* a Fireball? :) ) - if you're unable to move all evocations (and some other spells like Disintegrate) that allow a save will not allow it anymore. >:)
    Likewise, creature stats will have a bigger effect on chances of a succesfull save, even on outright avoiding the spell and all it's effects.
    Coding this should be relatively easy, but I need to decide on the numbers.
    The best part is - it won't touch any of the creatures in the game, but it will affect all of them; and automatically take into account the stats they have at the moment spell hits them.
    This means that if you lower someone's DEX, he'll automatically be more vulnerable to evocations. Take away someone's WIS, he'll be confused more easilly.
    With 318/324 I can fine-tune this for each spell individually (it will be a %-based chance); a snail-pace moving Vitriolic Sphere will be a bit easier to dodge; a chain lighting that travels quickly won't. This won't affect all spells, I cannot tie all spells with base stats (i.e. Slow; Wail of the Banshee and similar; some imo shouldn't be avoidable at all)
    It will be a lot of work, in any case, so I don't expect this to be done for a week-two or so. And I'll definitely need to test this in practice.

    One thing I still need to do, concerning items/spells in the game. I'll patch STAT effect where applicable. e.g. Cavalier with his natural Fear immunity will have outright immunity to all Fear spells and their side-effects, not just the "fear" and "panick" effect.
    He won't suffer from negative THAC0 or anything else that comes with spells that cause Fear. Likewise, if you're holding Dragonslayer, or are under Pro Fear spell from your cleric, one will have the same benefits, so forget about that nonsensical "drop items armor in panick" stuff. This is doable in few code lines for each effect, so V1 should be out later today/tomorrow.
  • AasimAasim Member Posts: 591
    Toughts:
    - in SR, Chromatic orb universally does magic damage; and has some side-effects. Should magic damage immunity fully stop it?
    - Spike Growth spell is added by SR to druids (kind of entangling, damaging vines). Should Free action block it fully or only the entangling effect? I'd vote for full stop...
  • AasimAasim Member Posts: 591
    Aasim said:

    if you're unable to move all evocations (and some other spells like Disintegrate) that allow a save will not allow it anymore. >:)

    Heh. Turns out, you cannot bypass some limitations. Any item bonuses (probably spell bonuses) to saving throws still apply, like Ring +1, Inertial Barrier etc. Saving throw bonus (or penalty) is seems capped at -20, but bonuses override this. I'll use a workaround with a negative save vs school bonus added, which appears to bypass this limitation completely (probably not the bonuses vs invocations...but those are far rarer than save vs breath bonus items and spells).

  • AasimAasim Member Posts: 591
    edited June 2017
    Ok, I've got this kinda ready to go. Not all is finished, but the "core" component is. However, I've ran into a problem I cannot solve.
    When I run the regexp patch code to set SPLSTATE on fear & poison immunity for spl and itm files, game won't run anymore. I cannot start or load a game. Any ideas what is worng with it? I've checked the files with NI, all is fine, yet game crashes when I click on "new game". Unistalling the mod fixes everything back.
    Code example

    COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
    PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    LPF CLONE_EFFECT
    INT_VAR
    match_opcode = 101
    match_parameter2 = 24
    opcode = 357
    parameter2 = 106
    silent = 1
    END END
    BUT_ONLY_IF_IT_CHANGES

    Link to download.

    P.S.
    If I edit out the *.itm regexp part of code, it works fine for .spl regexp.... :/
  • kjeronkjeron Member Posts: 2,368
    Aasim said:

    Ok, I've got this kinda ready to go. Not all is finished, but the "core" component is. However, I've ran into a problem I cannot solve.
    When I run the regexp patch code to set SPLSTATE on fear & poison immunity for spl and itm files, game won't run anymore. I cannot start or load a game. Any ideas what is worng with it? I've checked the files with NI, all is fine, yet game crashes when I click on "new game". Unistalling the mod fixes everything back.
    Code example

    COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
    PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
    LPF CLONE_EFFECT
    INT_VAR
    match_opcode = 101
    match_parameter2 = 24
    opcode = 357
    parameter2 = 106
    silent = 1
    END END
    BUT_ONLY_IF_IT_CHANGES

    Opcode 357 is Set STATE (from STATES.IDS) - PSTEE only.
    Opcode 328 is Set SpellState (from SPLSTATE.IDS) - usable in any current EE. This is what you want.
  • AasimAasim Member Posts: 591
    Omg. Where's that facepalm smiley when you need it....tnx again.
  • AasimAasim Member Posts: 591
    edited June 2017
    Ok...I got into trouble again since even if state was being patched correctly, it wouldn't work...needed to set "special" field to IWD2 mode. But now it's working exactly as I want. :)




    Barbarian rage will protect vs Symbol:Fear provided that it has immunity to panick opcode, ditto Blackrazor.
    If they're modded not to give this immunity, they won't protect vs this spell.
    This part will be unrelated to mods installed beforehand, given it's regexp patching nature.
    I've also noticed I missed a few effects with 324 opcode, so I'll need to add this to the code...while it would be far easier to regexp all "panic" instances in the game, this would lead to many issues since some spells panick you and have additional effects that shouldn't be stopped by fear immunity. Ditto posion etc.
    Will re-upload later tonight or tomorrow, depending on time available. Also, this mod will standardize poison immunity - being poison-immune will outright prevent any posion-type damage. (Periapt of pro poison in this example)





  • The user and all related content has been deleted.
  • AasimAasim Member Posts: 591
    I know. Nothing is perfect, but - if you want to mod Rage to include such stuff then you'd have to go on a spell-by-spell basis; giving it Pro Spell vs a gazzilion spells rather than Pro Opcode currently used.
    I've done that for IR's Greenstone amulet and believe me, it's no fun at all. And, it doesn't cover mod-added stuff. Even more so - it adds more confusion to the mix. When you get to the point where you have to decide if Rage should protect vs Charm, Dire Charm, Domination, Sirene charm, Succubus charm, Demogorgon charm, eyrines charm, Vampire charm, Beholder charm, Mental domination from clerics, SR's Druid charm animal or human etc you'll see the problem. Count in charms cast from items as well. When you're done with that add mod-added charms. B)
    Hell, should Rage make you immune to Hallucinatory spores from Myconids? Hardly so, yet it does.
    Let alone writing a decent description for such an ability. And no, reading a spell level via code and saying "rage protects vs charms of level 4 and lower" won't help either since these innates are a total mess - ranging from wrongly assigned sectypes/schools to what seem to be provisionary power levels.
    Just try to remove Succubi charm via SR's Break Enchantment and you'll see what I mean.
    I've fixed this in a SR fixpack, I'll include it in main SR code when I get the time.
    In addition, SCS and aTweaks consider Rage to be a no-go for charm effects, so it doesn't matter if Rage doesn't give charm immunity- you won't be targeted anyway.
    If you exclude Rage from giving Fear immunity Symbol fear would still affect the character after this is installed, it clones immunity to panick effect. I see potential problems with damage spells that other mods add - but this can't be fixed easilly. I've had much problems accounting for SR's "AoE Deflection" tweak, which suffers from the same fate - spells must be added manually to the code. :(
    There are tons of spells (even in a completely unmodded game) that I still don't know if I should include or not. Not every spell is "black and white" like a Charm person- Demogorgon's Insanity gaze not only confuses you, but gives saves penalty etc. Should Chaotic Commands keep you completey safe from it or just the confusion/feeblemind effects tied to the spell?
    That's one of the reasons I can't do this via a simple regexp that would be kinda bullet-proof, but rather going through spells with NI and deciding on a spell-by-spell basis.
    I've made this regexp mistake with SR's Haste/Slow - regexp patched Holy word with "slow" sectype since it found slow opcode - you could counter all of the Holy words effects (deafness, stun etc.) via Haste. :)
    My plan was to do a megamod install, go through all spells, add them to the code where applicable and have this installed last.
    Unfortunately, I've lost virtually all interest in doing so after the unfortunate incident with Energy-draining Talos knights. It's just not worth the effort imo.

    Overall, don't worry. If I'm in doubt, I don't change anything. And I haven't touched rages none, or used rage state as a no-go for any spell in the game. :)
    In several BG1/SoD runs I've ran with the code I use all seemed to work fine; bar one thing - on few Duralg tower traps, message displayed would be "Unaffected by effects from"; probably since the spell cast from trap doesn't have a name.
    Benefits one will get from installing this (undead completely unaffected by ice even w/o eff targeting , SR's Deflections preforming better in every-single-way-imaginable in pre-EE era, no zero damage spell disruption from spells etc. - and I haven't included half the stuff I'm planning to do here) imo far outweight the few "grey" instances where I followed my gut reason, which probably not everyone would agree with.
  • The user and all related content has been deleted.
  • The user and all related content has been deleted.
  • AasimAasim Member Posts: 591

    Aasim said:

    Benefits one will get from installing this (undead completely unaffected by ice even w/o eff targeting ,

    Does that mean undead are immune to being Slowed by SR Ice Storm? :open_mouth: or just damage?
    Undead, provided they're immune to cold (they should be, I'm farily sure skeletons are) are immune to all Ice Storm effects.. I'm kind of thinking that the slowing effect comes from the ice itself, rather than being a seperate effect. Ditto Icelance's holding effect. If you're ice-immune, the spell doesn't affect you at all.
    If you're not using some mod like aTweaks/SR this will also make sure that your summons don't turn on you if you hit them with a spell they're 100% resistant to (ie Fire Elemenatals can stay in the mid of a Firestorm and Inc.cloud. This is already included in SR to an extent, but it only works with limitations - Pro Fire spell(s) give(s) spell immunity to fire spells; with a bad side-effect that even if your Fire res get lowered you're still immune to fire-based spells. With this, SR's tweaks are redundant. On a "fix-cheese" side, this means that you can no longer heal yourself with resistances above 100%. :)

    I would try to do this procedurally. Loop through spells' abilities and effects; when you find matching effects (fire damage or whatever) and targeting (target point on the ground) then add the spell to an array; then, go through the array and use ADD_SPELL_EFFECT to block/edit what needs to be blocked/edited.

    Not all spells can be added. If a spell has 7 letters, using it in the code will result in spell re-casting itself until the game crashes. :(
    The code is in spell_rev/components/nwn_deflection, if you can improve it, that'd be great - frankly, while I can understand what @Ardanis code does, I'd rather not mess with it more than I already have. Likewise, if you want to use this in your mod (given it goes after SR) I doubt he would have any objections.
  • AasimAasim Member Posts: 591


    Which brings up another idea: should Free action get this same treatment? It says it negates all spells that hinder movement, so shouldn't it protect from the offensive teleportation spells? Meaning Teleport Field, Maze, and Imprison, plus Otiluke's Sphere traps and maze traps.

    That would break non-SCS demiliches... but let's be honest, non-SCS demiliches were already broken.

    FA is included in the code, I only need to add regexp for items/creatures. Maze and IImprison imo shouldn't be countered by FA (nor Otiluke). Demi had an idea about Dimensional Anchor - I don't know if he'd link this effect to a spell or make a new one. Be that as it may, Imprison is no longer an instakill unless you're soloing so I'm kinda fine with it as it is.
  • AasimAasim Member Posts: 591
    edited June 2017

    Do not use this with new Spell Revisions beta, a revised version is already used there. As per order of install, before SCS, after item mods.
    Let me know if I messed up something. And don't use unless you're playing EE games. I don't play IWD so the spells there aren't accounted for, if I ever get to play it (hardly) I might do something about it.

    Thanx to kjeron for code to avoid neg.resistance issues and debugging; tnx to subtledoctor & AstroBryGuy for tips and suggestions. Have fun!


    Download.
    Post edited by Aasim on
  • AasimAasim Member Posts: 591
    Updated with a quickfix for certain priest fire spells not working.
Sign In or Register to comment.