Jump to content


Photo

ADD_SPELL in spell mods


  • Please log in to reply
51 replies to this topic

#41 Turambar

Turambar
  • Modder
  • 935 posts

Posted 22 November 2011 - 02:02 AM

I disagree. If installed with things like spell revisions, it doesn't even matter if they were nerfed. They're still overpowered. And if it's just a option (component) at install time, you wont be deleting things from normal users.

Moreover, you can still leave the enemies using them (nerfed or not).

I bet there are alot of people who don't use xSotSC because of their loot - but spells are even more aggravating, especially for priests (where you can't delete them or ignore it).

When I start working on DS, I'll see. Anyway, this is NOT the correct place to discuss this. As I've told you, you'd better open a topic on the DS forum, where all people interested in DS can discuss the matter.

Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg


#42 Galactygon

Galactygon

    Modding since 2002

  • Member
  • 938 posts

Posted 27 July 2014 - 03:04 AM

Bumping this this thread.


Posted Image

#43 Galactygon

Galactygon

    Modding since 2002

  • Member
  • 938 posts

Posted 31 July 2014 - 12:30 PM

List updated to include IWDification B3 and SpellPack B6.
 
If you have any further mods that use ADD_SPELL please let me know!


Edited by Galactygon, 31 July 2014 - 12:32 PM.

Posted Image

#44 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 31 July 2014 - 12:53 PM

@Galactygon: Is there any chance you could add the original spells to the list as well, preferably on top of their respected levels, and make them sorta distinctive. The reason being that we could see the bottle necks that might come up. As I think I read there was a max of 50 spells per level, with the ToBEx installed. As it's kinda 24 if there's no ToBEx.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#45 Galactygon

Galactygon

    Modding since 2002

  • Member
  • 938 posts

Posted 31 July 2014 - 01:53 PM

@Galactygon: Is there any chance you could add the original spells to the list as well, preferably on top of their respected levels, and make them sorta distinctive. The reason being that we could see the bottle necks that might come up. As I think I read there was a max of 50 spells per level, with the ToBEx installed. As it's kinda 24 if there's no ToBEx.

For reference, I've added a link to the IESDP on the top otherwise it would clutter the list to have too many entries. The max 50 spells per level rule should be fixable with ToBEx and possibly with BGEE in the future so that is not a pressing issue. The largest bottleneck by far are the SPWI9xx spells, which are filled with leftovers from BG1 and only allow you an additional ~20 spells (without ToBEx ~5). I am going to lobby the BG:EE team for additional spaces perhaps even new SPWI -> SPWD and SPPR -> SPPT (any better ideas?) hardcoded slots that show up on the selection screen and could be used for ADD_SPELL.
Posted Image

#46 K4thos

K4thos
  • Modder
  • 315 posts

Posted 19 October 2015 - 01:56 AM


@Galactygon: Is there any chance you could add the original spells to the list as well, preferably on top of their respected levels, and make them sorta distinctive. The reason being that we could see the bottle necks that might come up. As I think I read there was a max of 50 spells per level, with the ToBEx installed. As it's kinda 24 if there's no ToBEx.

For reference, I've added a link to the IESDP on the top otherwise it would clutter the list to have too many entries. The max 50 spells per level rule should be fixable with ToBEx and possibly with BGEE in the future so that is not a pressing issue. The largest bottleneck by far are the SPWI9xx spells, which are filled with leftovers from BG1 and only allow you an additional ~20 spells (without ToBEx ~5). I am going to lobby the BG:EE team for additional spaces perhaps even new SPWI -> SPWD and SPPR -> SPPT (any better ideas?) hardcoded slots that show up on the selection screen and could be used for ADD_SPELL.
 
So, anything done about it on the Beamdog front? If no, than I think it's time to make a change already as it's pretty ridulues to have only few free level 9 slots when 60 entries don't need to be there. I agree that we should keep the IDS naming in order to be compatible with vanilla scripts and mods that uses non-RES versions of the spell actions.
 
I've preapared following code that converts SPWI926-SPWI999 into SPIN spells. The only spell from that range that is kept is SPWI938 which is used for weather-related lightning (hardcoded?) and doesn't have IDS name. To make the spell filenames the same in all platforms I've adopted unused in vanilla game level 3 SPIN slots, so all these spells will occupy entries from SPIN301 to SPIN360 when installed at the beginning (before any other mod).
BACKUP ~moreWizSlots/backup~
AUTHOR ~K4thos (swit)~
VERSION ~beta 0.1~

