PDA

View Full Version : Would this script work?


I_Jedi
06-03-2009, 08:25 PM
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.

DarthNandis
06-03-2009, 08:42 PM
Idk... you don't need to give 2 oNB to work right?

I_Jedi
06-03-2009, 08:49 PM
The reason, I believe, I put two oNB is due to two inventory slots. So...would it work?

Exile007
06-03-2009, 09:50 PM
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));
}

I_Jedi
06-03-2009, 10:09 PM
"unless the script is fired in a certain way"

Which way is that?

Pavlos
06-03-2009, 10:33 PM
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.

I_Jedi
06-04-2009, 12:36 AM
I have tried it and it didn't work.

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

Pavlos
06-04-2009, 07:09 AM
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)));

}

I_Jedi
06-04-2009, 04:51 PM
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?

Mandalore_The_Great
06-05-2009, 09:42 PM
So, with that information, how do I make a weapon undroppable or not available in the remains?
An easy way would be to click the "undroppable" box when making a new item(or editing an old one, for that matter). I can't remember a scripting solution at the moment. Haven't made a mod in... maybe a year