Hey, Do any of yall know where I can find a tutorial on making a new alien NPC with dialog, a store(already got the utm and this script:
// ST: st_startstore.nss
void main() {
object oStore = GetObjectByTag("m_954_001");
object oSpeaker = GetPCSpeaker();
if (!GetIsObjectValid(oStore))
oStore = CreateObject(OBJECT_TYPE_STORE, "m_954_001", GetLocation(OBJECT_SELF));
if (GetIsObjectValid(oStore))
DelayCommand(0.5, OpenStore(oStore, oSpeaker));
})
and spawn him in a custom module?
PS: Also is there something wrong with this script?
Thanks!
To spawn a thing in a NEW module you use the git file. I use this tut to help me :)
http://www.lucasforums.com/showthread.php?t=157396)
To spawn a thing in a NEW module you use the git file. I use this tut to help me :)
http://www.lucasforums.com/showthread.php?t=157396)
ok thanks Ill look at it.
EDIT: Well I found it kinda confusing with so much different stuff =(. Is there a tut somewhere just for Creating a NPC?
and i dont think I need a git if I spawn the NPC with a script?
If you create a new module, you need a .git file anyway. If that npc is supposed to be in the module from the beginning, then the best way is to place him there via the .git file (like other objects, such as doors, placeables, etc) instead of running a script to spawn him.
If you create a new module, you need a .git file anyway. If that npc is supposed to be in the module from the beginning, then the best way is to place him there via the .git file (like other objects, such as doors, placeables, etc) instead of running a script to spawn him.
hmm well the module is already made by someone else im just adding a merchant to it.
Well then you would need a script. Look in the scripting tut section.
/* Possible Object types:
OBJECT_TYPE_CREATURE
OBJECT_TYPE_ITEM
OBJECT_TYPE_TRIGGER
OBJECT_TYPE_DOOR
OBJECT_TYPE_WAYPOINT
OBJECT_TYPE_PLACEABLE
OBJECT_TYPE_STORE */
// for the 3 floats in the function below
// you can use the X, Y, Z coordintates from
// the whereami cheat code
vector vPosition=Vector(0.0, 0.0, 0.0);
location lWhereToSpawn=Location(vPosition,0.0);
CreateObject( OBJECT_TYPE_CREATURE,
"object_template",lWhereToSpawn);
Time to explain the different parts of the code.
vector vPosition=Vector is where you put the x y z coordinates you get with the Whereami band. If you didn't know where this is, use the Whereami Band, and, go into your journal tab. In there, go to the Feedback, and you'll find the x y z there, along with the Orientation and Bearing. You can ignore the Orientation fields for this script, as they are used in placing things in a git file.
location lWhereToSpawn=Location(vPosition,0.0) lWhereToSpawn is used later in the script, to help place the item. The coordinates are for the bearing. Put what you got for the bearing here.
The rest you should be able to figure out.
/* Possible Object types:
OBJECT_TYPE_CREATURE
OBJECT_TYPE_ITEM
OBJECT_TYPE_TRIGGER
OBJECT_TYPE_DOOR
OBJECT_TYPE_WAYPOINT
OBJECT_TYPE_PLACEABLE
OBJECT_TYPE_STORE */
// for the 3 floats in the function below
// you can use the X, Y, Z coordintates from
// the whereami cheat code
vector vPosition=Vector(0.0, 0.0, 0.0);
location lWhereToSpawn=Location(vPosition,0.0);
CreateObject( OBJECT_TYPE_CREATURE,
"object_template",lWhereToSpawn);
Time to explain the different parts of the code.
vector vPosition=Vector is where you put the x y z coordinates you get with the Whereami band. If you didn't know where this is, use the Whereami Band, and, go into your journal tab. In there, go to the Feedback, and you'll find the x y z there, along with the Orientation and Bearing. You can ignore the Orientation fields for this script, as they are used in placing things in a git file.
location lWhereToSpawn=Location(vPosition,0.0) lWhereToSpawn is used later in the script, to help place the item. The coordinates are for the bearing. Put what you got for the bearing here.
The rest you should be able to figure out.
so:
vector vPosition=Vector(-51.96494, 29.39132, 9.66545);
location lWhereToSpawn=Location(vPosition,-0.85296);
CreateObject( n_bith,
"object_template",lWhereToSpawn);
what do I put for object_template? sorry very new to scripting
what do I put for object_template? sorry very new to scripting
forgot to mention that part. object_template is for the tag/resref (advised you make them the same) of your character file. So, if your characters tag/resref is jedi_01, in place of object_template, you put jedi_01
forgot to mention that part. object_template is for the tag/resref (advised you make them the same) of your character file. So, if your characters tag/resref is jedi_01, in place of object_template, you put jedi_01
thanks so this is my final:
vector vPosition=Vector(-51.96494, 29.39132, 9.66545);
location lWhereToSpawn=Location(vPosition,-0.85296);
CreateObject( OBJECT_TYPE_CREATURE,
"n_bith",lWhereToSpawn);
this right?
thanks so this is my final:
vector vPosition=Vector(-51.96494, 29.39132, 9.66545);
location lWhereToSpawn=Location(vPosition,-0.85296);
CreateObject( OBJECT_TYPE_CREATURE,
"n_bith",lWhereToSpawn);
this right?
It looks right. (If he is facing the wrong way, try putting the bearing coordinate as 0.0 again.) But, there is only one way to test it out...
Now, throw that into the KOTORTool Text Editor (paste isn't done by right click in there, in case you didn't know. Its in the Edit menu), save it as a .nss file (call it anything you want as long as it is less then 16 characters. Do something simple like bith_spawn), and in script, press the game your making the script for (KOTOR 2 in your case) and click compile. Hopefully it'll compile correctly. Now, open up the DLGEditor, find a dialog that is activated when you enter that module, and, in the action script section of a line, put the name of your script (using my example, bith_spawn), click another line just to be sure, and save. Now, see if your script runs!
It looks right. (If he is facing the wrong way, try putting the bearing coordinate as 0.0 again.) But, there is only one way to test it out...
Now, throw that into the KOTORTool Text Editor (paste isn't done by right click in there, in case you didn't know. Its in the Edit menu), save it as a .nss file (call it anything you want as long as it is less then 16 characters. Do something simple like bith_spawn), and in script, press the game your making the script for (KOTOR 2 in your case) and click compile. Hopefully it'll compile correctly. Now, open up the DLGEditor, find a dialog that is activated when you enter that module, and, in the action script section of a line, put the name of your script (using my example, bith_spawn), click another line just to be sure, and save. Now, see if your script runs!
hmm didnt get this on my last script:
bith_spawn(6): Error: Syntax Error at "CreateObject"
Compilation Aborted With errors
EDIT: Also on dialog I might have to create some because the only dialog in the module is packed into the module(i believe) so unless I extract it off KT from 954cor.mod there is no dialog. Would it work if I did that?
Try this:
object oBith = CreateObject( OBJECT_TYPE_CREATURE, "n_bith", lWhereToSpawn );
- Star Admiral
Try this:
object oBith = CreateObject( OBJECT_TYPE_CREATURE, "n_bith", lWhereToSpawn );
- Star Admiral
thanks, it works now just the dialog, ill try to extract it off the module.
EDIT: Didnt work will have to somehow find another way...
Did you set your new NPC to use the extracted dialog?
- Star Admiral
Did you set your new NPC to use the extracted dialog?
- Star Admiral
inside the utc? No.
inside the utc? No.
Well, you'll have to set it to do that. I found it easier to put it in using the KGFF, but you can use KTool's Creature Editor. All you have to do is make the dialog, and in the conversation field in the KTool's creature editor, put the name of the dialog file you saved (without the .dlg extension)
done but the npc does not appear with the script added to the extracted dialog
Spawn the NPC like you did before, without adding anything to the dialog file. If you use KT, you add the dlg file name in the textbox under the Conversation heading. Look at the screenshot for an example.
http://img208.imageshack.us/img208/610/dialogrc2.th.jpg) (
http://img208.imageshack.us/my.php?image=dialogrc2.jpg)
- Star Admiral
Spawn the NPC like you did before, without adding anything to the dialog file. If you use KT, you add the dlg file name in the textbox under the Conversation heading. Look at the screenshot for an example.
http://img208.imageshack.us/img208/610/dialogrc2.th.jpg) (
http://img208.imageshack.us/my.php?image=dialogrc2.jpg)
- Star Admiral
the npc never spawned and I know about the dialog its just the npc does not spawn.
As I understand it, you put the spawning script in the dialog file, right? But since the dialog will only trigger when you talk to the NPC, and the NPC will only spawn when triggered by the dialog, we end up going in circles. You'll need to trigger the spawning script when the module is loaded, not within the dialog file.
- Star Admiral
As I understand it, you put the spawning script in the dialog file, right? But since the dialog will only trigger when you talk to the NPC, and the NPC will only spawn when triggered by the dialog, we end up going in circles. You'll need to trigger the spawning script when the module is loaded, not within the dialog file.
- Star Admiral
I put it in the soliders dialog. How do I add it to the module?
First, open up KT. Expand KOTOR II, then RIMs, then Modules. Locate the module you wish to spawn the NPC in. Let's pretend it's 003EBO. Expand 003EBO.rim, then Static Area Info. Double-click on the file 003ebo.are. In the text file that opens, scroll all the way down. Locate the line "Label: OnEnter". Look to the right for the entry "Value: xxxxxx". The xxxxxx is the name of the on enter script you need to use. Then, follow this (
http://www.lucasforums.com/showthread.php?t=137370) tutorial to proceed with implementing the spawning script.
- Star Admiral
First, open up KT. Expand KOTOR II, then RIMs, then Modules. Locate the module you wish to spawn the NPC in. Let's pretend it's 003EBO. Expand 003EBO.rim, then Static Area Info. Double-click on the file 003ebo.are. In the text file that opens, scroll all the way down. Locate the line "Label: OnEnter". Look to the right for the entry "Value: xxxxxx". The xxxxxx is the name of the on enter script you need to use. Then, follow this (
http://www.lucasforums.com/showthread.php?t=137370) tutorial to proceed with implementing the spawning script.
- Star Admiral
Since its a custom module it is not in the KT Rims. That should be helpful for another mod though.
In that case, use KT's Module Editor. Navigate to the folder where you have saved the custom module files and open it. I haven't tried using it but that should be the way to go.
Note: I'm not sure whether KT can correctly modify the module files without corrupting them. I know for a fact that you can't use KT's DLG editor. Make sure you save a backup of the custom module before editing it, else you might lose some valuable data.
- Star Admiral
In that case, use KT's Module Editor. Navigate to the folder where you have saved the custom module files and open it. I haven't tried using it but that should be the way to go.
Note: I'm not sure whether KT can correctly modify the module files without corrupting them. I know for a fact that you can't use KT's DLG editor. Make sure you save a backup of the custom module before editing it, else you might lose some valuable data.
- Star Admiral
yea it dosent work. maybe Ill make a google search tomorrow to try and find a different module editor.
Thanks
Try the ERF/RIM Editor (
http://www.starwarsknights.com/tools.php). It's under the General Modding Tools. It may work depending on the format you have your custom module in.
- Star Admiral
Try the ERF/RIM Editor (
http://www.starwarsknights.com/tools.php). It's under the General Modding Tools. It may work depending on the format you have your custom module in.
- Star Admiral
Using that I extracted that and opened it with GFF tomorrow Ill edit it and stuff.
Thanks
EDIT: Instead of Adding a whole NPC Im just going to edit the droid inside dialog and see if I can get him to enter the shop.
Sorry for the double but its a update.
It Worked.=) I just edited the droid inside added a script it to run the store, and tried it out. Thanks Star Admiral, Triggergod, and everybody who helped.