Mage->Sorc. Script - Auto-Spell Removal Question
syllog
Member Posts: 158
Trying to work around inability to dual/multi sorc.s.
Easiest way (though crass) I found is to just use a wizard, increase spell slots, then memorize 6 copies of each "known" spell. Manually keep track of castings for each level so you don't go over.
Keeping track is a bit boring however. I'd like to write a script that just removes one instance of every other spell of a given level when a spell is cast; something like this:
~~~
IF
... Repeat for every spell.
~~~
I'm *totally* new to scripting with BG though.
What kind of function could do this?
Alternatively are there any functions that I could call to return the number of memorized instances of spells? (Then running a similar routine whenever number of memorized spells isn't always equal.)
Any help much appreciated!!!
Easiest way (though crass) I found is to just use a wizard, increase spell slots, then memorize 6 copies of each "known" spell. Manually keep track of castings for each level so you don't go over.
Keeping track is a bit boring however. I'd like to write a script that just removes one instance of every other spell of a given level when a spell is cast; something like this:
~~~
IF
Cast(WIZARD_spellname1) //???"Cast" is a made up function. What function could detect castingTHEN
RESPONSE #100ENDRemoveSpell(WIZARD_spellname2)
RemoveSpell(WIZARD_spellname3)
RemoveSpell(WIZARD_spellname4)
RemoveSpell(WIZARD_spellname5)
... Repeat for every spell.
~~~
I'm *totally* new to scripting with BG though.
What kind of function could do this?
Alternatively are there any functions that I could call to return the number of memorized instances of spells? (Then running a similar routine whenever number of memorized spells isn't always equal.)
Any help much appreciated!!!
0
Comments
I appreciate the suggestion, but (a) because of hardcoding limits that's not possible to a large extent (e.g. you can't access both spells and thief skills for a sorc.) and (b) I don't think that this is especially complicated, per se.
List of actions: http://gemrb.org/iesdp/scripting/actions/bg2actions.htm
List of spells: http://gemrb.org/iesdp/files/ids/bg2/spell.htm
Specifically: I think though that you can only have 12 spells memorized, so your idea would be a no-go anyway.
Scripting aside, have you tried creating a multiclass (e.g. fighter/mage) and then changing the mage class to sorcerer in EE Keeper?
Thanks so much; that's a big help!
As for only being able to memorize 12 spells: no. I've already played with a dualed "sorc". I don't know what the limit is, but I've had as many as 41 lvl 1 spells memorized (6 copies of each spell and 11 copies of an unused spell; the unused spell just acting in the casting bar).
So it definitely works; it just (currently) requires manual accounting.
You cannot make a multi/dual class sorcerer even with EEKeeper or Near Infinity. It's hard coded in the engine.
Thanks again. Hopefully try some scripting out tonight!
My suggestion would be: Use a normal sorcerer class and add scripts that change the sorcerer’s HP, base THAC0, save throws, number of attacks, proficiency slots once certain levels of XP are reached.
The script works beautifully and universally ... when it works at all.
The problem is that is you display spells before the script has finished it doesn't remove spells.
And, in some cases, if you move before the spell casting animation finishes the script doesn't run.
I assume (but don't know) that this is because your input is causing the script to rerun from the beginning before triggering it's responses.
This would be useful for AI - but not for bookkeeping.
Is there a way to get a read out of the number of spells spent? That would allow a simple, utilitarian work around this.
@waehuun
I think it's a great idea, personally. I looked into making a normal sorcerer class + benefits but it get's ugly quickly. Most importantly -- you can't use thieving skills.
Typo. Should have been "can't".
The classes and *class combinations* are hard coded.
So, for example, you can't have both thieving skills and sorcerer spell mechanics. All the modding you want with EEKeeper or IE won't change that. It's hard coded. Similarly, you can mock-up a fighter sorcerer, but it won't have warrior weapons selection. You can add in the thief epic ability to use all weapons and then self-restrict, but it's ugly.
A script would make for a very simple, low-effort way to multi/dual class sorcerer's by essentially turning wizards into sorcerer's. And it would be totally compatible with any mods (e.g. SCS) because it doesn't affect any of the existing classes.
I'm not really sure why this is. It's almost like the spell is no longer considered cast by the player if they move - thus breaking the trigger.
There's no pretty way that I can find to count spells in order to simply make them equal. (Some really ugly ways; but not worth it.)
If anyone has advice - it's welcome!
As it is the script works if you cast and wait for animation to finish/1-2seconds to pass.
But if, for example, you issue a new order when the game auto-pauses on spell casting the script doesn't register.
*This is a trigger issues. The same problem is true for other actions (e.g. StartRainNow() )*
The delay you mentioned is probably a result from the fact that the game engine runs through the script blocks about every 1–2 seconds. If you issue a new command before the script takes notice of the spell being cast, CastSpell(•) is not the current state of the actor anymore when the script finally runs.
Maybe this workaround would help. Edit all spells such that they increase a local variable on the caster (EG: SY#CAST2 = 1 means that a level 2 spell has been cast). Let the script check whether or not the specific local variables are set to 1. If so, delete spells and set the variable back to 0.
Yes, memorization is purely self limited. You could learn all spells if you wanted. But you could do that anyway and add invulnerability to all damage while you're at it. You also only need to set-up your memorizations at level up and then you can just leave them alone till next level up (/level drain).
I didn't realize that I could add a global variable increment to the spell itself! That sounds like it would solve the problem.
Hmmm... making a new global for every spell in the game sounds irksome. But I suppose I could just create a variable for every spell level and have the spell refresh itself once cast to keep the math tidy...
(The only remaining issue would be a workaround for interrupted spells. Depending on when scripts for spells start running that could be easy...)
Probably won't get to work on this for a bit due to occupational tasks, but look forward to coming back to it.
Thanks!
Regarding interrupted spells … that might be a problem.