Author Topic: Figuring it out - Getting 'Strip Player' Onaction script to work  (Read 392 times)

Legacy_Wall3T

  • Hero Member
  • *****
  • Posts: 748
  • Karma: +0/-0
Figuring it out - Getting 'Strip Player' Onaction script to work
« on: November 05, 2015, 11:23:06 pm »


               

Hi!


 


so im going to be really short about this. this is a script i found on the NWNWikia Page (located here: http://nwn.wikia.com...plete_inventory


 


it says its suppose to strip a player of everything through a Onenter function (Tab?) it seems to work fine as a trigger, but i wanted to adapt this to a conversation Actions Taken Function (or Tab?)


 


random Ex: a Player (PC) wants to strip every item in there inventory through a NPC (creature). they are given a 'yes' or 'no' answer. 'yes' would strip everything, picking 'no' .... well you get the idea!


 


It seems when i place  this script into the Actions Taken function (or tab?) it doesnt seem to work. Could this work on a conversation dialogue?


 


or would I need to change/tweak the coding? and what would i need to do to make this work through a conversation dialogue?


 


void main()
{
int nSlot;

object oPC = GetEnteringObject(); // Change this line for use in other events.
// Make sure oPC is a PC (not necessary in a module's OnClientEnter).
if ( !GetIsPC(oPC) )
return;

 
// Destroy the items in the main inventory.

object oItem = GetFirstItemInInventory(oPC);
while ( oItem != OBJECT_INVALID ) {

DestroyObject(oItem);

oItem = GetNextItemInInventory(oPC);
}
// Destroy equipped items.
for ( nSlot = 0; nSlot < NUM_INVENTORY_SLOTS; ++nSlot )

DestroyObject(GetItemInSlot(nSlot, oPC));

 
// Remove all gold.

AssignCommand(oPC, TakeGoldFromCreature(GetGold(oPC), oPC, TRUE));
}



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Figuring it out - Getting 'Strip Player' Onaction script to work
« Reply #1 on: November 05, 2015, 11:43:19 pm »


               

Try this - as with the OnclientEnter, you don't need to check if oPC is a PC...


 



   Spoiler
   


 


P.S. You guys also need to stop using all these odd colors to highlight stuff. If you use the dark grey background like I do, you can't ever see the colored text.



               
               

               
            

Legacy_Wall3T

  • Hero Member
  • *****
  • Posts: 748
  • Karma: +0/-0
Figuring it out - Getting 'Strip Player' Onaction script to work
« Reply #2 on: November 06, 2015, 12:43:06 am »


               

sounds good. thanks for the quick response, it really helps me alot here. Pretty soon i should have something to show everyone!



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Figuring it out - Getting 'Strip Player' Onaction script to work
« Reply #3 on: November 06, 2015, 10:30:24 am »


               

For general use, I'd recommend one small change:


 


{if (nSlot != INVENTORY_SLOT_CARMOUR) DestroyObject(GetItemInSlot(nSlot, oPC));}

 


You probably don't want to remove the skin, as that will break the horse system (and some bespoke systems, too).


 


You might want to remove all unwanted item properties from the skin, I suppose.



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Figuring it out - Getting 'Strip Player' Onaction script to work
« Reply #4 on: November 06, 2015, 01:15:06 pm »


               


For general use, I'd recommend one small change:



{if (nSlot != INVENTORY_SLOT_CARMOUR) DestroyObject(GetItemInSlot(nSlot, oPC));}

You probably don't want to remove the skin, as that will break the horse system (and some bespoke systems, too).


 


You might want to remove all unwanted item properties from the skin, I suppose.




 


Nice catch. I forgot about the skin.