BEGIN ~moreWizSlots~
REQUIRE_PREDICATE GAME_IS ~bg2 tob bg1 totsc tutu tutu_totsc bgt bgee bg2ee~ ~This mod is not needed for this game.~

COPY_EXISTING ~SPELL.IDS~ ~override~
    REPLACE_TEXTUALLY ~%WNL%~ ~%LNL%~ //ADD_SPELL breaks regexp new lines detection
    REPLACE_TEXTUALLY ~[%TAB% ]+~ ~ ~
    REPLACE_TEXTUALLY ~^[%TAB% ]+~ ~~
    REPLACE_TEXTUALLY ~[%TAB% ]+$~ ~~
    PATCH_IF (GAME_IS ~bg2 tob bgt bg2ee~) BEGIN //not sure if Tutu should be listed here
        REPLACE_TEXTUALLY ~2924 BERESH_CHANGE%LNL%~ ~~ //WIZARD_SUMMON_PLANATAR_EVIL dupe
        REPLACE_TEXTUALLY ~2925 KAISHAS_CHANGE%LNL%~ ~~ //WIZARD_COMET dupe
    END
BUT_ONLY

//SPWI926-999 converted to SPIN301-360
OUTER_FOR (i=926; i<=999; i=i+1) BEGIN
    LAF NAME_NUM_OF_SPELL_RES STR_VAR spell_res = EVAL ~SPWI%i%~ RET spell_name spell_num END
    ACTION_IF (FILE_EXISTS_IN_GAME ~HIDESPL.2DA~) BEGIN
        COPY_EXISTING ~HIDESPL.2DA~ ~override~
            PRETTY_PRINT_2DA
            REPLACE_TEXTUALLY ~^SPWI%i% .+%LNL%~ ~~
        BUT_ONLY
    END
    COPY_EXISTING ~SPELL.IDS~ ~override~
        REPLACE_TEXTUALLY ~%WNL%~ ~%LNL%~
        REPLACE_TEXTUALLY ~^%spell_num% %spell_name%%LNL%~ ~~
    BUT_ONLY
    ACTION_IF (NOT IS_AN_INT ~%spell_name%~) BEGIN //only true if spell has IDS name (so it skips SPWI938)
        ACTION_IF (FILE_EXISTS_IN_GAME ~SPWI%i%.spl~) BEGIN
            COPY_EXISTING ~SPWI%i%.spl~ ~moreWizSlots~
            ACTION_IF (FILE_EXISTS ~override/SPWI%i%.spl~) BEGIN
                DELETE ~override/SPWI%i%.spl~
            END
            DISABLE_FROM_KEY ~SPWI%i%.spl~ //Removes file from the chitin.key, while leaving the containing bif file itself untouched
            ADD_SPELL ~moreWizSlots/SPWI%i%.spl~ 3 3 ~%spell_name%~
            ACTION_DEFINE_ASSOCIATIVE_ARRAY table_junkNumName BEGIN
                ~%spell_num%~ => ~%spell_name%~
            END
        END
    END
END

//update compiled scripts and dialogues
COPY_EXISTING_REGEXP GLOB ~.+\.DLG~ ~override~
    ~.+\.BCS~ ~override~
    DECOMPILE_AND_PATCH BEGIN
        //HaveSpell, RemoveSpell, HaveSpellParty
        REPLACE_EVALUATE CASE_INSENSITIVE ~\([A-Za-z]+Spell[A-Za-z]*(\)\(29[0-9]+\))~ BEGIN
            PHP_EACH table_junkNumName AS num => spell_name BEGIN
                PATCH_IF (IS_AN_INT ~%MATCH2%~) AND (MATCH2 = num) BEGIN
                    PATCH_PRINT ~Patching %SOURCE_FILESPEC%: %num% => %spell_name%~
                    SPRINT MATCH2 ~%spell_name%~
                END
            END
        END ~%MATCH1%%MATCH2%)~
        //SpellCast, SpellCastOnMe, SpellCastPriest, SpellCastInnate, Spell, ForceSpell, ApplySpell, ReallyForceSpell, SpellPoint, ForceSpellPoint, ReallyForceSpellPoint, SpellNoDec, SpellPointNoDec, ReallyForceSpellDead, ForceSpellRange, ForceSpellPointRange
        REPLACE_EVALUATE CASE_INSENSITIVE ~\([A-Za-z]*Spell[A-Za-z]*([^,]+,\)\(29[0-9]+\))~ BEGIN
            PHP_EACH table_junkNumName AS num => spell_name BEGIN
                PATCH_IF (IS_AN_INT ~%MATCH2%~) AND (MATCH2 = num) BEGIN
                    PATCH_PRINT ~Patching %SOURCE_FILESPEC%: %num% => %spell_name%~
                    SPRINT MATCH2 ~%spell_name%~
                END
            END
        END ~%MATCH1%%MATCH2%)~
        REPLACE_TEXTUALLY ~\(Allegiance(.*,\)ANYONE)~ ~\10)~ //workaround for weidu compiler bug
    END
