Grump642,
EggChen is "right on the money" about
idle_spawn_preset. You can also dynamically spawn NPCs yourself, outside of the
all.spawn file. See the links in the
"Important Links to Modding Questions and Answers" thread, as well as
the STALKER Mod Wiki articles on spawning.
There will be automatic limits on the number you can spawn via
all.spawn: the capacities of the smart terrains associated with those communities. When vacancies open up (e.g., you kill the bandits attacking the vehicle graveyard) you can expect them to be filled shortly. This is determined by a)
idle_spawn_preset, b)
going_speed and maybe
current_level_going_speed for the NPC (this is how fast they move while offline; see the
m_*.ltx files except for the unused ones
EggChen mentioned), and c) distance from the spawning place to the destination smart terrain.
Dynamically spawned NPCs that don't have jobs/smart terrains assigned are not subject to this limit, although there may be a limit of about 65,534 objects extant at one time.
Yes, I meant exactly what I said;
EggChen has it right. The local array
simMaxCount is not used in vanilla unless one changes it,
"except for some statistics stuff, and even that uses printf() functions which are NOPs (no operation) in vanilla."While that is true, a qualification (a "technicality" per
Don Reba) might be in order. The statistics functions don't affect the vanilla game other than to waste time doing some useless processing -- but that processing can be affected by adding non-vanilla entity types as
EggChen did. More below.
And I don't know everything about the engine. I don't see how
se_respawn.script changes could impact your game beyond
idle_spawn_preset -- but that is not saying that it can't.
EggChen, some items that might be related: Even though
printf() statements themselves are NOPs in our non-dev environment, the
parameters enclosed in parentheses might reference something during evaluation that results in a CTD error like trying to index a nil value.
And
all.spawn entries that have
respawn_sections defined (or any invocation of se_respawn functions) may require an entry in the array to avoid using an invalid index. Because
simMaxCount is local, nothing outside of the script file knows about it, and the only active instance in there is within the
lstats() function -- which is not referenced elsewhere in the *.script, *.xml, or *.ltx files. This implies that it is called by the DLL-based engine, if your se_respawn.script is otherwise vanilla.
So what happened? Well, the
can_spawn array grew with your new entries automatically. But now the variable
k, the count of entries in
can_spawn, is greater than the number of entries in
simMaxCount.
And that
can_spawn array is also local. I'll bet you could just comment out the contents of that function (i.e., have an empty function body) and all of
simMaxCount, and you still would not crash.
Side note: My "stranger" class doesn't have an entry in this file, but it works just fine. You'll see shortly, if interested.
