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.

Script to Spawn NPC...

Page: 1 of 1
 Jacob Dakari
04-03-2008, 9:37 PM
#1
Ok, so I've gone through the tutorials, and everything has been working out beautifully, except that I can't get the NPC to spawn in the place that I want her to spawn before I recruit her. I tried using several different scripts, but when I did, it said error on whatever part of the script. :lol: That's just my luck too, I'm near completion of the mod, and I fail because I'm too ADD to actually type the script in correctly (no doubt that's what I did, I probably added stuff from the tut that wasn't supposed to be there :D) but I just wanted to see if there was an easier script that I could use to spawn her...
 Ferc Kast
04-03-2008, 10:51 PM
#2
This script should do the trick for you.
void main()
{
vector vPosition=Vector(0.0, 0.0, 0.0); //X, Y, Z coordinates

location lWhereToSpawn=Location(vPosition,0.0); //Orientation, I believe

CreateObject( OBJECT_TYPE_CREATURE,
"my_character",lWhereToSpawn);}

You can find the X, Y, Z coordinates through the whereami cheat code in K1 or Glovemaster's FindMe power from his Handy Force Powers (2.0) (http://knightsoftheoldrepublic.filefront.com/file/;77882) mod for TSL.
 Jacob Dakari
04-03-2008, 10:53 PM
#3
The ",WheretoSpawn" what is that?
 LiquidZoo
04-03-2008, 11:21 PM
#4
The ",WheretoSpawn" what is that?

lWheretoSpawn is the variable name used in the script example above.

(that's a lowercase L, and a capital W)
 Jacob Dakari
04-03-2008, 11:41 PM
#5
@Ferc...

That script didn't work either... :( I'm seriously thinking that it maybe that my computer is retarded and can only script once. :p
 Marius Fett
04-04-2008, 7:38 AM
#6
Try this:

void main()
{
CreateObject(OBJECT_TYPE_CREATURE, "resref", Location(Vector(X.XX,4Y.YY,Z.ZZ), R.RR));
}

Replace X.XX, Y.YY and Z.ZZ with the X,Y,Z co-ordinates respectively, the R.RR with the orientation and the resref with your NPC's resref.
 Jacob Dakari
04-04-2008, 9:14 AM
#7
What is orientation?
 Marius Fett
04-04-2008, 9:36 AM
#8
Orientation is the direction which the NPC, Placeable or whatever the object/creature you're spawning faces.

Here are the basic directions and their corresponding numbers, though you can experiment and use numbers in between to be more precise:

North: 0.00
East: 90.00
South: 180.00
West: 270.00

-DDD
 glovemaster
04-04-2008, 1:31 PM
#9
So orientation is basically a bearing (or angle) 0-360 degrees :p
 Jacob Dakari
04-04-2008, 6:00 PM
#10
Thanks, I always use 0.00 but basically because I had no clue what it was. ^_^
Page: 1 of 1