BUT_ONLY

I'm thinking about implementing this code by default in EET (similar mod to BGT but for EE games) although need a confirmation that the proposed implementation is accepted by the community. Unfortunately the same change can't be done to BGT because A64 is missing in action, but the code could be implemented via Big World Setup for those who use the tool for installation.

Edited by K4thos, 22 October 2015 - 08:27 AM.


#47 Creepin

Creepin
  • Administrator
  • 1676 posts

Posted 19 October 2015 - 03:15 AM

K4thos, I'm not quite sure what are you proposing, please clarify. To move some 9 level mage spells from spells to innates? But would not it change their use from "cast as much times as memorized" to "cast as much times as allowed per day"? And what is the reason for it: from the player PoV I never faced with limits on the number of mage spells known per level (well at least since some mod (TobEX perhaps?) removed said limit).

The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)


#48 K4thos

K4thos
  • Modder
  • 315 posts

Posted 19 October 2015 - 04:47 AM

Creepin, these are not player's spells. The problem have been explained in this topic many times. To save you time, here are quotes which refer exactly to what my code aims to resolve,

The number of free level 9 spell slots are extremely limited because BG1 spammed it with various abilities. The only free slots are: SPWI966-SPWI978, and only if the .exe is patched to give spells of a higher number than 50. So I think the best solution would be to write a mini-mod that shunts all these leftover spells to SPWI0xxx/SPCLxxxx and updates the dialogues/scripts accordingly in order to free those slots. Maybe even include it to fixpack.

For now, I'm not adding these 9th level spells.
There's also the matter of HLAs. I only see about three level 9 spots available, and TDD alone adds more level 9 spells than that. For now, keeping the custom filenames of these spells seems best.
I'm willing to write a mini-mod that shunts all the BG1 SPWI9xx spells to SPWI0xx so that we free up extra slots and patch all dialogues/scripts to use the updated filenames. My question is to the wider community: if I do this, would you use this? Is this going to cause compatibility problems (such as with ScS/aTweaks)? The_Bigg: would you be willing to make an exception for ADD_SPELL to overwrite completely different level 9 spells (if their IDSentries have been shunted)? If not, do you have any alternative solution in mind?

Here are the list of affected spells:
Spoiler

