Jump to content

Home

Scripting functions


Recommended Posts

I'm trying to make a small mod that kind of changes around the party members. I wanted to know what script function you use to make a creature you're talking to attack you. I might need a few more that aren't on the 'frequently used script functions' page

also, I made this script to spawn four Mandalorian items. here it is:

void main() {

object oItem=CreateItemOnObject("g_a_class8004", GetFirstPC());

object oItem1=CreateItemOnObject("g_w_hvrptlbltr02", GetFirstPC());

object oItem2=CreateItemOnObject("g_w_hvyblstr04", GetFirstPC());

object oItem3=CreateItemOnObject("g_w_hvyblstr04", GetFirstPC());

} I made it so that when you go to the escape pod on the Endar Spire, you can check for anything useful. when I do that, it plays all the right dialogue, but I don't get the items. Help

 

I also tried an alternate script and this didn't work either:

void main() {

object oItem=CreateItemOnObject("g_a_class8004", GetFirstPC());

object oItem1=CreateItemOnObject("g_w_hvrptlbltr02", GetFirstPC());

object oItem2=CreateItemOnObject("g_w_hvyblstr04", GetFirstPC(), 2 );

}

I really want this to work....

Link to comment
Share on other sites

I'm trying to make a small mod that kind of changes around the party members. I wanted to know what script function you use to make a creature you're talking to attack you.

void main() {
   object oNPC = GetObjectByTag("npc_tag");
   ChangeToStandardFaction(oNPC, STANDARD_FACTION_HOSTILE_1);
}

replace npc_tag with your npc's tag and/or resref (to be safe, just make them the same ;))

I might need a few more that aren't on the 'frequently used script functions' page

also, I made this script to spawn four Mandalorian items. here it is:

void main() {
object oItem=CreateItemOnObject("g_a_class8004", GetFirstPC());
object oItem1=CreateItemOnObject("g_w_hvrptlbltr02", GetFirstPC());
object oItem2=CreateItemOnObject("g_w_hvyblstr04", GetFirstPC());
object oItem3=CreateItemOnObject("g_w_hvyblstr04", GetFirstPC());
}

I made it so that when you go to the escape pod on the Endar Spire, you can check for anything useful. when I do that, it plays all the right dialogue, but I don't get the items. Help

 

I also tried an alternate script and this didn't work either:

void main() {
object oItem=CreateItemOnObject("g_a_class8004", GetFirstPC());
object oItem1=CreateItemOnObject("g_w_hvrptlbltr02", GetFirstPC());
object oItem2=CreateItemOnObject("g_w_hvyblstr04", GetFirstPC(), 2 );
} 

I really want this to work....

 

There shouldn't be anything wrong, as I used the same exact script while testing out ways for my Inheritor locker to be spawned. First off, make sure you saved as nss first, compiled for the correct game (K1 in your case), and, in the DLGEditor, in the dialog file you want the script to run on, under the script field, put the name of the compiled script.

Link to comment
Share on other sites

void main() {
   object oNPC = GetObjectByTag("npc_tag");
   ChangeToStandardFaction(oNPC, STANDARD_FACTION_HOSTILE_1);
}

replace npc_tag with your npc's tag and/or resref (to be safe, just make them the same ;))

 

Tag. ;)

 

As for the problem madalore, I have no idea, my advise would be to put an extra line on the script.

 

void main() {
object oItem=CreateItemOnObject("g_a_class8004", GetFirstPC());
object oItem1=CreateItemOnObject("g_w_hvrptlbltr02", GetFirstPC());
object oItem2=CreateItemOnObject("g_w_hvyblstr04", GetFirstPC(), 2 );
SendMessageToPC(GetFirstPC(), "MY SCRIPT RAN");
}

 

That way you can tell if the script actually ran. ;)

Link to comment
Share on other sites

so, for an example, what would be the tag for Carth? just to test it out

To help beginning modders, go into KTool, and in the main character templates, and find Carth's. I think its something like P_Carth or something like that.

 

also, how do you do that thing where you put the code in the blue box? makes it so you can read it a little better

The Code Feature is really handy. Just click the button that looks like this code.gif

Link to comment
Share on other sites

To help beginning modders, go into KTool, and in the main character templates, and find Carth's. I think its something like P_Carth or something like that.

 

 

The Code Feature is really handy. Just click the button that looks like this code.gif

 

OK, thank you I found them.

Do you think I just added a space on accident or something so that the script wouldn't work?

Okay, I save the script as give_pod.nss. then, when I go to compile the script, I get this message:

Lookup path to root: .... and so on

Compiling: give_pod.nss

give_pod.nss(5): Error: Unexpected end of file

Compilation aborted with errors

Total execution time: 15 ms

WTF is going on???!!!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...