Jump to content

Home

Location for a spawned npc


Seamhainn

Recommended Posts

Hello!

 

I have this script:

 


void main() {
location locMe=GetLocation(GetFirstPC());
CreateObject(OBJECT_TYPE_CREATURE, "n_basvis", locMe);
}
[/Code]

 

As the npc appearce right beside the pc, my question is, is it possible to spawn the npc at a certain location on the map?

 

Thanks and take care

Link to comment
Share on other sites

void main() {
location locMe=GetLocation(GetFirstPC());
CreateObject(OBJECT_TYPE_CREATURE, "n_basvis", locMe);
}
[/Code]

 
As the npc appearce right beside the pc, my question is, is it possible to spawn the npc at a certain location on the map?

 
You can create your own location by setting area coordinates, rather than getting the location of the main character. Like:
 
[code]
void main() {
   location locMe = Location(Vector([color=Yellow]0.0[/color], [color=Red]0.0[/color], [color=PaleGreen]0.0[/color]), [color=Magenta]0.0[/color]);
   CreateObject(OBJECT_TYPE_CREATURE, "n_basvis", locMe);
}

 

...where you set the number in yellow to the X coordinate value, the number in red to the Y coordinate value and the number in pink to the direction the character should be facing when spawned, in angles (0 - 360 degrees).

 

The number in green is the Z coordinate, though it doesn't matter when you spawn an NPC since you can't adjust the elevation of a creature, they always appear on the walkmesh. (If you spawned a placeable rather than an NPC the Z coordinate would be relevant though.)

 

You can get the area coordinates of a location using either the "whereami" console command (in KOTOR) or using the WhereAmI armband mod (KOTOR2:TSL).

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...