2924 BERESH_CHANGE
2925 KAISHAS_CHANGE
2926 QUICK_TELEPORT
2927 SUCCUBUS_ETHEREAL
2928 SUCCUBUS_ENERGY_DRAIN
2929 SUCCUBUS_CHARM_FEMALE
2930 SUCCUBUS_CHARM_MALE
2931 SUCCUBUS_TELEPORT
2932 TANARI_CHANGE
2933 DURLAG_SWORD
2934 CRUSHING_TRAP
2935 SUMMON_SKELETON_WARRIOR3
2936 SUMMON_SKELETON_WARRIOR2
2937 SUMMON_SKELETON_WARRIOR
2939 CHARM_HERO
2940 FIREDRAKE_DAMAGE
2941 LOVEM_CHANGE
2942 QUEEN_CHANGE
2943 SIRINE_DIRE_CHARM
2944 DAESEWOLF_CHANGE
2945 LOUPGAR_CHANGE
2946 PLAYER_WEREWOLF_CHANGE
2947 GREATER_WOLFWERE_CHANGE
2948 WEREWOLF_CHANGE
2949 WOLFWERE_CHANGE
2950 FAST_SKULLTRAP
2951 JELLY_SPLIT
2952 DRADEEL_FLAMEBLADE
2953 DRADEEL_BLUE_FIREBALL
2954 DRADEEL_MINOR_GLOBE
2955 PAIN
2956 FEAR
2957 RED_FIREBALL
2958 POWERWORD_BLIND
2959 POWERWORD_STUN
2960 POWERWORD_KILL
2961 DOPPLEGANGER_CHANGE4
2962 DOPPLEGANGER_CHANGE5
2963 DOPPLEGANGER_CHANGE6
2964 DOPPLEGANGER_CHANGE7
2965 DOPPLEGANGER_CHANGE8
2979 SAREVOK_STRIKE
2980 FIREBALL_DEATH
2981 MUSHROOM_FIRE
2982 DAERRAGH
2983 RISE_FROM_ASH
2984 RED_SWIRL
2985 RED_HOLY_MIGHT
2986 SPIDER_SUMMON
2987 DOPPLEGANGER_CHANGE_DEFAULT_LESSER
2988 DOPPLEGANGER_CHANGE_DEFAULT
2989 EFFECT_ONLY
2990 DOPPLEGANGER_CHANGE3
2991 DOPPLEGANGER_RASHAD
2992 DOPPLEGANGER_CHANGE2
2993 DOPPLEGANGER_CHANGE
2994 PHASE_SPIDER_TELEPORT
2995 DRYAD_TELEPORT
2996 CHARM_KORAX
2997 GORION_LIGHTNING
2998 GORION_MAGIC_MISSILE
2999 DIETY_KILL
Without using prefixes where they are not needed, I think the name of those spells could be changed from the SPWI form into a prefixed name (using the RES version of the ForceSpell..... actions in dialogues and scripts)
It looks as though BGT and now TuTu (source) use the prefix "spki" for SPWI924 and SPWI925. I'm directing this question to the maintainers of TuTu and BGT: would it cause problems if the following list of spells would be copied over to use the "SPKI" prefix?
I'm pretty certain there would be conflicts with other mods, so we'd have to ask the maintainers of BGT/BP/ScS/aTweaks/insertanymodhere. I know there was a related issue where instead of turning into werewolves, Kaisha/Beresh summoned Dark Planetars. I'd like to know how that was solved, and we'd take a similar route.
Can you give any examples of situations where a *Spell would work but not a *SpellRES action? I can only think of two:
1) SoA does not contain all the ToB RES actions (easily fixed by patching action.ids to contain them)
2) BG1 does not recognise all the RES actions (only applies if you are modding for BG1, and even then I think it recognises most of them)
It doesn't seem to be possible to use any of the SpellCast* triggers with a RES, which is presumably why SCSII does what it does with its spell.
Anyway, I think we'll still need to assign an IDS name to all level 9 spells, regardless of how that will be accomplished.

 
I'm proposing a common solution to free 60+ slots for new level 9 spells moving existing junk to Innate, level 3 slots (it doesn't change anything) and keeping all thier IDS names, so they still work with vanilla scripts and mods. The code posted in previous post implements this solution for every game with this problem (BG1, BG2, Tutu, BGT, BG:EE, BG2:EE, EET).


Edited by K4thos, 19 October 2015 - 05:01 AM.


#49 Creepin

Creepin
  • Administrator
  • 1676 posts

Posted 19 October 2015 - 05:00 AM

Creepin, these are not player's spells.
K4thos, thanks for an explanation! Quoted above would had been enough, but details you provided are surely appreciated :)

The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)


#50 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 19 October 2015 - 05:48 AM

@K4thos: Have you proposed this to the Demi & Mike in the Spell Revision mod ? See first what they think of it. As they wish to move to the ADD_SPELL usage.

Handy thing, I will add a component that refreshes the innate spells when cast... sometime in the future to my mod.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#51 K4thos

K4thos
  • Modder
  • 315 posts

Posted 22 October 2015 - 07:53 AM

updated code to also automatically patch all compiled scripts and dialogues that need their IDS spell reference value updated (when the script/dialogue is compiled the spell name is stored as IDS num, not IDS name).

@K4thos: Have you proposed this to the Demi & Mike in the Spell Revision mod ? See first what they think of it. As they wish to move to the ADD_SPELL usage.
Will link it to Mike.

edit: with this change install order no longer matters.

Edited by K4thos, 22 October 2015 - 08:28 AM.


#52 Galactygon

Galactygon

    Modding since 2002

  • Member
  • 938 posts

Posted 17 December 2016 - 08:59 AM

Added spell IDS names from Fields of the Dead mod.

See complete list

Edited by Galactygon, 17 December 2016 - 09:00 AM.

Posted Image