Author Topic: Must have item equipped  (Read 375 times)

Legacy_archer4217

  • Full Member
  • ***
  • Posts: 206
  • Karma: +0/-0
Must have item equipped
« on: November 13, 2010, 01:46:34 am »


               Hi all,

Got another question for ya.  I have this script where you can set up a campfire but only if you're holding a torch. The generator lets you specify which hand to have the torch in...how can I modify it so it doesn't matter which hand holds the torch?

location lTarget;
object oSpawn;
object oTarget;
/*   Script generated by
Lilac Soul's NWN Script Generator, v. 2.3

For download info, please visit:
http://nwvault.ign.c...=4683&id=625    */

//Put this on action taken in the conversation editor
void main()
{

object oPC = GetPCSpeaker();

if (GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC)) == "NW_IT_TORCH001")
   {
   oTarget = oPC;

   lTarget = GetLocation(oTarget);

   oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "lje_campfire", lTarget);

   }
else
   {
   SendMessageToPC(oPC, "(You must be holding a torch to start a fire)");

   }

}

thank you for any help. '<img'>
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Must have item equipped
« Reply #1 on: November 13, 2010, 02:09:52 am »


               if ((GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC)) == "NW_IT_TORCH001") || (GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC)) == "NW_IT_TORCH001"))

The symbol || means "or" so the above means "if they have the torch in their right hand or their left hand."
               
               

               


                     Modifié par _Knightmare_, 13 novembre 2010 - 02:11 .
                     
                  


            

Legacy_archer4217

  • Full Member
  • ***
  • Posts: 206
  • Karma: +0/-0
Must have item equipped
« Reply #2 on: November 13, 2010, 02:18:12 am »


               Thank you, sweetie *hugs*