Author Topic: Creating a talking, non-equippable item?  (Read 434 times)

Legacy_Shigura

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Creating a talking, non-equippable item?
« on: December 18, 2010, 04:08:33 pm »


               After nearly a week of hunting up scripts for a new mod I'm creating, I'm just about ready to give up.

You see, in my mod, the player finds an item called the "Elven Chalice". When the item's unique power is used, a glowing elf appears before the player and speaks to him/her.

I'm using tag-based scripting, but nothing seems to be working for me. Would someone be able to tell me what is wrong with this script?

The Chalice's tag is "ElvenChalice".
The Woman's tag is "ElvenChalice_Woman".
The Script was named "elvenchalice".

"#include "x2_inc_switches"
void main()
{
           object oPC   = GetItemActivator(); 
           object oItem = GetItemActivated();
           object oChalice = GetObjectByTag("ElvenChalice_Woman");
           location lTarget = GetItemActivatedTargetLocation();
            CreateObject(OBJECT_TYPE_CREATURE, "ElvenChalice_Woman", lTarget, FALSE);
            DelayCommand(0.5f, AssignCommand(oChalice, ActionStartConversation(oPC)));
}"

Most of this was pieced together using information from the NWN Lexicon.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Creating a talking, non-equippable item?
« Reply #1 on: December 18, 2010, 04:22:33 pm »


               

location lTarget = GetLocation(oPC);
CreateObject(OBJECT_TYPE_CREATURE, "RES_REF_HERE", lTarget, FALSE);


Use the RES_REF of the NPC, not the TAG to spawn them in. Go to the creatures properties. Hit the ADVANCED TAB.

At the top reads - Blueprint ResRef. That is the string you use to spawn in the creature.

FP!
               
               

               


                     Modifié par Fester Pot, 18 décembre 2010 - 04:22 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Creating a talking, non-equippable item?
« Reply #2 on: December 18, 2010, 05:10:39 pm »


               That's why it isn't working, yes. However, if that's the only edit you make, it'll spawn her on every tag-based event. You need a check at the top to return if the event isn't activation. Looks like this:

if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE)
        return;

There are many ways to do a tag-based setup - I suggest you take a look at the Lexicon's tag-based tutorial.

Funky
               
               

               


                     Modifié par FunkySwerve, 18 décembre 2010 - 05:12 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Creating a talking, non-equippable item?
« Reply #3 on: December 18, 2010, 05:11:46 pm »


               Doubled post deleted, sorry.

Funky
               
               

               


                     Modifié par FunkySwerve, 18 décembre 2010 - 05:12 .