Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Scripting functions

Page: 1 of 1
 Mandalore_The_Great
12-05-2008, 9:31 PM
#1
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....
 TriggerGod
12-05-2008, 11:03 PM
#2
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.
 Exile007
12-06-2008, 1:04 AM
#3
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. ;)
 Mandalore_The_Great
12-06-2008, 3:31 PM
#4
so, for an example, what would be the tag for Carth? just to test it out
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
Edit:I tried your script Exile and it worked, but I didn't get a message saying my script ran. I just got the items.
 TriggerGod
12-06-2008, 3:35 PM
#5
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 http://64.20.36.214/lucasforums.com/images/editor/code.gif)
 Mandalore_The_Great
12-06-2008, 3:45 PM
#6
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 http://64.20.36.214/lucasforums.com/images/editor/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???!!!
Page: 1 of 1