Workaround guide for placing persistent NPC's via Text Edits

From OuroDev
Revision as of 11:02, 6 February 2020 by Chet (talk | contribs) (1 revision imported: Importing Portal Corps Wiki pages and history - Feb 6, 2020)

Workaround Guide for placing persistent NPCS via Text Edits

First things first, this guide assumes you are running a server setup that can read loose files as described in BubbleWraps guide.

Second things second, this guide is a workaround for the fact that nobody quite has a handle on the proper use of the in game editor (Accessed by typing /can_edit 1 followed by /edit 1 on an account with gm access levels) This isn't intended to be a permanent solution to NPC placement, and may cause unseen issues.

With that out of the way, let's head to where the map data lives, shall we? Head to serverdata/maps/CityZones/City_01_01 This is where the map data for Atlas Park lives and is what we will be using for this example. Most of the City_number_number folders have a file that names the zone they correspond to inside. The file we will be working with to place an NPC is City_01_01_layer_PersistentNPC.txt Opening it up and taking a look at the data inside will show you a list of NPC's that looks something like this:

Def grp_Henry_Peter_Wong
	Group Omni/_Persistent_NPC
	End
	Flags Ungroupable
	Property	"PersistentNPC"	"Contacts\Level_2\Henry_Peter_Wong.npc"	0
End

This is basically where a persistent NPC is defined, however there is one more section further down in the file that lists the location of each NPC in the group grp_PersistentNPC. Inside of this secton is the location and positioning details for each individual NPC. That looks something like this:

Group grp_Henry_Peter_Wong
		PYR 0 89 -0
		Pos 314.499878 175.46051 8.401611
End

The PYR is the rotation of the NPC (As such you'll really only ever see the middle number with a value other than zero). The POS on the other hand is their position on the map. Unfortunately these Coordinates do not match up to the ingame coordinates recieved when using /loc. Therefore, any adjustments to these should be based on the location of existing NPC's rather than /loc coords.

So, for our example here, let's make Henry a new (and oddly identical) friend. Copy the above code and paste it into the City_01_01_layer_PersistentNPC.txt file (Taking special care to place the second snippet INSIDE the Group grp_PersistentNPC block). Change the Group name for both entries to something new (and preferably meaningful). Lastly, you'll want to change the Pos coords so that Henry's new friend doesn't spawn directly on top of him(They aren't quite THAT friendly). The first number is east/west positioning , second number controls height, and the third number is north/south positioning. Your new entries should look something like this:

Def grp_Henry_Peter_Wong_Clone
	Group Omni/_Persistent_NPC
	End
	Flags Ungroupable
	Property	"PersistentNPC"	"Contacts\Level_2\Henry_Peter_Wong.npc"	0
End

and

Group grp_Henry_Peter_Wong_Clone
		PYR 0 89 -0
		Pos 314.499878 175.46051 -8.401611
End

This will spawn a second copy of Henry 10 feet to his north. But I hear you saying, "What if I don't want a useless army of Clones to awkwardly inform me that maybe somebody else has work for me?" Well then that's as simple as pointing your new NPC to a different .npc file. NPC files hold pretty much all of the appearance and behaviors for a given NPC. I'm not going to go into detail on how they work here however, as that's somewhat out of the scope of this guide. Here's an example where we set the NPC to a Freedom Corps store NPC:

Def grp_Henry_Peter_Wong_Clone
	Group Omni/_Persistent_NPC
	End
	Flags Ungroupable
	Property	"PersistentNPC"	"Contacts\StoreNPCs\FreedomCorp_City_02_02b.npc"	0
End

And, because their behavior is detailed inside the .npc file, this character will actually work as a store! Alright, but what if you want to make them on the map as being a store? Well this is another flag located inside the City_01_01_layer_PersistentNPC.txt file. Like so:

Def grp_Henry_Peter_Wong_Clone
	Group Omni/_Persistent_NPC
	End
	Flags Ungroupable
	Property	"PersistentNPC"	"Contacts\StoreNPCs\FreedomCorp_City_02_02b.npc"	0
	Property	"miniMapLocation"	"StoreString"	0
	Property	"specialMapIcon"	"Store"	0
End

There are a number of other flags available as well, but I'll leave it to you to explore and figure out those on your own. Finally, it is possible to create an NPC that functions as a custom worktable (It's actually how the merit vendors work) but I will be saving that for a future guide as it is fairly invovled.