Game Dev Contest
Join in on the Game Development contest with over $300 in prizes!
Banner Creation Contest!
Help the community out by creating your own version of the banner, and potentially having that as the main banner!
Resources
Check out our resources :D
Upgrade your account
Help out the community, and keep the website running and fully up to date by donating! :D

Randomized NPC spawn locations

GO TO ADMIN PANEL > ADD-ONS AND INSTALL ABSTRACT SIDEBAR TO SEE FORUMS AND SIDEBAR

Mr. Open

NPC
Joined
Mar 5, 2017
Messages
20
Points
17
RM Skill
Mapper
Hello! Does anyone know how to make an NPC spawn in one location out of a specific pool randomly? (for example, you set up 5 possible spawn points, where each one has 20% spawn rate and NPC is present at only ONE of them). I want to make a unique set of enemies that would "escape" to another location upon defeat and drop a unique item with a fixed chance, but have no idea how to create the random spawn point system. (aww)
 

CT_Bolt

Global Moderator
Staff member
Resource Team
Joined
Nov 12, 2015
Messages
552
Points
248
RM Skill
Programmer
Hello! Does anyone know how to make an NPC spawn in one location out of a specific pool randomly? (for example, you set up 5 possible spawn points, where each one has 20% spawn rate and NPC is present at only ONE of them). I want to make a unique set of enemies that would "escape" to another location upon defeat and drop a unique item with a fixed chance, but have no idea how to create the random spawn point system. (aww)
@Mr. Open
Made a demo for you using Galv's Event Spawner Plugin: Click Here to View

I'm not sure if it's 100% what you need but it's a good start at least. (cool)(thumbsup)
 

Attachments

Last edited:

Mr. Open

NPC
Joined
Mar 5, 2017
Messages
20
Points
17
RM Skill
Mapper
Well, You're right I meant different spawn locations, but not certainly within only one map. But I already asked Galv whether it's even possible with his script, all I can do is wait for an answer.
 

Dalton Sayre

Towns Guard
Joined
Feb 26, 2016
Messages
85
Points
58
RM Skill
Designer
I've done a kinda similar thing, both with common events + switches and with variables.
I create the spawn point events at each location with a corresponding switch. I use a conditional branch in conjunction with the "seconds" variable associated with my time system which controls the randomization of which spawn point switch is on or off. The gist is as follows:
Defeat enemy at spawn point 1
Spawn point 1 switch is turned off
(Conditional branch <parallel>: if switch 001 is off
If variable "001: seconds"= 1-3 switch 002 is on
If variable "001: seconds"= 4-6 switch 003 is on
If variable "001: seconds"= 7-9 switch 004 is on
If variable "001: seconds"= 10-12 switch 005 is on
If variable "001: seconds"= 13-15 switch 006 is on
And so on. It is a bit tedious to set up, but once you fine tune it it is pretty smooth and does add variable elements. I played through mine dozens of times in testing & I don't know if I had any indetical playthroughs. I hope this helps and bit.
 
Top