Spawn NPC 5165

03/17/2010 23:41 ktamer#1
I've been working on a quest that upon command sends players to a map where they must kill a "Super" monster. Which drops an item to get a prize. And what I haven't been able to figure out is how to spawn the "Prize NPC" on command then have him go away after the dialog.

Also if possible how would I teleport ALL players in the map to another map? Without asking them.

Any help in the right direction would be appreciated. Thx.
03/18/2010 02:44 pro4never#2
Adding the npc is simple enough, look at how it's loaded from the database when the server starts and replicate it for this (make sure to update local clients so they can see it)


Then once it's used, remove it from the loaded npcs and update clients again (or else it will still show ingame)


As for teleporting all players, do a foreach loop through all connected clients and then just say if their map == the one you want to tele from, teleport them to specified map/coords (you can always use some random coords or a spread so they aren't all stacked on 1 spot)
03/18/2010 02:52 ktamer#3
I appreciate the assistance on tele the chars. So if there's no way to remove the NPC w/out restarting can I somehow block it out from other characters? I tried using a similar method used by the Lottery but that only limits 1 Client side and I couldn't get it to block out other chars. Maybe I can try locking out the item required by making the monster spawn at the same time the event starts?
03/18/2010 02:59 pro4never#4
You can do monster spawns at the start of event using a spawn function (you could try converting the one I released for 5095) and yes, you can add/remove npcs from the server without restarting the server in the way I said. There are basically 2 steps to it (assuming lotf does it the same)

The source stores loaded npcs in a dictionary (or some type of data structure) and then spawns them to the server... You can do that with a specific one while it's running, I'd use how they are loaded as an example though. Again I released something similar for coemu but lotf will be quite different. You will still want to update spawns to all local chars or they may not see it when it is spawned.

Same with removal, make sure to update clients or they will still be able to see (and possibly use) the npc after the event ends.