How to implement something like the Warmage's Eclectic Learning?

Discussion in 'General Modification' started by radthemad4, Dec 10, 2020.

Remove all ads!
  1. radthemad4

    radthemad4 Member

    Joined:
    Aug 4, 2016
    Messages:
    2
    Likes Received:
    0
    I'm buffing the Warmage for my own game and I'd like to try to implement something like the Eclectic Learning ACF, but buffed slightly, i.e. when using Advanced Learning, instead of an evocation spell, the Warmage can learn any Wizard spell but it has to be one spell level lower than the current max if it's not an evocation. How would I change the condition here to achieve something like that? Also, any plans on implementing the actual version of eclectic learning on a future version of ToEE?

    Code:
    def IsAdvancedLearningSpell(obj, spell):
        spEntry = tpdp.SpellEntry(spell.spell_enum)
      
        #Don't add spells that are already known to the list
        if obj.is_spell_known(spell.spell_enum):
            return False
      
        #First get rid of everything in the warmage spell list
        for level, spell_list_level in spell_list.items():
            if spell.spell_enum in spell_list_level:
                return False
          
        #Next, get rid of everything that is not evocation
        if spEntry.spell_school_enum == Evocation: # or the spell is one level lower than the current max
            return True
      
        return False
    
    Sorry, I don't have any experience in modding ToEE. How can I find out more about the fields and methods available to stuff like spEntry or spell or tpdp, etc.?
     
    Last edited: Dec 10, 2020
  2. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,654
    Likes Received:
    352
    The lists of spell_obj and spell.id_obj stuff I found is no use to you so I won't post it. What I will say: imho, what you want is spell.caster_level (which is the level of the caster, I'm pretty sure, or effectively the level of the current caster) and then you can work out one level lower from there.

    EDIT: 4 years for first post, awesome! :)
     
  3. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    635
    Likes Received:
    200
    Take a look here: scr.builtin. It is API of ToEE and T+ which I have created for myself.
    Also this one: constants.py
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    @Shiningted you are thinking in terms of PySpell object, the spell here is of type KnownSpellInfo (which is used specifically for the spell UI).

    @op Temple+ adds two new builtin python modules, called tpdp and char_editor.
    They are defined here:
    https://github.com/GrognardsFromHell/TemplePlus/blob/master/TemplePlus/python/python_dispatcher.cpp
    https://github.com/GrognardsFromHell/TemplePlus/blob/master/TemplePlus/ui/ui_char_editor.cpp
    There you can see all the fields and funcs exposed to python, and add new engine-side methods if necessary.

    Edit: KnownSpellInfo is a 3rd type of spell related struct, I was thinking of SpellStoreData.
     
    Last edited: Dec 10, 2020
    radthemad4 and anatoliy like this.
  5. radthemad4

    radthemad4 Member

    Joined:
    Aug 4, 2016
    Messages:
    2
    Likes Received:
    0
    Thank you! Looking at those, I could figure this out which seems to do what I want (this isn't how Eclectic Learning actually works as published. I may or may not attempt to figure that out later, but no promises)

    Code:
        #Next, get rid of everything that is not evocation or a max spell level spell
    
        classLvl = obj.stat_level_get(classEnum)
        maxSpellLvl = char_editor.get_max_spell_level( obj, classEnum, classLvl + 1 )
    
        if spEntry.spell_school_enum == Evocation or spell.spell_level < maxSpellLvl:
            return True
    
    I'm surprised myself. I tried to make an account today and apparently I already had one.


    Thanks, that's handy for finding out methods and members for stuff, though I think I'll probably need to look at the cpp stuff sometimes too
     
Our Host!