[crossfire] NPC respawning

Mark Wedel mwedel at sonic.net
Wed Jan 6 00:36:19 CST 2010


  Having the NPC's be unkillable is the easiest approach - all that is needed is 
set up of proper immunities, etc to do so.

  Having new ones spawn is reasonable, but I then start wondering what do we 
really get from that vs making them unkillable?  If the bar tender is killed and 
in a minute a new one shows up with all the same information, not sure what 
letting them kill gains us.  Sure, it may be more realistic, but having a new 
person show up isn't, so your trade one point of realism for another.  If 
anything, if people kept getting killed in a tavern, you'd think people would 
actually stay away from it.

  I'd think both of these cases would not really alter the case of maps 
resetting - if map resets for whatever reason, tavern would go back to default 
setup.

  One could even see the tavern closing down (people can not enter it), which 
would force a reset sooner.  Could be said that new workers need to be found, 
damage repaired, etc.

  I'm not really adverse to any of them - it just seems like writing respawn 
code could be a fair amount of work.  One thing to keep in mind is that a 
solution that can only be done in maps is best - I know that not everyone knows 
the scripting system, so I could imagine some folks wouldn't bother with the 
scripting work.

  From a maintenance point, if changing the conversation of an NPC means having 
to load up the map, see that it points to a script, go to that script, and then 
update it, that also becomes a bit more of a pain.

  I wonder if instead the NPC's could somehow be stored/associated with the map, 
and there is a script that goes and places them (during initial load an 
periodically during the life of the map).

  For example, on a special space (or maybe as a new map property) the different 
NPC's are stored.  Maybe even several different ones with similar messages, but 
the NPC's themselves could be different.  Lets say there are 50 such NPC's 
stored away.

  During initial load, based on some parameter, 20 of those NPC's are copied and 
placed onto the map.  The script that takes care of these periodically runs to 
make sure that there are always about 20 NPC's on the map.  If one dies, it goes 
and places one on the map again.  There would be code that makes sure the same 
NPC is not placed twice.

  One could even extend this so that NPC's come and go - maybe some NPC's wander 
away, and are replaced by other ones - also adds some flavor (the NPC that told 
you about the tower a day ago isn't around anymore, but may show up again down 
the road).

  What is also perhaps interesting is that since which NPCs are on the map, what 
information is present may also change.  For example, of those 20 NPC's chosen, 
maybe 2 of them have basically the same information about some tower.  But maybe 
the NPC with information about a dungeon is not about.

  Now I'm not sure if this approach is easier or harder.  A plus here is that 
all conversation is stored on the map, not in scripts - the script is just used 
for the placement (and maybe having NPC's wander about).  So a person without 
any scripting knowledge could add new NPC's and have them behave like the rest.




More information about the crossfire mailing list