Note: this is multiplayer-only tutorial!
I have heard a lot about people saying that NPCs and Vehicles crash servers.
Let me enlighten you on the art of NPC and Vehicle use in Jedi Academy's multiplayer.
When done correctly nothing bad will happen at all. Professional admins should be able to do this properly.
Vehicles are treated as ridable NPCs by Jedi Academy, so from now I will refer to both of these groups as just NPCs.
PART I. OVERCOMING NPC SPAWN LIMITATIONS
Every BSP map has Entities – they are objects such as weapons, items etc.
NPCs are one type of these entities. ALL Entities are:
1. Stored inside a BSP map file and spawned when the map loads on the server.
2. Manually spawned using admin commands.
The server can only handle 1022 entities at any time! Any more entities will cause the server to get a fatal error. Entities from BSP map file that are not spawned on the server (info_null's, misc_model(_static)s, pickups that aren't spawned due to settings… etc) do not count towards this limit as they're not spawned and therefore don't take up slots.
Now how many NPCs can you spawn on a map? It depends how many entities a map already has inside it and how many NPCs someone already spawned before you.
Let’s say, a map called xnamex.bsp has 1000 entities in it.
What does that mean?
It means server can handle 22 entities more before it crashes.
Now, each UNIQUE NPC takes up one entity slot.
That means if you spawn 100 Jawas server will not crash (but it will lag as hell).
But you can only spawn 22 unique NPCs in our map xnamex.bsp, any more and server will crash.
Now some maps come with many entities, such as JediCouncilGCX, fsf (kotor flight school), tendron v2, asteroidH5. Party because they already have many NPCs preloaded with the map.
Spawning NPCs on such maps is not recommended, UNLESS you spawn the SAME NPCs the map already has, since the same NPCs will not take up new entity slot!
Here is some clear rules on NPC spawns per map:
JediCouncilGCX: 2-3 new NPCs
AsteroidH5: 1-2 new NPCS
FSF: NO SPAWN of new NPCs allowed
<list will be updated>
What to do if you already spawned some NPCs, and now you want to spawn others?
Restart the map!
By reloading the map, server will erase the entities of spawned NPCs, thus allowing you to spawn new NPCs in their place.
We had a cool RP mission on our map xnamex.bsp, spawned some vehicles and NPCs. Now it is over, and we want to spawn some other NPCs.
First admin does this:
/ammap 0 xnamex
Server reloads the map, erasing manually spawned NPC entities from the memory.
Now new ones can be spawned.
USEFUL TIP: If the server was empty and you came to it and want to spawn NPCs, restart the map before doing it, just to be sure. Who knows, maybe someone spawned some NPCs before you and left, and their entities still remain in server’s memory.
Also, if YOU spawned some NPCs, restart server after leaving, just to be sure to clean those entities.
PART II. NAMING NPCs
NPCs can be named. Each NPC you spawn can either have a unique name, or a group of NPCs can share the same name.
/npc spawn bartender johny
/npc spawn stormtrooper squad1
/npc spawn swamptrooper squad2
/npc spawn vehicle atst_vehicle atst1
/npc spawn desann boss1
/npc spawn tavion boss2
Why do you need it?
Because you can selectively despawn those NPCs! (In single player you can also use additional commands, which are not available in MP)
/npc kill johny – kills that poor bartender from example above.
/npc kill squad1 – kills squad one stormtoopers in case we missed some on RP mission
/npc kill boss2 – kills Tavion, maybe we want to respawn her.
/npc kill atst1 – kills atst we spawned.
/npc kill all – kills all NPCs and vehicles on server, including prespawned ones.
Why is this useful? During missions too many NPCs can result in server lag. Selectively killing the NPCs you have no use anymore will solve this problem.