Temple+ New Feats

Discussion in 'General Modification' started by WinstonShnozwick, Sep 18, 2016.

Remove all ads!
  1. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    I was able to drop/throw the mind blades and pick them back up and keep using them. OF_OFF did nothing.
     
  2. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    If the plan is to throw the weapon, calculate damage and have the weapon destroy itself, OF_off is the wrong command you'll need to obj.destroy the weapon.

    OF_off was the reason Smigmal Redhand became a blue circle that wouldn't end combat, and NPC's would vanish and leave behind blue circles that follow you around. OF_off doesn't destroy things, it just turns things off.
     
  3. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Am I able to put that in the protos.tab entry?
     
  4. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    Umm in a script, sure. Since the weapon would only be thrown in combat, you could write a script for the item to check if the weapon is held - if not it's on the floor and should be destroyed, and attach it to the weapons san_combat script hook? Since you make a new one every round anyway, you don't need to bring it back.
     
  5. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    Do you mean in san_remove? Did you out a script number there or just plain OF_OFF? The latter won't work...
     
  6. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    in san_whatever works, if the weapon isn't in the soulknife's hand at the end of the soulknife's turn it must be on the floor, and should be destroyed, right?

    Scripting isn't my favourite past time, as I'm not a professional coder, and most of my scripts fail entirely most of the time, much to my frustration.
     
  7. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    The latter.
    Is there an existing example of this sort of thing being done?
     
  8. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    The disintegrate spell destroys the target of the spell.
     
  9. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    For adding a script number? Allyx gave the instructions in this thread.
    You'll need to put a san_remove script somewhere, probably best to create a new entry. See any if the numbered scripts in the scr folder for examples.
     
  10. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    :eek::eek::eek:

    Mind Blade and Shape Mind Blade are to my knowledge release ready. That was exciting.
     
    Allyx and Sitra Achara like this.
  11. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    If I add another arg to the object.cpp function of item_unwield, it won't break existing uses of it that don't use a second arg, right?
    I want to add a second optional arg so I can choose to simply call remove(item) instead of unwield, so it doesn't go through the inventory, in the case of equipped mind blades and a full inventory.

    Given
    Code:
    static PyObject* PyObjHandle_Unwield(PyObject* obj, PyObject* args) {
        auto self = GetSelf(obj);
        if (!self->handle) {
            Py_RETURN_NONE;
        }
    
        int es;
        if (!PyArg_ParseTuple(args, "i:objhndl.item_worn_unwield",  &es)) {
            return 0;
        }
    
    
        if (es >= EquipSlot::Count || es < 0)
            es = EquipSlot::Invalid;
        auto equipSlot = (EquipSlot)es;
    
        inventory.ItemUnwield(self->handle,  equipSlot);
        Py_RETURN_NONE;
    }
    I think I can just put another int into the parsetuple function and check that. I just don't understand how the characters before objhndl. in every parsetuple call work. They seem to be based on the argument types, but I don't know what they are supposed to be. stuff like "O|ii" or whatever.
     
  12. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
  13. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Switched to itemdrop instead of remove and it works fine. Added to my pull request.

    I'm having an issue with giving damage/to hit bonuses to my dual mind blade proto. I tried originally giving it weapon enhancement bonus, then to hit bonus instead, like rusty weapons, but those made the weapon glow despite the first modifier that should have removed the glow. So now I'm trying to add this modifier instead to hopefully prevent glow while having the -1 enhancement bonus (attack and damage rolls). In game, there are two problems. First, it gives the bonus twice if I'm holding mind blades, as in my primary is subtracted for its weapon as well as the secondary weapon, and vica verca, which shouldn't happen. Second, the damage bonus isn't showing up at all in the rolls or being added. I'd like to be able to make it so the weapon modifier only affects the primary or offhand where it is held, not both for being held in either.

    Code:
    # this is the modifier to be applied to dual blades in protos.tab
    def DualBladeDamage(attachee, args, evt_obj):
        evt_obj.bonus_list.add_from_feat(-1, 0, 114, "Shape Mind Blade")
        evt_obj.return_val += -1
        return 0
      
    def DualBladeToHit(attachee, args, evt_obj):
        evt_obj.bonus_list.add_from_feat(-1, 0, 114, "Shape Mind Blade")
        evt_obj.return_val += -1
        return 0
    
    mindBladeDual = PythonModifier("Mind Blade Dual", 0)
    mindBladeDual.AddHook(ET_OnDealingDamage, EK_NONE, DualBladeDamage, ())
    mindBladeDual.AddHook(ET_OnToHitBonus2, EK_NONE, DualBladeToHit, ())
     
    Last edited: Nov 23, 2016
  14. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    You're not applying the damage bonus correctly (use damage_packet).

    For preventing double bonus, you should check the weapon_used and compare against item_worn_at(3) and (4).
     
  15. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    I think this will read in the new weapon type correctly.
    Code:
    if (field == obj_f_weapon_type){
                auto asdf = 1;
                if (!_strcmpi(content, "wt_mindblade")) {
                    auto obj = objSystem->GetObject(handle);
                    obj->SetInt32(field, WeaponTypes::wt_mindblade);
                }
    I tested it and the mind blades were all considered unproficient in game, which is good. I can make wt_mindblade simple weapon in weapon.cpp to fix that.

    The issue though, that also happened before this, is that the attack animations and impact sounds being used by the mind blades were not those associated with the weapon they are mimicking (short sword, ls, and bs). Instead, they made punching animations and used sounds from gauntlet (initial value it was set to when wt_mindblade wasn't read I assume), and after, game crash when I try to attack. How can I associate the attack animations and sounds as desired?
     
Our Host!