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.

How can I create a NPC in a non custom area?

Page: 1 of 1
 Keeper_DP
02-05-2008, 11:45 AM
#1
For example. If I wanna to create a NPC on Tatooineґs Cantina (K1).

I know how to create NPC on custom modules. Because the info (X, Y and Z) are in the .mod file. But... if only I want to create that NPC?

Thanks a lot.
 Darkkender
02-05-2008, 12:00 PM
#2
In the scripting tutorials section there is a tutorial for just that Spawning Items, Placeables and Creatures (http://www.lucasforums.com/showthread.php?t=143536). Hope this helps. Also browse the Tutorials subforums above as you'll find plenty of walkthroughs that will help.
 Totenkopf
02-05-2008, 1:02 PM
#3
Another thing you can do is check to see what other modders have done in writing spawning scripts, to see what actually works and what if any differences there are from modder to modder. As the saying goes, if you want to be successful, copy success. Just remember to credit others for any contribution if you upload something down the road.

There are several ways to spawn your character there, but the only type I've tried is through dialog fired scripts so far. Attach your spawning script, when you make it, to someone like Junix (bartender) or the pazaak guys dialog via the DLGEditor....making sure that the line you attach it to does not repeat (you wouldn't want continuous spawning), but also, really, to anyone in Tatooine. It's your call.
 Stream
02-05-2008, 2:58 PM
#4
This script will spawn a NPC;


void main()
{

CreateObject(OBJECT_TYPE_CREATURE, "NPC_TAG", Location(Vector(x, y, z), 0.0));

}

--Stream
 stoffe
02-06-2008, 6:56 AM
#5
For example. If I wanna to create a NPC on Tatooineґs Cantina (K1).

I know how to create NPC on custom modules. Because the info (X, Y and Z) are in the .mod file. But... if only I want to create that NPC?


If the NPC is supposed to always be there you can add it to the Creature List in the GIT file inside one of the module's RIM files. This is the easiest way in my opinion, but has the disadvantage of only working if the player hasn't been to the area already in their current game before installing your mod (unless it's an area which isn't kept in the savegame).

Alternatively if the NPC should only appear under certain conditions you can spawn it with a script. The most common ways of doing so is to fire the script from a dialog within the area, or to modify the area's OnEnter event script to spawn in the NPC the first time the player enters the area and all other conditions are fulfilled. This method works even if the player has already been to the area in their game, but makes it a little harder to make your mod compatible with other mods using the same method. :)
Page: 1 of 1