Author Topic: PC Equipping Creature Item  (Read 462 times)

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
PC Equipping Creature Item
« on: November 20, 2013, 04:25:51 am »


               Is is possible to equip a creature weapon onto a PC?

I have the following command that occurs OnEnter for a specific subrace, but it doesn't seem to do anything (maybe I'm using it wrong).  The other parts of the script fire just fine.

//Give the creature weapon proficiency
if (!GetHasFeat(FEAT_WEAPON_PROFICIENCY_CREATURE, oPC))   
{
NWNXFuncs_AddFeat (oPC, FEAT_WEAPON_PROFICIENCY_CREATURE);
}

Then later, I try to equip the claws onto the PC, but it doesn't take.  The claws go into inventory and sit there.  Should I use a delay before equipping to allow the properties to be added?  Does the PC not have a creature slot?

Equipping claws:
object oBite = CreateItemOnObject ("subrace_claw", oPC);
ApplySubraceProperties (oBite, oPC); //this applies specific properties to the claws
AssignCommand (oPC, ActionEquipItem(oBite, INVENTORY_SLOT_CWEAPON_R));


Thanks!
               
               

               


                     Modifié par BelowTheBelt, 20 novembre 2013 - 06:49 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
PC Equipping Creature Item
« Reply #1 on: November 20, 2013, 07:49:24 pm »


               Not sure what is up.  This code (when run by the player) works

void main()
{
object oSkin = CreateItemOnObject("NW_IT_CREITEMDRM");
object oClaw = CreateItemOnObject("NW_IT_CREWPSP011");
SetIdentified(oClaw, TRUE);
ActionEquipItem(oSkin, INVENTORY_SLOT_CARMOUR);
ActionEquipItem(oClaw, INVENTORY_SLOT_CWEAPON_R);
}

Notice that I used an existing skin with the creature weapon proficiency item property already on it.  I tried adding the feat using the standard feat index, but ItemPropertyBonusFeat() did not recognize it.  I was able to copy this property from one item to another. Not sure what NWNXFuncs does, but it may also be blocked from creating such a feat.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
PC Equipping Creature Item
« Reply #2 on: November 20, 2013, 08:11:10 pm »


               I've found it.  I accidentally used FEAT_WEAPON_PROFICIENCY_CREATURE when I should have used IP_CONST_FEAT_WEAPON_PROF_CREATURE.  See if that works in NWNXFuncs for that function.

Edit: guess this wasn't a bad row.
               
               

               


                     Modifié par WhiZard, 20 novembre 2013 - 08:26 .
                     
                  


            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
PC Equipping Creature Item
« Reply #3 on: November 20, 2013, 10:53:18 pm »


               thanks for that.  Do you know if IP_CONST_FEAT... is a 'feat' or an item property that applies a feat?  Is there a difference?
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
PC Equipping Creature Item
« Reply #4 on: November 20, 2013, 11:45:02 pm »


               The IP_CONST_FEAT_* are integers just like FEAT_* constants.  The IP variety references iprp_feat.2da (which indirectly references feat.2da) while the other directly references feat.2da.  A function cannot take both constant sets into consideration (as there is overlap) so the constant set it uses is based on how the function is defined.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
PC Equipping Creature Item
« Reply #5 on: November 21, 2013, 12:01:57 am »


               nwnxfuncs_addfeat requires FEAT_* constant
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
PC Equipping Creature Item
« Reply #6 on: November 21, 2013, 12:36:57 am »


               Thanks, that means that the problem is with the _addfeat instruction.  It is either not called due to a problem with the script, or incorrectly declared, or unable to support this feat.  That is if the statement "but it doesn't seem to do anything" refers to looking at the character sheet for the feat or trying to equip the creature weapon manually by quickslots.

The other relevant alternative is that the creature weapon appears but is not identified.  The script can handle this with SetIdentified(oItem, TRUE).
               
               

               


                     Modifié par WhiZard, 21 novembre 2013 - 12:37 .
                     
                  


            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
PC Equipping Creature Item
« Reply #7 on: November 21, 2013, 02:05:26 am »


               Interesting...

I'm going to presume operator error here more so than a failing of the function.  The item is set as identified in the palette.

However, I do have custom level requirement system that might be blocking it, since the addition of the powers would affect the value of the item, possibly pushing it beyond the limits of the ILR.  I'll try to equip them without the powers and see if that works.

Thanks for the help.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
PC Equipping Creature Item
« Reply #8 on: November 21, 2013, 05:18:20 am »


               When it fails does the item have a red (cannot equip) or white (can equip) background?  Does the character sheet display creature weapon proficiency in feats tab?