Aller au contenu

Photo

Figuring it out - Getting 'Strip Player' Onaction script to work


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

#1
Wall3T

Wall3T
  • Members
  • 461 messages

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));
}



#2
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

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.


  • meaglyn aime ceci

#3
Wall3T

Wall3T
  • Members
  • 461 messages

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



#4
Proleric

Proleric
  • Members
  • 2 352 messages

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.


  • Pstemarie aime ceci

#5
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

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.