<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 1 February 2017 at 10:37, James Paige <span dir="ltr"><<a href="mailto:Bob@hamsterrepublic.com" target="_blank">Bob@hamsterrepublic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div>Taoki asked on IRC if we could allow NPCs to move from map to map.<br><br></div>At first I was thinking that no, that is impractical, and that it would be better to make a separate pool of universal NPC definitions that could be used on any map...<br><br></div>but after looking at the code for a bit, I am wondering if cross-map NPC definitions might actually be relatively easy.<br><br></div>Suppose that the NPCInst type had a map_of_origin id number in addition to the NPC definition id number.<br><br></div>Then the code that actually does NPC appearance and behavior like visnpc, or NPC walking and activation would need to be aware of it.<br><br></div>All NPC definitions would have to be loaded, rather than just the NPC definitions of the current map, but that would probably be practical too.<br><br></div>Does this sound crazy or not-crazy?<br><br></div>If this could work, then it could become possible to move through doors while riding a vehicle, and the destination map would just load a dynamic instance of the vehicle from its origin map.<br></div></blockquote><div><br></div><div>Hmm, npcs() (the NPCType array) is used in not too places, which would mostly be easily fixed up.<br></div><br></div><div class="gmail_quote">This is definitely not crazy, and sounds like a neat feature. I agree that your proposal wouldn't be hard. Just put the npcs() array into a UDT, and then create an array of that, instead of using a 2D array. I recently added a MapData UDT which is used in the map editor, but easier to just create a new temporary UDT than to first convert Game to use MapData.<br></div><div class="gmail_quote"><div><br></div><div>This also ties in nicely with my plan (once we have script types) to make NPC references remember which map they are for, which means you could read data for an NPC instance on a different map (if it's set to remember state), and read the NPC definition via that reference too.  (I had been planning to instead just throwing an error if you tried to use an off-map npc reference for anything.)<br><br>Regarding not switching to MapData: We probably wouldn't want to keep all data for all maps loaded in 
memory anyway... but maybe I'm thinking like it's the 2000's. But then 
what should and shouldn't be kept loaded?<br><br>Conceivably the map editor could also allow placing 
an NPC instance using an NPC definition from a different map, which 
would prevent having to duplicate NPC definitions across maps, but that 
can be implemented later.<br></div></div><br></div></div>