// ---------------------------------------------------------------------------- // Name: Spell Refresh Mod // Author: igi & The Imp // Date: 13/09/2011 klo 23:25 // Version: to be v7 // ---------------------------------------------------------------------------- BACKUP ~iiSpellSystemAdjustments/backup~ AUTHOR ~Jarno Mikkola ~ README ~iiSpellSystemAdjustments/Readme.txt~ VERSION ~v7 beta 1~ LANGUAGE ~English~ ~English~ ~iiSpellSystemAdjustments/Languages/English/setup.tra~ LANGUAGE ~Spanish (Translation by Immortality)~ ~Spanish~ ~iiSpellSystemAdjustments/Languages/Spanish/setup.tra~ /////////////////////////////////////////////////////////////////////////////// /////////////////////////////// Mage Spells /////////////////////////////// /////////////////////////////////////////////////////////////////////////////// BEGIN ~Arcane Spell Refreshment~ PRINT ~Which type of function would you like the timer to be for the arcane spells ? 1) One timer for all levels 2) Timers depends linearly from the spell level 3) Timers depends exponentially from the spell level 4) Timers is randomized~ PRINT ~So in: 1) timer = constant 2) timer = constant + spell level * level variable 3) timer = constant + spell level ^ (exponent/root) 4) timer = ???~ ACTION_READLN function OUTER_WHILE !(IS_AN_INT %function%) || (%function% > 4) || (%function% < 1) BEGIN PRINT ~Which type of function would you like the timer to be for the arcane spells ? 1) One timer for all levels 2) Timers depends linearly from the spell level 3) Timers depends exponentially from the spell level 4) Timers is randomized~ PRINT ~So in: 1) timer = constant 2) timer = constant + spell level * level variable 3) timer = constant + spell level ^ (exponent/root) 4) timer = ???~ ACTION_READLN function END ACTION_IF (%function% = 1) THEN BEGIN PRINT ~Set constant for all levels~ ACTION_READLN constant OUTER_WHILE !(IS_AN_INT %constant%) BEGIN PRINT ~Try, we'll to keep it on the level dude. So set the darn constant to a number, dude. OK ?~ END END ACTION_IF (%function% = 1 AND IS_AN_INT %constant%) BEGIN OUTER_SET timer1 = %constant% OUTER_SET timer2 = %constant% OUTER_SET timer3 = %constant% OUTER_SET timer4 = %constant% OUTER_SET timer5 = %constant% OUTER_SET timer6 = %constant% OUTER_SET timer7 = %constant% OUTER_SET timer8 = %constant% OUTER_SET timer9 = %constant% END ACTION_IF (%function% = 2) THEN BEGIN PRINT ~Set constant for all levels~ ACTION_READLN constant OUTER_WHILE !(IS_AN_INT %constant%) BEGIN PRINT ~Try, we'll to keep it on the level dude. So set the darn constant to a number, dude. OK~ END END ACTION_IF (%function% = 2 AND IS_AN_INT %constant%) BEGIN PRINT ~Set the level variable for the levels~ ACTION_READLN level_variable OUTER_WHILE !(IS_AN_INT %level_variable%) BEGIN PRINT ~Try, we'll to keep it on the level dude. So set the darn level variable to a number, dude. OK~ END END ACTION_IF (%function% = 2 AND IS_AN_INT %constant% AND IS_AN_INT %level_variable%) BEGIN OUTER_SET timer1 = (%constant% + %level_variable%) OUTER_SET timer2 = (%constant% + 2*%level_variable%) OUTER_SET timer3 = (%constant% + 3*%level_variable%) OUTER_SET timer4 = (%constant% + 4*%level_variable%) OUTER_SET timer5 = (%constant% + 5*%level_variable%) OUTER_SET timer6 = (%constant% + 6*%level_variable%) OUTER_SET timer7 = (%constant% + 7*%level_variable%) OUTER_SET timer8 = (%constant% + 8*%level_variable%) OUTER_SET timer9 = (%constant% + 9*%level_variable%) END ACTION_IF (%function% = 3) THEN BEGIN PRINT ~Set constant for all levels~ ACTION_READLN constant OUTER_WHILE !(IS_AN_INT %constant%) BEGIN PRINT ~Try, we'll to keep it on the level dude. So set the darn constant to a number, dude. OK~ END END ACTION_IF (%function% = 3 AND IS_AN_INT %constant%) BEGIN PRINT ~Set the *exponent* that will be divided by the root you'll decide, next.~ ACTION_READLN exponent OUTER_WHILE !(IS_AN_INT %exponent%) BEGIN PRINT ~Try, well to keep it on the level dude. So set the darn *exponent* to a number, dude. OK~ END END ACTION_IF (%function% = 3 AND IS_AN_INT %constant% AND IS_AN_INT %exponent%) BEGIN PRINT ~Set the exponential *root* or the exponents divider, remember that dividing a number with 1, is the number itself~ ACTION_READLN root OUTER_WHILE !(IS_AN_INT %root%) BEGIN PRINT ~We'll be trying to keep it on the level dude. So set the darn *root* to a number, dude. K?~ END END ACTION_IF (%function% = 3 AND IS_AN_INT %constant% AND IS_AN_INT %exponent% AND IS_AN_INT %root%) BEGIN OUTER_SET timer1 = ~%constant%~ OUTER_SET timer2 = (%constant% + 2 ** (%exponent% %root%)) OUTER_SET timer3 = (%constant% + 3 ** (%exponent% %root%)) OUTER_SET timer4 = (%constant% + 4 ** (%exponent% %root%)) OUTER_SET timer5 = (%constant% + 5 ** (%exponent% %root%)) OUTER_SET timer6 = (%constant% + 6 ** (%exponent% %root%)) OUTER_SET timer7 = (%constant% + 7 ** (%exponent% %root%)) OUTER_SET timer8 = (%constant% + 8 ** (%exponent% %root%)) OUTER_SET timer9 = (%constant% + 9 ** (%exponent% %root%)) END ACTION_IF (%function% = 4) THEN BEGIN RANDOM_SEED ~a~ PRINT ~The constant is randomized for all levels~ OUTER_SET timer1 = RANDOM(1 100) OUTER_SET timer2 = RANDOM(2 200) OUTER_SET timer3 = RANDOM(115 198) OUTER_SET timer4 = RANDOM(101 400) OUTER_SET timer5 = RANDOM(20 500) OUTER_SET timer6 = RANDOM(235 727) OUTER_SET timer7 = RANDOM(350 619) OUTER_SET timer8 = RANDOM(40 836) OUTER_SET timer9 = RANDOM(482 1000) END ACTION_IF (IS_AN_INT %timer1% AND IS_AN_INT %timer2% AND IS_AN_INT %timer3% AND IS_AN_INT %timer4% AND IS_AN_INT %timer5% AND IS_AN_INT %timer6% AND IS_AN_INT %timer7% AND IS_AN_INT %timer8% AND IS_AN_INT %timer9%) THEN BEGIN PRINT ~The timers for the arcane spells restoration will be as of following: Level 1 spells: %timer1% real seconds Level 2 spells: %timer2% real seconds Level 3 spells: %timer3% real seconds Level 4 spells: %timer4% real seconds Level 5 spells: %timer5% real seconds Level 6 spells: %timer6% real seconds Level 7 spells: %timer7% real seconds Level 8 spells: %timer8% real seconds Level 9 spells: %timer9% real seconds~ PRINT ~Are you sure you wish to use those ? [Y/N]~ ACTION_READLN answer OUTER_WHILE !(~%answer%~ STRING_COMPARE_CASE ~y~ || ~%answer%~ STRING_COMPARE_CASE ~n~) BEGIN PRINT ~Are you sure you wish to use those ? [Y/N]~ ACTION_READLN answer END ACTION_IF (~%answer%~ STRING_COMPARE_CASE ~y~) THEN BEGIN FAIL ~You didn't push y/y, so if you wish to install the mod component, you can, and you can ignore the rest of the error message.~ END ACTION_IF (~%answer%~ STRING_COMPARE_CASE ~n~) THEN BEGIN PRINT ~Now, do you wish that the spells are restored when: 1) Only when the casting is completelly successful 2) Even if it's not~ ACTION_READLN sucfail OUTER_WHILE !(IS_AN_INT %sucfail%) || (%sucfail% > 2) || (%sucfail% < 1) BEGIN PRINT ~OK man, now you are getting to me nerves alright, answer 1 or 2, got it?~ END END ACTION_IF (timer1 > 0 AND timer2 > 0 AND timer3 > 0 AND timer4 > 0 AND timer5 > 0 AND timer6 > 0 AND timer7 > 0 AND timer8 > 0 AND timer9 > 0 AND %sucfail% = 1) THEN BEGIN COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files READ_SHORT 0x1c "spl_type" READ_LONG 0x34 ~spell_level~ READ_LONG 0x64 "abil_off" READ_SHORT 0x68 "abil_num" READ_LONG 0x6a "fx_off" READ_SHORT 0x70 "fx_num" PATCH_IF ("%spl_type%" = "1") BEGIN //////Refresh on successful casting only WHILE ("%abil_num%" > 0) BEGIN // adjusts indices for abilities SET "abil_num" = ("%abil_num%" - 1) READ_SHORT ("%abil_off%" + 0x20 + ("%abil_num%" * 0x28)) "fx_idx" WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_num%" * 0x28)) ("%fx_idx%" + 1) END WRITE_SHORT 0x70 ("%fx_num%" + 1) INSERT_BYTES ("%fx_off%" ) 0x30 // New effect WRITE_SHORT ("%fx_off%" ) 261 // Restore Lost Spell WRITE_BYTE ("%fx_off%" + 0x02 ) 1 // Target Self WRITE_LONG ("%fx_off%" + 0x04 ) ~spell_level~ // Parameter 1 (Restored Spell Level) WRITE_BYTE ("%fx_off%" + 0x08 ) 0 // Parameter 2 (Wizard / Bard) WRITE_BYTE ("%fx_off%" + 0x0c) 4 // Delayed PATCH_IF (~spell_level~ = 1) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer1) // User-defined values END PATCH_IF (~spell_level~ = 2) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer2) // User-defined values END PATCH_IF (~spell_level~ = 3) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer3) // User-defined values END PATCH_IF (~spell_level~ = 4) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer4) // User-defined values END PATCH_IF (~spell_level~ = 5) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer5) // User-defined values END PATCH_IF (~spell_level~ = 6) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer6) // User-defined values END PATCH_IF (~spell_level~ = 7) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer7) // User-defined values END PATCH_IF (~spell_level~ = 8) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer8) // User-defined values END PATCH_IF (~spell_level~ = 9) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer9) // User-defined values END WRITE_BYTE ("%fx_off%" + 0x12) 100 // Probability WRITE_BYTE ("%fx_off%" + 0x0d) 3 // Dispel/Bypass WHILE ("%fx_num%" > 0) BEGIN SET "fx_num" = ("%fx_num%" - 1) WRITE_BYTE ("%fx_off%" + 0x0d) 2 // no dispel/not bypass WRITE_LONG ("%fx_off%" + 0x0e) 0 // duration END END END BUT_ONLY_IF_IT_CHANGES END /////////Refresh on unsuccessful casting too ACTION_IF (timer1 > 0 AND timer2 > 0 AND timer3 > 0 AND timer4 > 0 AND timer5 > 0 AND timer6 > 0 AND timer7 > 0 AND timer8 > 0 AND timer9 > 0 AND %sucfail% = 2) THEN BEGIN COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files READ_SHORT 0x1c "spl_type" READ_LONG 0x34 ~spell_level~ READ_LONG 0x64 "abil_off" READ_SHORT 0x68 "abil_num" READ_LONG 0x6a "fx_off" READ_SHORT 0x70 "fx_num" PATCH_IF ("%spl_type%" = "1") BEGIN PATCH_IF (~spl_type~=1) BEGIN SET ~loops~ = 0 SET ~delta~ = 0 WHILE (~loops~ < ~abil_num~) BEGIN READ_SHORT (abil_off + 0x1e + (0x28 * loops)) ~abil_fx_num~ READ_SHORT (abil_off + 0x20 + (0x28 * loops)) ~abil_fx_idx~ SET ~abil_fx_idx~ = (abil_fx_idx + delta) WRITE_SHORT (~abil_off~ + 0x20 + (0x28 * loops)) ~abil_fx_idx~ INSERT_BYTES (~fx_off~ + ((~abil_fx_idx~) * 0x30)) 0x30 // New effect WRITE_SHORT (~fx_off~ + ((~abil_fx_idx~) * 0x30)) 261 // Restore Lost Spell WRITE_BYTE (~fx_off~ + 0x02 + ((~abil_fx_idx~) * 0x30)) 1 // Target Self WRITE_LONG (~fx_off~ + 0x04 + ((~abil_fx_idx~) * 0x30)) ~spell_level~ // Parameter 1 (Restored Spell Level) WRITE_BYTE (~fx_off~ + 0x08 + ((~abil_fx_idx~) * 0x30)) 0 // Parameter 2 (Wizard / Bard) WRITE_BYTE (~fx_off~ + 0x0c + ((~abil_fx_idx~) * 0x30)) 4 // Delayed PATCH_IF (~spell_level~ = 1) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer1 + 6) // User-defined values END PATCH_IF (~spell_level~ = 2) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer2 + 6) // User-defined values END PATCH_IF (~spell_level~ = 3) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer3 + 6) // User-defined values END PATCH_IF (~spell_level~ = 4) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer4 + 6) // User-defined values END PATCH_IF (~spell_level~ = 5) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer5 + 6) // User-defined values END PATCH_IF (~spell_level~ = 6) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer6 + 6) // User-defined values END PATCH_IF (~spell_level~ = 7) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer7 + 6) // User-defined values END PATCH_IF (~spell_level~ = 8) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer8 + 6) // User-defined values END PATCH_IF (~spell_level~ = 9) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer9 + 6) // User-defined values END WRITE_BYTE (fx_off + 0x12 + ((abil_fx_idx) * 0x30)) 100 // Probability WRITE_BYTE (fx_off + 0x0d + ((abil_fx_idx) * 0x30)) 3 // Dispel/Bypass SET ~delta1~ = 1 SET ~delta~ = (delta + delta1) WRITE_SHORT (abil_off + 0x1e + (0x28 * loops)) (abil_fx_num + delta1) SET ~loops~ = (loops + 1) END END END END BUT_ONLY_IF_IT_CHANGES END END /////////////////////////////////////////////////////////////////////////////// /////////////////////////////// Divine Spells /////////////////////////////// /////////////////////////////////////////////////////////////////////////////// BEGIN ~Divine Spell Refreshment~ PRINT ~Which type of function would you like the timer to be for the divine spells ? 1) One timer for all levels 2) Timers depends linearly from the spell level 3) Timers depends exponentially from the spell level 4) Timers is randomized~ PRINT ~So in: 1) timer = constant 2) timer = constant + spell level * level variable 3) timer = constant + spell level ^ (exponent/root) 4) timer = ???~ ACTION_READLN function OUTER_WHILE !(IS_AN_INT %function%) || (%function% > 4) || (%function% < 1) BEGIN PRINT ~Which type of function would you like the timer to be for the divine spells ? 1) One timer for all levels 2) Timers depends linearly from the spell level 3) Timers depends exponentially from the spell level 4) Timers is randomized~ PRINT ~So in: 1) timer = constant 2) timer = constant + spell level * level variable 3) timer = constant + spell level ^ (exponent/root) 4) timer = ???~ ACTION_READLN function END ACTION_IF (%function% = 1) THEN BEGIN PRINT ~Set constant for all levels~ ACTION_READLN constant OUTER_WHILE !(IS_AN_INT %constant%) BEGIN PRINT ~Try, we'll to keep it on the level dude. So set the darn constant to a number, dude. OK ?~ END END ACTION_IF (%function% = 1 AND IS_AN_INT %constant%) BEGIN OUTER_SET timer1 = %constant% OUTER_SET timer2 = %constant% OUTER_SET timer3 = %constant% OUTER_SET timer4 = %constant% OUTER_SET timer5 = %constant% OUTER_SET timer6 = %constant% OUTER_SET timer7 = %constant% END ACTION_IF (%function% = 2) THEN BEGIN PRINT ~Set constant for all levels~ ACTION_READLN constant OUTER_WHILE !(IS_AN_INT %constant%) BEGIN PRINT ~Try, we'll to keep it on the level dude. So set the darn constant to a number, dude. OK~ END END ACTION_IF (%function% = 2 AND IS_AN_INT %constant%) BEGIN PRINT ~Set the level variable for the levels~ ACTION_READLN level_variable OUTER_WHILE !(IS_AN_INT %level_variable%) BEGIN PRINT ~Try, we'll to keep it on the level dude. So set the darn level variable to a number, dude. OK~ END END ACTION_IF (%function% = 2 AND IS_AN_INT %constant% AND IS_AN_INT %level_variable%) BEGIN OUTER_SET timer1 = (%constant% + %level_variable%) OUTER_SET timer2 = (%constant% + 2*%level_variable%) OUTER_SET timer3 = (%constant% + 3*%level_variable%) OUTER_SET timer4 = (%constant% + 4*%level_variable%) OUTER_SET timer5 = (%constant% + 5*%level_variable%) OUTER_SET timer6 = (%constant% + 6*%level_variable%) OUTER_SET timer7 = (%constant% + 7*%level_variable%) END ACTION_IF (%function% = 3) THEN BEGIN PRINT ~Set constant for all levels~ ACTION_READLN constant OUTER_WHILE !(IS_AN_INT %constant%) BEGIN PRINT ~Try, we'll to keep it on the level dude. So set the darn constant to a number, dude. OK~ END END ACTION_IF (%function% = 3 AND IS_AN_INT %constant%) BEGIN PRINT ~Set the *exponent* that will be divided by the root you'll decide, next.~ ACTION_READLN exponent OUTER_WHILE !(IS_AN_INT %exponent%) BEGIN PRINT ~Try, well to keep it on the level dude. So set the darn *exponent* to a number, dude. OK~ END END ACTION_IF (%function% = 3 AND IS_AN_INT %constant% AND IS_AN_INT %exponent%) BEGIN PRINT ~Set the exponential *root* or the exponents divider, remember that dividing a number with 1, is the number itself~ ACTION_READLN root OUTER_WHILE !(IS_AN_INT %root%) BEGIN PRINT ~We'll be trying to keep it on the level dude. So set the darn *root* to a number, dude. K?~ END END ACTION_IF (%function% = 3 AND IS_AN_INT %constant% AND IS_AN_INT %exponent% AND IS_AN_INT %root%) BEGIN OUTER_SET timer1 = ~%constant%~ OUTER_SET timer2 = (%constant% + 2 ** (%exponent% %root%)) OUTER_SET timer3 = (%constant% + 3 ** (%exponent% %root%)) OUTER_SET timer4 = (%constant% + 4 ** (%exponent% %root%)) OUTER_SET timer5 = (%constant% + 5 ** (%exponent% %root%)) OUTER_SET timer6 = (%constant% + 6 ** (%exponent% %root%)) OUTER_SET timer7 = (%constant% + 7 ** (%exponent% %root%)) END ACTION_IF (%function% = 4) THEN BEGIN RANDOM_SEED ~d~ PRINT ~The constant is randomized for all levels~ OUTER_SET timer1 = RANDOM(1 100) OUTER_SET timer2 = RANDOM(2 300) OUTER_SET timer3 = RANDOM(40 482) OUTER_SET timer4 = RANDOM(115 198) OUTER_SET timer5 = RANDOM(350 400) OUTER_SET timer6 = RANDOM(235 727) OUTER_SET timer7 = RANDOM(140 1000) END ACTION_IF (IS_AN_INT %timer1% AND IS_AN_INT %timer2% AND IS_AN_INT %timer3% AND IS_AN_INT %timer4% AND IS_AN_INT %timer5% AND IS_AN_INT %timer6% AND IS_AN_INT %timer7%) THEN BEGIN PRINT ~The timers for the divine spells restoration will be as of following: Level 1 spells: %timer1% real seconds Level 2 spells: %timer2% real seconds Level 3 spells: %timer3% real seconds Level 4 spells: %timer4% real seconds Level 5 spells: %timer5% real seconds Level 6 spells: %timer6% real seconds Level 7 spells: %timer7% real seconds~ PRINT ~Are you sure you wish to use those ? [Y/N]~ ACTION_READLN answer OUTER_WHILE !(~%answer%~ STRING_COMPARE_CASE ~y~ || ~%answer%~ STRING_COMPARE_CASE ~n~) BEGIN PRINT ~Are you sure you wish to use those ? [Y/N]~ ACTION_READLN answer END ACTION_IF (~%answer%~ STRING_COMPARE_CASE ~y~) THEN BEGIN FAIL ~You didn't push y/y, so if you wish to install the mod component, you can, and you can ignore the rest of the error message.~ END ACTION_IF (~%answer%~ STRING_COMPARE_CASE ~n~) THEN BEGIN PRINT ~Now, do you wish that the spells are restored when: 1) Only when the casting is completelly successful 2) Even if it's not~ ACTION_READLN sucfail OUTER_WHILE !(IS_AN_INT %sucfail%) || (%sucfail% > 2) || (%sucfail% < 1) BEGIN PRINT ~OK man, now you are getting to me nerves alright, answer 1 or 2, got it?~ END END ACTION_IF (timer1 > 0 AND timer2 > 0 AND timer3 > 0 AND timer4 > 0 AND timer5 > 0 AND timer6 > 0 AND timer7 > 0 AND %sucfail% = 1) THEN BEGIN COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files READ_SHORT 0x1c "spl_type" READ_LONG 0x34 ~spell_level~ READ_LONG 0x64 "abil_off" READ_SHORT 0x68 "abil_num" READ_LONG 0x6a "fx_off" READ_SHORT 0x70 "fx_num" PATCH_IF ("%spl_type%" = "2") BEGIN //////Refresh on successful casting only WHILE ("%abil_num%" > 0) BEGIN // adjusts indices for abilities SET "abil_num" = ("%abil_num%" - 1) READ_SHORT ("%abil_off%" + 0x20 + ("%abil_num%" * 0x28)) "fx_idx" WRITE_SHORT ("%abil_off%" + 0x20 + ("%abil_num%" * 0x28)) ("%fx_idx%" + 1) END WRITE_SHORT 0x70 ("%fx_num%" + 1) INSERT_BYTES ("%fx_off%" ) 0x30 // New effect WRITE_SHORT ("%fx_off%" ) 261 // Restore Lost Spell WRITE_BYTE ("%fx_off%" + 0x02 ) 1 // Target Self WRITE_LONG ("%fx_off%" + 0x04 ) ~spell_level~ // Parameter 1 (Restored Spell Level) WRITE_BYTE ("%fx_off%" + 0x08 ) 1 // Parameter 2 (Cleric / Druid) WRITE_BYTE ("%fx_off%" + 0x0c) 4 // Delayed PATCH_IF (~spell_level~ = 1) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer1) // User-defined values END PATCH_IF (~spell_level~ = 2) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer2) // User-defined values END PATCH_IF (~spell_level~ = 3) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer3) // User-defined values END PATCH_IF (~spell_level~ = 4) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer4) // User-defined values END PATCH_IF (~spell_level~ = 5) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer5) // User-defined values END PATCH_IF (~spell_level~ = 6) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer6) // User-defined values END PATCH_IF (~spell_level~ = 7) BEGIN WRITE_LONG ("%fx_off%" + 0x0e) (timer7) // User-defined values END WRITE_BYTE ("%fx_off%" + 0x12) 100 // Probability WRITE_BYTE ("%fx_off%" + 0x0d) 3 // Dispel/Bypass WHILE ("%fx_num%" > 0) BEGIN SET "fx_num" = ("%fx_num%" - 1) WRITE_BYTE ("%fx_off%" + 0x0d) 2 // no dispel/not bypass WRITE_LONG ("%fx_off%" + 0x0e) 0 // duration END END END BUT_ONLY_IF_IT_CHANGES END /////////Refresh on unsuccessful casting too ACTION_IF (timer1 > 0 AND timer2 > 0 AND timer3 > 0 AND timer4 > 0 AND timer5 > 0 AND timer6 > 0 AND timer7 > 0 AND %sucfail% = 2) THEN BEGIN COPY_EXISTING_REGEXP GLOB ~^.+\.spl$~ ~override~ PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN // protects against invalid files READ_SHORT 0x1c "spl_type" READ_LONG 0x34 ~spell_level~ READ_LONG 0x64 "abil_off" READ_SHORT 0x68 "abil_num" READ_LONG 0x6a "fx_off" READ_SHORT 0x70 "fx_num" PATCH_IF ("%spl_type%" = "2") BEGIN PATCH_IF (~spl_type~=1) BEGIN SET ~loops~ = 0 SET ~delta~ = 0 WHILE (~loops~ < ~abil_num~) BEGIN READ_SHORT (abil_off + 0x1e + (0x28 * loops)) ~abil_fx_num~ READ_SHORT (abil_off + 0x20 + (0x28 * loops)) ~abil_fx_idx~ SET ~abil_fx_idx~ = (abil_fx_idx + delta) WRITE_SHORT (~abil_off~ + 0x20 + (0x28 * loops)) ~abil_fx_idx~ INSERT_BYTES (~fx_off~ + ((~abil_fx_idx~) * 0x30)) 0x30 // New effect WRITE_SHORT (~fx_off~ + ((~abil_fx_idx~) * 0x30)) 261 // Restore Lost Spell WRITE_BYTE (~fx_off~ + 0x02 + ((~abil_fx_idx~) * 0x30)) 1 // Target Self WRITE_LONG (~fx_off~ + 0x04 + ((~abil_fx_idx~) * 0x30)) ~spell_level~ // Parameter 1 (Restored Spell Level) WRITE_BYTE (~fx_off~ + 0x08 + ((~abil_fx_idx~) * 0x30)) 1 // Parameter 2 (Cleric / Druid) WRITE_BYTE (~fx_off~ + 0x0c + ((~abil_fx_idx~) * 0x30)) 4 // Delayed PATCH_IF (~spell_level~ = 1) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer1 + 6) // User-defined values END PATCH_IF (~spell_level~ = 2) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer2 + 6) // User-defined values END PATCH_IF (~spell_level~ = 3) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer3 + 6) // User-defined values END PATCH_IF (~spell_level~ = 4) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer4 + 6) // User-defined values END PATCH_IF (~spell_level~ = 5) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer5 + 6) // User-defined values END PATCH_IF (~spell_level~ = 6) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer6 + 6) // User-defined values END PATCH_IF (~spell_level~ = 7) BEGIN WRITE_LONG (~fx_off~ + 0x0e + ((~abil_fx_idx~) * 0x30)) (timer7 + 6) // User-defined values END WRITE_BYTE (fx_off + 0x12 + ((abil_fx_idx) * 0x30)) 100 // Probability WRITE_BYTE (fx_off + 0x0d + ((abil_fx_idx) * 0x30)) 3 // Dispel/Bypass SET ~delta1~ = 1 SET ~delta~ = (delta + delta1) WRITE_SHORT (abil_off + 0x1e + (0x28 * loops)) (abil_fx_num + delta1) SET ~loops~ = (loops + 1) END END END BUT_ONLY_IF_IT_CHANGES END END //!---------------------------------------------------------------------------- // Innate Spells //!---------------------------------------------------------------------------- //This is quite impossible to do correctly as the innates don't get memorized in the same way the regular spells do BEGIN @51 //GROUP @120 SUBCOMPONENT @30 DEPRECATED ~This component has been removed from the Spell System Adjustments mod and is no longer supported (hence it has been uninstalled from your game).~ BEGIN @52 //GROUP @120 SUBCOMPONENT @30 DEPRECATED ~This component has been removed from the Spell System Adjustments mod and is no longer supported (hence it has been uninstalled from your game).~