Question dealing more with modding?

Jimbo

Distinguished
Feb 20, 2004
390
0
18,780
Archived from groups: alt.games.neverwinter-nights (More info?)

I am working on module for NWN HOU and was wondering if there is a way
(script) that would allow one of my NPC's to steal a characters
weapon,armour,etc and then use it against them.
 
G

Guest

Guest
Archived from groups: alt.games.neverwinter-nights (More info?)

Jimbo wrote:
> I am working on module for NWN HOU and was wondering if there is a way
> (script) that would allow one of my NPC's to steal a characters
> weapon,armour,etc and then use it against them.

This wouldn't be hard to script.

Here's a sample script that makes an NPC steal a PC's armor and then equip it.

The only caveat is, obviously, what is the rationale for the NPC being able to do this? It's got to be some type of
magical power, cause worn armor certainly couldn't be pickpocketed!

Hopefully the lines don't wrap when I post this.

void main()
{
// I tested this function by putting it in a conversation, thus the lines
// here getting the PC and NPC involved are appropriate. You will want to
// change them depending on how you are aquiring the PC and NPC involved
object oPC = GetPCSpeaker ();
object oNPC = OBJECT_SELF;

// Here we acquire the PC's currently equipped armor. If they're not
// wearing any - the NPC is disappointed and we exit.
object oArmor = GetItemInSlot (INVENTORY_SLOT_CHEST, oPC);
if (!GetIsObjectValid (oArmor))
{
AssignCommand (oNPC, ActionSpeakString ("Drat! Foiled again!"));
return;
}

// The PC had armor so we're in business. Make sure the NPC isn't wearing
// any armor and have them take it off if so
object oNPCArmor = GetItemInSlot (INVENTORY_SLOT_CHEST, oNPC);
if (GetIsObjectValid (oNPCArmor))
AssignCommand (oNPC, ActionUnequipItem (oNPCArmor));

// We can't really transfer items unless we go through the trouble of
// having the PC drop something and then the NPC pick it up (along with all
// the animations this would produce), so we fake it by copying the PC's
// armor for the NPC and then destroying the original
object oNewArmor = CopyItem (oArmor, oNPC, TRUE);
if (GetIsObjectValid (oNewArmor))
{
AssignCommand (oNPC, ActionEquipItem (oNewArmor, INVENTORY_SLOT_CHEST));
DestroyObject (oArmor);
AssignCommand (oNPC, ActionSpeakString ("Ha! What was yours is now mine!"));

// At this point in the script, if this were a magical effect, I would
// display some visual effects on both the PC and NPC. I'll leave that
// to your discretion
}
}
--
My NWN Work So Far: http://tinyurl.com/6xy2f
"Pits of red smoke and fog are usually bad."
- Tip from Doom3 Manual
 
G

Guest

Guest
Archived from groups: alt.games.neverwinter-nights (More info?)

On Sat, 18 Dec 2004 00:14:50 -0500, "Jimbo"
<simjimbo2004@bellsouth.net> wrote:

>I am working on module for NWN HOU and was wondering if there is a way
>(script) that would allow one of my NPC's to steal a characters
>weapon,armour,etc and then use it against them.

Look at the script for the mimic.