Player Resource Consortium

 

Author Topic: Shape Changing  (Read 5241 times)

0 Members and 1 Guest are viewing this topic.

September 28, 2011, 07:29:47 AM
  • Adept
  • *
  • Posts: 21
  • Karma: +0/-0
  • New Member
    • View Profile

Sorry for all the posts but you guys are the few people I know that are still around in NWN and having just come back I'm having to relearn a fair bit. I've made several feats for our werewolf race that handle all the shapeshifting parts of the race although the initial shapeshifting works I can't seem to get "cancel polymorph" button to show up on the menu is there something I need to add to the script? the current script I'm using is a modified wildshape one which looks like:

Code: [Select]
#include "x2_inc_itemprop"
#include "x3_inc_horse"

void main()
{
    //Declare major variables
    int nSpell = GetSpellId();
    object oTarget = GetSpellTargetObject();
    effect eVis = EffectVisualEffect(VFX_IMP_POLYMORPH);
    effect ePoly;
    int nPoly;
    int nDuration = DURATION_TYPE_PERMANENT;
    if (!GetLocalInt(GetModule(),"X3_NO_SHAPESHIFT_SPELL_CHECK"))
    { // check to see if abort due to being mounted
        if (HorseGetIsMounted(oTarget))
        { // abort
            if (GetIsPC(oTarget)) FloatingTextStrRefOnCreature(111982,oTarget,FALSE);
            return;
        } // abort
    } // check to see if abort due to being mounted

    //Determine Polymorph subradial type
    if(nSpell == 840)
    {
        nPoly = POLYMORPH_TYPE_WOLF;
    }
    else if (nSpell == 841)
    {
        nPoly = POLYMORPH_TYPE_WEREWOLF;
    }
    else if (nSpell == 842)
    {
        nPoly = POLYMORPH_TYPE_DIRE_WOLF;

    }
    ePoly = EffectPolymorph(nPoly);
    ePoly = ExtraordinaryEffect(ePoly);
    //Fire cast spell at event for the specified target
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_WERE_SHAPE, FALSE));

    int bWeapon = StringToInt(Get2DAString("polymorph","MergeW",nPoly)) == 1;
    int bArmor  = StringToInt(Get2DAString("polymorph","MergeA",nPoly)) == 1;
    int bItems  = StringToInt(Get2DAString("polymorph","MergeI",nPoly)) == 1;

    object oWeaponOld = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,OBJECT_SELF);
    object oArmorOld = GetItemInSlot(INVENTORY_SLOT_CHEST,OBJECT_SELF);
    object oRing1Old = GetItemInSlot(INVENTORY_SLOT_LEFTRING,OBJECT_SELF);
    object oRing2Old = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,OBJECT_SELF);
    object oAmuletOld = GetItemInSlot(INVENTORY_SLOT_NECK,OBJECT_SELF);
    object oCloakOld  = GetItemInSlot(INVENTORY_SLOT_CLOAK,OBJECT_SELF);
    object oBootsOld  = GetItemInSlot(INVENTORY_SLOT_BOOTS,OBJECT_SELF);
    object oBeltOld = GetItemInSlot(INVENTORY_SLOT_BELT,OBJECT_SELF);
    object oHelmetOld = GetItemInSlot(INVENTORY_SLOT_HEAD,OBJECT_SELF);
    object oShield    = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,OBJECT_SELF);
    if (GetIsObjectValid(oShield))
    {
        if (GetBaseItemType(oShield) !=BASE_ITEM_LARGESHIELD &&
            GetBaseItemType(oShield) !=BASE_ITEM_SMALLSHIELD &&
            GetBaseItemType(oShield) !=BASE_ITEM_TOWERSHIELD)
        {
            oShield = OBJECT_INVALID;
        }
    }




    //Apply the VFX impact and effects
    ClearAllActions(); // prevents an exploit
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ePoly, OBJECT_SELF, HoursToSeconds(nDuration));

    object oWeaponNew = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,OBJECT_SELF);
    object oArmorNew = GetItemInSlot(INVENTORY_SLOT_CARMOUR,OBJECT_SELF);

    if (bWeapon)
    {
            IPWildShapeCopyItemProperties(oWeaponOld,oWeaponNew, TRUE);
    }
    if (bArmor)
    {
        IPWildShapeCopyItemProperties(oShield,oArmorNew);
        IPWildShapeCopyItemProperties(oHelmetOld,oArmorNew);
        IPWildShapeCopyItemProperties(oArmorOld,oArmorNew);
    }
    if (bItems)
    {
        IPWildShapeCopyItemProperties(oRing1Old,oArmorNew);
        IPWildShapeCopyItemProperties(oRing2Old,oArmorNew);
        IPWildShapeCopyItemProperties(oAmuletOld,oArmorNew);
        IPWildShapeCopyItemProperties(oCloakOld,oArmorNew);
        IPWildShapeCopyItemProperties(oBootsOld,oArmorNew);
        IPWildShapeCopyItemProperties(oBeltOld,oArmorNew);
    }

}


September 29, 2011, 06:52:05 AM
Reply #1
  • Hero Member
  • *****
  • Posts: 1439
  • Karma: +27/-0
  • Gender: Male
    • View Profile

I've just tested the script - cancel polymorph button doesn't appear only if you set second parameter in EffectPolymorph() to true:
ie. ePoly = EffectPolymorph(nPoly, TRUE);

but that's not the case :/


September 29, 2011, 08:28:13 AM
Reply #2
  • Adept
  • *
  • Posts: 21
  • Karma: +0/-0
  • New Member
    • View Profile

so I just need to include that where I'm defining all the other intergers and it should work?


September 29, 2011, 08:39:54 AM
Reply #3
  • Hero Member
  • *****
  • Posts: 1439
  • Karma: +27/-0
  • Gender: Male
    • View Profile

No, that was just an example.
Your script is fine. I have no clue why "Cancel polymorph" button doesn't appear on the radial menu.


September 29, 2011, 08:41:58 AM
Reply #4
  • Adept
  • *
  • Posts: 21
  • Karma: +0/-0
  • New Member
    • View Profile

ahh thanks ^^ I've probably done something wrong elsewhere then thanks ^^


September 29, 2011, 08:51:23 AM
Reply #5
  • Adept
  • *
  • Posts: 21
  • Karma: +0/-0
  • New Member
    • View Profile

Got it working now ^^ I made a new script and it works fine ^^