kreso Posted August 7, 2015 Share Posted August 7, 2015 I need some code that would patch a specific spell (say Pro Fire, spwi319) with protection against another spell (say Ice Storm, spwi404.) . If Pro Fire had one header, this is easy. COPY_EXISTING spwi319.spl override add spell effect 206 vs spwi404 done. How can I patch multiple times (up to level 20) for correct duration? Link to comment
subtledoctor Posted August 7, 2015 Share Posted August 7, 2015 Doesn't ADD_SPELL_EFFECT loop through the extended effects and use the existing value for duration, if you leave it unspecified? Link to comment
Gwendolyne Posted August 8, 2015 Share Posted August 8, 2015 Here is a piece of code I use to clone SPPR403 into new spells : ACTION_FOR_EACH Rapidite2 IN ~GWAgiPeg~ // Agilité du Pégase ~GWDesAil~ // Destrier ailé ~GWLicPeg~ // Agilité du Pégase ~GWLicAil~ // Ailes du Zéphyr BEGIN COPY_EXISTING ~SPPR403.spl~ ~override/%Rapidite2%.spl~ // Définition des variables PATCH_MATCH ~%DEST_RES%~ WITH GWAgiPeg BEGIN SET ailes = 0 TEXT_SPRINT icone "GWAGIPE" SET duree_B = 18 SET niveau = 1 SET loc = 2 SET p_hate = 2 SET nom = RESOLVE_STR_REF (@7711023) // Agilité du Pégase SET ecole2 = 13 SET desc = RESOLVE_STR_REF (@7711024) SET messfin = RESOLVE_STR_REF (@7130123) END // Fin d'agilité du Pégase GWLicPeg BEGIN SET ailes = 0 TEXT_SPRINT icone "GWLICPE" SET duree_B = 18 SET niveau = 1 SET loc = 4 SET p_hate = 2 SET nom = RESOLVE_STR_REF (@7711023) // Agilité du Pégase SET ecole2 = 13 SET desc = RESOLVE_STR_REF (@7729102) SET messfin = RESOLVE_STR_REF (@7130123) END // Fin d'agilité du Pégase GWDesAil BEGIN SET ailes = 1 TEXT_SPRINT icone "GWDESAI" SET duree_B = 0 SET niveau = 1 SET loc = 4 SET p_hate = 1 SET nom = RESOLVE_STR_REF (@7719403) // Destrier ailé SET ecole2 = 12 SET desc = RESOLVE_STR_REF (@7719404) SET messfin = RESOLVE_STR_REF (@7130124) END // Fin des effets de Destrier ailé GWLicAil BEGIN SET ailes = 1 TEXT_SPRINT icone "GWLICAI" SET duree_B = 0 SET niveau = 1 SET loc = 4 SET p_hate = 1 SET nom = RESOLVE_STR_REF (@7729401) // Ailes du Zéphyr SET ecole2 = 12 SET desc = RESOLVE_STR_REF (@7729402) SET messfin = RESOLVE_STR_REF (@7130125) END // Fin des effets des Ailes du Zéphyr DEFAULT END // Paramétrage général WRITE_ASCII 0x10 ~~ #8 // casting sound PATCH_MATCH ~%DEST_RES%~ WITH GWAgiPeg BEGIN WRITE_LONG 0x1e THIS | BIT6 | BIT31 END // ajoute Abjurer et Druidic exclusions DEFAULT WRITE_LONG 0x1e THIS | BIT1 | BIT6 | BIT31 // ajoute Evil Priest, Abjurer et Druidic exclusions END WRITE_LONG 0x8 "%nom%" WRITE_LONG 0x50 "%desc%" WRITE_SHORT 0x1c loc // spelltype WRITE_SHORT 0x22 0 // graphics WRITE_BYTE 0x25 8 // school1 WRITE_BYTE 0x27 ecole2 // school2 WRITE_LONG 0x34 1 // spelllevel WRITE_ASCIIE 0x3a EVAL "%icone%C" #8 ..... // Ajout des nouveaux effets (add new effects) FOR (header=1;header<=50;++header) BEGIN SET power = 1 SET resist_dispel = 3 SET target = 2 SET duree = duree_B + 6*header LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 139 target timing = 4 duration = duree parameter1 = messfin power resist_dispel header END LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 142 target duration = duree parameter2 = 38 power resist_dispel header END // Graphics: Display Special Effect Icon [142] : 38 Haste LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 50 target duration = 6 parameter1 = "-256" parameter2 = 1966080 power resist_dispel header END // Colour: Glow by RGB (Brief) [50] LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 141 target timing = 4 duration = duree parameter2 = 0 power resist_dispel header END // Graphics: Lighting Effects [141] : 0 aqua SHAIR LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 174 target timing = 1 power resist_dispel header STR_VAR resource = EFF_M28 END LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 139 target timing = 1 parameter1 = nom power resist_dispel header END LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 141 target timing = 3 duration = 3 parameter2 = 30 power resist_dispel header END // Graphics: Lighting Effects [141] : 30 white SHWATER PATCH_IF ("%ailes%" = 1) BEGIN LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 0 target duration = duree parameter1 = 2 parameter2 = 2 power resist_dispel header END // Stat: AC vs. Damage Type Modifier [0] LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 285 target duration = duree parameter1 = 2 power resist_dispel header END // Stat: Melee Weapon Damage Modifier [285] LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 284 target duration = duree parameter1 = 2 power resist_dispel header END // Stat: Melee THAC0 Modifier [284] END LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 308 target duration = duree parameter2 = 1 power resist_dispel header END // Protection: From Tracking [308] LPF ADD_SPELL_EFFECT INT_VAR insert_point = 0 opcode = 16 target duration = duree parameter2 = p_hate power resist_dispel header END // State: Haste 2 [317] 2 Speed haste without attack bonuses PATCH_FOR_EACH res IN ~SPWI613~ ~SPWISH36~ ~SPWISH37~ ~SPWISH40~ ~RR#WSH37~ ~SPIN655~ ~GWAGIPE~ ~GWDESAI~ ~GWLICPE~ ~GWLICAI~ BEGIN // Bénéficie déjà des effets d'un sort similaire LPF ADD_SPELL_EFFECT INT_VAR insert_point = "-1" opcode = 206 target duration = duree parameter1 = mess_modif power resist_dispel header STR_VAR resource = EVAL "%res%" END // Spell: Protection from Spell [206] END END ... Just modify the variables and adjust the headers number and it should work. Link to comment
kreso Posted August 8, 2015 Author Share Posted August 8, 2015 Thank you. I think that will do. Link to comment
Wisp Posted August 8, 2015 Share Posted August 8, 2015 I would suggest you iterate over the headers (e.g., with GET_OFFSET_ARRAY) and use CLONE_EFFECT (cloning from some effect you know will have the correct duration, e.g., fire resistance). Link to comment
subtledoctor Posted August 8, 2015 Share Posted August 8, 2015 It does? I might have been thinking of ALTER_EFFECT. I guess a quick-and-dirty method would be to just use ALTER_EFFECT to replace an effect that's already there but you don't care as much about... but yeah that would be far from ideal. Link to comment
kreso Posted August 8, 2015 Author Share Posted August 8, 2015 Wisp, I kind of knew more before I read about GET_OFFSET than I do now . Thanks anyway, I'll mingle something I think. Link to comment
subtledoctor Posted August 8, 2015 Share Posted August 8, 2015 Actually wait, shouldn't CLONE_EFFECT be able to do this without kreso having to manually iterate over the headers? It defaults to INT_VAR headers = -1 ...so as long as there is an existing effect with the correct duration in every header (which is true of most spells) then it should do the work for you. No? Link to comment
Gwendolyne Posted August 9, 2015 Share Posted August 9, 2015 Actually wait, shouldn't CLONE_EFFECT be able to do this without kreso having to manually iterate over the headers? It defaults to INT_VAR headers = -1 ...so as long as there is an existing effect with the correct duration in every header (which is true of most spells) then it should do the work for you. No? It might... My code was written before the CLONE_EFFECT release... From that time, I am working on simplying my tp2. But until then, I m sure this one works... Link to comment
Wisp Posted August 9, 2015 Share Posted August 9, 2015 Huh, yeah, I overlooked that. So CLONE_EFFECT alone is enough to do this. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.