Author Topic: Player Tool Custom Feats  (Read 9754 times)

Offline 420

  • Hero Member
  • *****
  • Posts: 4087
    • View Profile
    • Email
Player Tool Custom Feats
« on: June 04, 2009, 04:48:56 PM »
I was showing off the 1.69 Player Tool custom feats in the CEP team meeting yesterday and I was asked to post details about how it worked. Thought I may as well post it here too:

Here is a quick tutorial on how the Player Tool custom feats work:

There are 10 DM tools and 10 Player tools each with an entry in feat.2da, iprp_feats.2da and spells.2da. There is also a script associated with each one: x3_dm_tool## and x3_pl_tool## (## = 01 - 10). Player Tools can only be added to PCs, DM Tools can only be added to DMs. (I use the player tools because our DMs don't use the DM client.)

First, add the feat to the PC's creature hide. Bioware's horse riding system creates this item (tag/resref "x3_it_pchide"), equips it to the PC's Creature Armor slot and adds the horse riding feats to it. If you don't use the horse riding system you'll have to create/equip this item on the PC.

In OnClientEnter the entering object (the PC) should execute this script after the horse riding code: (This also checks for a valid creature hide and creates/equips one if necessary.)
Code: [Select]
void main()
{
    object oPC = OBJECT_SELF;
    object oSkin = GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC);

    //if oSkin is not valid create/equip a new skin
    if(!GetIsObjectValid(oSkin))
        {
        oSkin = CreateItemOnObject("x3_it_pchide", oPC);
        AssignCommand(oPC, ActionEquipItem(oSkin, INVENTORY_SLOT_CARMOUR));
        }

    //item property from iprp_feats.2da line 53 PLAYER_TOOL_01
    itemproperty ipPlayerTool = ItemPropertyBonusFeat(53);
    AddItemProperty(DURATION_TYPE_PERMANENT, ipPlayerTool , oSkin);
}
The feat "Player Tool 1" will show up on the PC's radial menu, where the horse commands are, which can then be added to a quickslot. (See attached pic at the bottom.)


Then open the script x3_pl_tool01 and add whatever code you want. Here is a template with some pre-defined variables:
Code: [Select]
//::///////////////////////////////////////////////
//:: Player Tool 1 Instant Feat
//:: x3_pl_tool01
//:: Copyright (c) 2007 Bioware Corp.
//:://////////////////////////////////////////////
/*
    This is a blank feat script for use with the
    10 Player instant feats provided in NWN v1.69.

    Look up feats.2da, spells.2da and iprp_feats.2da

*/
//:://////////////////////////////////////////////
//:: Created By: Brian Chung
//:: Created On: 2007-12-05
//:://////////////////////////////////////////////

void main()
{
object oPC = OBJECT_SELF;
object oTarget = GetSpellTargetObject();
location lTarget = GetSpellTargetLocation();

//Add code here
}

To detect this custom feat on a PC use this (I made it into a conversation "Text Appears When..." check):
Code: [Select]
int StartingConditional()
{
int iResult = FALSE;
//feat from feat.2da line 1106 PLAYER_TOOL_01
if(GetHasFeat(1106, GetPCSpeaker()))
    {
    iResult = TRUE;
    }
return iResult;
}
And that's the basics.

Advantages over Activate Item/Unique Power Tag-Based Items
  • It's instant, that is, the PC won't do any "activation" animations (though they could be added through scripting)
  • It's not restricted by "rounds", that is, the PC won't have to wait 6 seconds between activations
  • PCs no longer need tag-based items to get their custom sub-race powers (like darkness for the Drow)
Player Tool Framework
The Krit put together an amazing package that allows builders to easily restrict the player tool custom feats by skill, feat or class:
Player Tool Framework by The Krit

Have fun,
420

[attachment deleted by admin]