Temple+ Modding Question

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

Remove all ads!
  1. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,036
    Likes Received:
    220
    No, that should work actually. I think the reason he commented it out is that it's supposed to expire after one usage, but this callback will be triggered by any query.
     
  2. _doug_

    _doug_ Established Member

    Joined:
    Jul 9, 2009
    Messages:
    209
    Likes Received:
    68
    Exactly right. That was the problem adding a skill bonus to Moment of Prescience which needed to expire after the bonus was used.

    Something similar to this should work for Camouflage (but for hide instead of diplomacy):

    def OnGetDiplomacySkill(attachee, args, evt_obj):
    evt_obj.bonus_list.add(2, 0, "Commander Armor")
    return 0

    armorCommander = PythonModifier("Armor Commander", 3) # obj_evt_id, spare, inv_idx
    armorCommander.AddHook(ET_OnGetSkillLevel, EK_SKILL_DIPLOMACY, OnGetDiplomacySkill, ())
     
  3. Shiningted

    Shiningted I want my goat back Global Moderator

    Joined:
    Oct 23, 2004
    Messages:
    12,259
    Likes Received:
    199
    This is probably obsolete but for a spell with a python skill bonus, see Analyze Dwoemer.
     
  4. Sagenlicht

    Sagenlicht Member

    Joined:
    Apr 14, 2004
    Messages:
    76
    Likes Received:
    9
    Thanks everyone for your help!

    I do have a script unreleated problem as well. When I place my files in the toee\overrides\scr and in toee\overrides\scr\tpModifiers the game does not recognize my python scripts. If I do put my scripts directly in the toee\data\src folder it does. For simple dmg spells, this wasn't a problem as they do not need a tpModifier script but now I do need them .

    I tested a bit and I think, the problem is only releated to python scripts, the spell.mes, spell_long_descriptions.mes etc. all work fine both in the overrrides or data folder no matter where I put them.

    Any tips?
     
  5. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    351
    Likes Received:
    105
    Can you be more specific? What files - conditions, or some additional utils as well?
     
  6. Sagenlicht

    Sagenlicht Member

    Joined:
    Apr 14, 2004
    Messages:
    76
    Likes Received:
    9
    all of my .py files are only recognized in the data folder, every other file I create can be put in the overrides folder and will be recognized by the game (like 1051 - Critical Strike.txt).
    Example:
    "overrides\src\Spell1051 - Critical Strike.py" does not work, "data\src\Spell1051 - Critical Strike.py" works.

    But e.g. overrides\rules\spells\1051 - Critical Strike.txt works just fine.
     
  7. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    351
    Likes Received:
    105
    Scripts folder should be named scr, not src.
     
  8. Shiningted

    Shiningted I want my goat back Global Moderator

    Joined:
    Oct 23, 2004
    Messages:
    12,259
    Likes Received:
    199
    Leving aside the fact that was obviously a typo here, definitely check for a similar typo in your game, that would do it. Still surprisingly common error we make in folder chains - forget an extra folder or misname one.
     
    anatoliy likes this.
  9. Sagenlicht

    Sagenlicht Member

    Joined:
    Apr 14, 2004
    Messages:
    76
    Likes Received:
    9
    Wow thanks for pointing that out me, now it works like a charm :) Kinda feel a bit stupid now :)

    I've started to implement a few spells, and I've got a problem with one spell. When I cast it, opponent stops doing anything until the spell is expired even though its a buff spell that targets myself. And I have no clue why at all.

    I assume its within these code lines:

    def critStrikeBonusToDamage(attachee, args, evt_obj):
    target = evt_obj.attack_packet.target
    #Check if opponent is valid target (needs to either flanked or be denied dex bonus for whatever reason and not immune to sneak attacks)
    if not target.is_category_type(mc_type_undead) or target.is_category_type(mc_type_construct) or target.is_category_type(mc_type_ooze) or target.is_category_type(mc_type_plant):
    if target.d20_query(Q_Helpless) == 1 or target.d20_query(Q_Flatfooted) == 1 or (evt_obj.attack_packet.get_flags () & D20CAF_FLANKED):
    wornWeapon = evt_obj.attack_packet.attacker.item_worn_at(3) #Get equipped mainhand weapon
    damType = wornWeapon.obj_get_int(194) #Get Weapon dmg typing
    bonusDice = dice_new('1d6') #Critical Strike Bonus Damage
    evt_obj.damage_packet.add_dice(bonusDice, damType, 3000) #ID3000 added in damage.mes
    return 0
    else:
    return 0
    return 0

    it does what it should, if opp meets the conditions, the extra damage is applied, if not, nothing gets applied, but opponent stops acting at all as long as the spell is active :( The spell gives me even mores headaches as I haven't found a way to apply keen to a weapon via python yet. I guess its simple, but I havent found it yet.

    I've attached all my little work, so if someone wants to have a look and teach me a few things it would be appreciated.

    Please note: Of the 5 spells I attached, only Sound Lance and Phantom Threat are fully working, though all spells can be placed in the folders, none does break the game. I've included a small readme to summarize it.
     

    Attached Files:

  10. Sagenlicht

    Sagenlicht Member

    Joined:
    Apr 14, 2004
    Messages:
    76
    Likes Received:
    9
    Is it possible to change the value of Inspire Courage? I tried to find a hook where I could manipulate it but neither ET_OnD20ActionOnActionFrame, EK_D20A_BARDIC_MUSIC, nor ET_OnD20ActionCheck, EK_D20A_BARDIC_MUSIC, gives me something I could work with. Bard songs trigger both hooks, but I cant work with them.
     
  11. Sagenlicht

    Sagenlicht Member

    Joined:
    Apr 14, 2004
    Messages:
    76
    Likes Received:
    9
    I have a few questions, some seem rather simple, but I can't find an answer to it.

    How do I check for weapon proficiency? The game even shows you a red frame on the item.
    Where is the weapon data stored, like what proficiency is required as you can see it if you click on the item. Only in protos.tab and the game engine handles the information passed from the file? If yes, is there something passed to python?

    What hook should I use, as this does not work: (I really assumed it would).
    Code:
    def lightfootSpellCancelAoO(attachee, args, evt_obj):
        if evt_obj.data1 == args.get_arg(2):
            attachee.float_text_line("Lightfooted")
            evt_obj.return_val = 0
        return 0
    
    lightfootSpell.AddHook(ET_OnD20Query, EK_Q_ActionTriggersAOO, lightfootSpellCancelAoO,()) 
    
    I tried to find a solution to this rather simple problem (cancel AoO while moving) but I can't get it to work.

    I assume there is at the moment no way to add targets to the spell.target_list after the list is initially generated but it would be really helpful if I understand the spell handling correctly. Would this be possible?
     
  12. Shiningted

    Shiningted I want my goat back Global Moderator

    Joined:
    Oct 23, 2004
    Messages:
    12,259
    Likes Received:
    199
    Not sure if this is what you mean, but

    pc.has_feat(x)

    where there is a full list of weapon proficiency feats in pc_start.py

    Otherwise, to read the weapon type straight off the weapon itself (where weapon type is of course directly tied to the proficiency needed), try obj.obj_get_int(obj_f_weapon_type)
     
  13. anatoliy

    anatoliy Established Member

    Joined:
    Feb 18, 2017
    Messages:
    351
    Likes Received:
    105
    I suggest checking cpp code for that. That's how it usually determined here.
     
  14. Sagenlicht

    Sagenlicht Member

    Joined:
    Apr 14, 2004
    Messages:
    76
    Likes Received:
    9
    Hey Shiningted, yeah this was was my first idea, to check what weapon feat is needed and then do simply check it by pc.has_feat.

    But then I got pretty much stuck on how to actually gain a) the feat needed for the weapon and b) actually check it, as there is more than one feat providing the proficiency, e.g a battleaxe needs either a) weapon proficiency battleaxe or b) the general martial proficiency. A long sword has even more feats that grant proficiency for it, e.g. elf or bard class proficiency. I am aware of the obj_get_int(obj_f_weapon_type) query, it returns an integer, which I would have to convert.

    I noticed, that the game actually has all the information I would need:

    Proficiency text.JPG

    The game is querying this information, if I would manage to get it, I can simply check it with pc.has_feat()
     
    Last edited: Feb 17, 2021
  15. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,036
    Likes Received:
    220
Our Host!