Aller au contenu

Photo

Problem with sustainable ability


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
ZeRux

ZeRux
  • Members
  • 72 messages
I want to make a sustainable ability which will give a chance of paralysis to the user's weapon. For scripting a sustainable ability I would normally start by copying & pasting talent_modal and then removing all nAbility cases exept for my talent, but the problem it that all sustainables have their effects applied upon activation, while I need to have the effect applied when oCaster hits oTarget with a melee weapon.
I can see similar stuff is done with some header scripts such as combat_h or core_h, but I don't want to mess with those.

Alternative approach would be to get currently equipped weapon when the talent is activated with something like this:

object oWeapon = GetItemInEquipSlot(INVENTORY_SLOT_MAIN, stEvent.oCaster);

and then apply a chance of paralysis on it, but I don't know if there's a function for that.

#2
Craig Graff

Craig Graff
  • Members
  • 608 messages
You would want to use ABILITY_SPELL_FLAMING_WEAPONS in spell_modal.nss as a template. Then add an item property to itemprops.xls that looks something like this:

(Your ID#)   Paralysis (INTERNAL)    (Your Name StrId)   2    8    0    0   
0    0        0        Paralysis   0    0    0.1    0    0    0


8 is EffectParalyse in effects.xls

#3
ZeRux

ZeRux
  • Members
  • 72 messages
Thanks for the answer. My talent now works for most party members. Sadly, it doesn't work for the one it was created for - Shale (part of the Extended Shale Talents mod I'm making, to make up for its inability to use runes). Now I see that Flame/Frost weapons spells don't work on Shale either. Are there any workarounds or I'll have to come up with something else?

Also, increasing power only seems to increase duration, and not the chance of paralysis - which is what I would rather have instead.

Modifié par ZeRux, 23 juin 2010 - 09:46 .


#4
Craig Graff

Craig Graff
  • Members
  • 608 messages
Chance is going to depend on the value in the ProcChance column of the itemprps 2da. You could make several different effects and specify the one you want in the spell script. For Shale or other non-humanoid creatures to be able to use an ability the conjureanim and castanim values in ABI_base.xls have to reference animations that the creature has.

#5
ZeRux

ZeRux
  • Members
  • 72 messages
I was planning for the chance of paralysis to increase with Shale's level, and the most convenient way for that would be through few lines of code, but guess I'll have to go with 25 different effects instead.

Also, I don't know values of Shale-specific animations since its talents aren't in 2DAs but I have set values of 0 for conjureanim and 149 for castanim (same as threaten, which Shale can use).
Shale can summon the ability properly, its icon appers in the quickbar along with the proper tooltip string, but it just seems immune to all weapon-enchanting effects somehow. When I give the ability to another party member through the console and activate it, "chance of paralysis" is shown in their weapon's list of effects, but not for Shale.

#6
TimelordDC

TimelordDC
  • Members
  • 923 messages
Since Shale can't use weapons, that might be the reason. A quick look through the effect_enchantment script indicates some of the effect handlers don't work unless the item is of ITEM_TYPE_WEAPON_MELEE and/or item is in INVENTORY_SLOT_MAIN or INVENTORY_SLOT_OFFHAND.



I believe Shale uses a different inventory slot - one of INVENTORY_SLOT_SHALE_CHEST, INVENTORY_SLOT_SHALE_LEFTARM, INVENTORY_SLOT_SHALE_RIGHTARM, INVENTORY_SLOT_SHALE_SHOULDERS.



Perhaps you need to add your own code to apply the effect to Shale - sorry, can't be of more help but the lack of source files related to Shale makes this a little difficult.



Another alternative you could try and do is to use AddItemProperty and RemoveItemProperty to add/remove the paralysis property (you can extend itemprps for this but again, without Shale's sources, I am not sure what the format will be) when the ability is activated/deactivated.

Using AddItemProperty allows you to specify the POWER_LEVEL of the property so you can use some logic to derive the power level based on Shale's level.

#7
ZeRux

ZeRux
  • Members
  • 72 messages

TimelordDC wrote...

Since Shale can't use weapons, that might be the reason. A quick look through the effect_enchantment script indicates some of the effect handlers don't work unless the item is of ITEM_TYPE_WEAPON_MELEE and/or item is in INVENTORY_SLOT_MAIN or INVENTORY_SLOT_OFFHAND.

I believe Shale uses a different inventory slot - one of INVENTORY_SLOT_SHALE_CHEST, INVENTORY_SLOT_SHALE_LEFTARM, INVENTORY_SLOT_SHALE_RIGHTARM, INVENTORY_SLOT_SHALE_SHOULDERS.


Thanks alot, I didn't thought of looking in effect_enchantment!

TimelordDC wrote...

Another alternative you could try and do is to use AddItemProperty and RemoveItemProperty to add/remove the paralysis property (you can extend itemprps for this but again, without Shale's sources, I am not sure what the format will be) when the ability is activated/deactivated.


AddItemProperty/RemoveItemProperty works fine, once I replace INVENTORY_SLOT_MAIN with INVENTORY_SLOT_SHALE_RIGHTARM. Not sure if chance of paralysis is applied correctly since it isn't displayed, but when I replace it with something else like cold damage, it's correcly proportional to Shale's level.
Thanks alot again, you're the man! :)

#8
ZeRux

ZeRux
  • Members
  • 72 messages
I think I came upon another problem, unfortunately.
I created another two sustainables which should increase Shale's damage against undead and darkspawn, respectively, however itemprps.xls says those bonuses are unimplemented (IDs 1511 and 1513) and I couldn't notice any difference in-game, even though damage bonus is shown on Shale's small crystal.
Can anyone confirm if those two properties even work at all?

#9
ZeRux

ZeRux
  • Members
  • 72 messages
I came upon another problem, something I haven't thought of before: Naturally, if you unequip Shale's weapon while the talent is active, the paralysis effect needs to go away. I've tried to add the following code before case EVENT_TYPE_SPELLSCRIPT_DEACTIVATE inside void_main:

        case EVENT_TYPE_UNEQUIP:
        {
            struct EventUnequipStruct stEvent = Events_GetEventUnequipParameters(ev);

            object oWeapon = GetItemInEquipSlot(INVENTORY_SLOT_SHALE_RIGHTARM, stEvent.oCaster);
            int i = 0;
            for (i=0; i<=20; i++)
            {
                if (_HasItemProperty(oWeapon, PRP_SHL_PARALYSIS + i))
                    RemoveItemProperty(oWeapon, PRP_SHL_PARALYSIS + i);
            }
        }


but it doesn't work (fails at the first line with struct EventUnequipStruct stEvent). The toolset won't even let me go to definitions for other structures, such as EventSpellScriptDeactivateStruct to see if EventUnequipStruct and Events_GetEventUnequipParameters even exist.

Alternative way would be to browse through entire inventory when the talent is deactivated, but it doesn't seem as correct (read: optimized) way of doing things. Any hints?