Jump to content

Home

Would this script work?


I_Jedi

Recommended Posts

For K2, would this script work:

 

void main()

{

object oNPC = GetObjectByTag ("czerka_dock");

object oNB = GetObjectByTag ("noob_blaster");

ActionGiveItem(oNB, oNPC);

ActionEquipItem(oNB, 4, int bInstant=FALSE);

ActionEquipItem(oNB, 5, int bInstant=FALSE);

}

 

...for making a creature equipping two weapons; with knowledge that czerka_dock and noob_blaster can be found.

 

The const most likely in question is 155 in nwscript.nss

 

Thanks if you know. If it doesn't work please give suggestions. Thanks again.

Link to comment
Share on other sites

The inb-instant part of your script seems to be causing a syntax error when you compile. Also, you aren't telling the oNPC guy to actually equip the weapon, unless the script is fired in a certain way.

 

Try this variation; I don't know if it actually works in-game, but it does at least get past the compile portion of the process.

 

void main()
{
object oNPC = GetObjectByTag ("czerka_dock");
object oNB = GetObjectByTag ("noob_blaster");
ActionGiveItem(oNB, oNPC);
AssignCommand(oNPC, ActionEquipItem(oNB, 4));
AssignCommand(oNPC, ActionEquipItem(oNB, 5));
}

Link to comment
Share on other sites

It's been a while but...

 

"unless the script is fired in a certain way"

 

Which way is that?

If the script is fired from a dialogue node ("spoken" by the creature in question) or one of the scripts listed in the *.utc file then it should work, otherwise you have to tell the game who should be performing the action with the AssignCommand()... command.

Link to comment
Share on other sites

I have tried it and it didn't work.

 

It is supposed to fire when a certain accessible node is spoken by the NPC.

Check to see if the item is definitely in the creature's inventory; check that the *.uti is definitely in the override; make sure that the script name is no more than sixteen characters and is correctly listed in the dialogue file; make sure that its tag is definitely "noob_blaster", and the same for the creature.

 

What is probably easier than what you're doing is simply to create the item on the creature and then have him equip it:

 

void main()
{

   object oNPC = GetObjectByTag("OBJECT_SELF");
   // I am guessing that you want the creature to be dual wielding; you therefore need to create the item *twice*
   object oItem1 = CreateItemOnObject("OBJECT_TEMPLATE_RESREF");
   object oItem2 = CreateItemOnObject("OBJECT_TEMPLATE_RESREF");

       // This should tell you if the items are being created or if there's a problem somewhere;
       // it won't tell you which one but I'm out of practice
       if (!GetIsObjectValid(oItem1) && !GetIsObjectValid(oItem2)) {
           SendMessageToPC(GetFirstPC(), "Something wrong with item creation");
           return;
       }

       // Equip the items
       AssignCommand(oNPC, ActionEquipItem(oItem1, INVENTORY_SLOT_RIGHTWEAPON));
       DelayCommand(0.1, AssignCommand(oNPC, ActionEquipItem(oItem2, INVENTORY_SLOT_LEFTWEAPON)));

}

Link to comment
Share on other sites

That worked! Thanks.

 

I believe that I read somewhere that kotor tool messes up the utc files in a thread.

 

So, with that information, how do I make a weapon undroppable or not available in the remains?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...