Temple+ Modding Question

Discussion in 'General Modification' started by _doug_, Feb 21, 2018.

Remove all ads!
  1. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    255
    Not that I can see, the description doesn't mention casting time increases for either Rapid or Sudden Metamagic.
     
  2. Endarire

    Endarire Ronald Rynnwrathi

    Joined:
    Jan 7, 2004
    Messages:
    982
    Likes Received:
    120
    My understanding of Sudden metamagics was that they worked like metamagic rods: No casting time increase/spell slot level increase.
     
  3. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Hi Sitra!
    I am at a loss trying to find a statistic that I thought would be somewhere in the obj_get_int realm but evades me..
    I have the need to obtain the value of a given critter (my PC in this case)'s melee attack range. I.E. if I am wielding a standard weapon with a human, I expect my reach is 5 feet, and if I am wielding a longspear, I expect 10 feet. Etc for if my PC is enlarged or reduced.. Where/how could I obtain this vital statistic through my scripts?
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    ,aybe in stats
     
  5. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    There is sadly no reach stat, but there is a GetReach function that takes the action type into consideration.
    Vanilla @ 0x100b52d0
    TP C++ has it @ LegacyCritterSystem::GetReach

    I don't believe this is currently exposed to Python.
    If you want to work your way around that, the individual pieces of the C++ code can most certainly just be re-built in Python:
    Code:
    float LegacyCritterSystem::GetReach(objHndl obj, D20ActionType actType) {
    
        float naturalReach = (float)objects.getInt32(obj, obj_f_critter_reach);
        auto protoId = d20Sys.d20Query(obj, DK_QUE_Polymorphed);
        if (protoId) {
            auto protoHandle = gameSystems->GetObj().GetProtoHandle(protoId);
            if (protoHandle) {
                naturalReach = (float)gameSystems->GetObj().GetObject(protoHandle)->GetInt32(obj_f_critter_reach);
            }
        }
    
        if (naturalReach < 0.01) {
            naturalReach = 5.0;
        }
    
        if (actType != D20A_TOUCH_ATTACK)
        {
            objHndl weapon = inventory.GetItemAtInvIdx(obj, 203);
            // todo: handle cases where enlarged creatures dual wield polearms ><
            if (weapon){
                auto weapType = objects.GetWeaponType(weapon);
                if (weapons.IsReachWeaponType(weapType)){
                    return naturalReach + 3.0f; // +5.0 - 2.0
                }
                
                return naturalReach - 2.0f;
            }
        }
        return naturalReach - 2.0f;
    }
     
  6. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Bingo, that sounds like what I was looking for. Thanks! I'll probably expose it to python.
    Hmm.. this function looks wrong. It's subtracting 2 from the reach value leading me to see a range of 3 with a weapon, which is definitely wrong, because it should be 5. Is the implementation just wrong? For what purpose is 2 subtracted?
     
    Last edited: Aug 29, 2019
  7. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Another question. Why are the condition arguments hardcoded to have a limit of 8? I hit the assert in condition.cpp when trying to use more than 8 arguments for a python modifier. Can I just increase this limit?
     
  8. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    255
    Could it be to take into account tiny creatures who have no reach at all, and must enter an enemies space to attack?
     
  9. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    If you need more args, you should probably use something different to store your data.

    I don't know about reach, that's hpw ot is in the orignal code. Maybe abstracting some radius.
     
  10. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Normally I would be clever and use bit masking to store multiple values in a single argument, but my use case that just came up was that I have around 10 different values that I need to link to radial checkboxes, and to my understanding of it, I have to link the entire arg to the checkbox and can't just use a bitmasked portion of it to share one arg for multiple links.
     
  11. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    Why do you need 10 checkboxes???
     
  12. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Mind Blade Enhancement has a bunch of different options for enhancements to your weapon (keen, lucky, collision, etc). I took a brief look through some of the ui code and it looks thoroughly complicated that it would take me weeks of understanding to hook in a new ui like the CMA&A box, so I went with a radial parent "Mind Blade Enhancement" and submenu in it with every enhancement being a checkbox that I will parse values on to control the allowed set enhancements.
     

    Attached Files:

  13. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
  14. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    What, more modifier args?
    Is there a reason the value you assert it's less than can't just be changed from 8? Would it tie into dll code and break the game?

    It's fine if that isn't done though, I made two accompanying modifiers for the feat just to manage the checkboxes and it is working as planned right now. Just about to the point that I get to do the fun part of making 12 modifiers for each of the different enhancements. Soulbreaker and great cleaving are the only ones I might have to think on. :)
     
    Last edited: Aug 31, 2019
  15. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,740
    Likes Received:
    374
    Sitra and Darkstorm are working their way up to 16-bit. Give them time.
     
Our Host!