Weighted Random selection with dynamic adjustment with just 8 behaviors.
Hopscotch
Member, PRO Posts: 2,782
What is it good for?
Imagine you want waves of enemies, randomly spawned ...
... but you would like to start with more of the easy monsters in the beginning,
then as the level progresses, increase the frequency of tougher enemies.
Or simply define the type and frequency of enemies per level.
(Project attached)
Comments
Amazing stuff !! Thanks for sharing !!
P.S love the interface too !!!
Love it! Can't wait to take some time to dig in to exactly how it works!
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Great work Roland!
GAMESALAD DEV FOR HIRE! - www.gingagaming.com
Very cool and very handy! Thank you so much for sharing!
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
This is great! Thanks for sharing with the community!
Thanks for the comments @Socks, @Armelline, @gingagaming, @Braydon_SFX, @RThurman !
After messing about, the simplicity surprised me:
Make a table with enemies, adding the desired ratio each should appear. The order does not matter.
Now pick a random value from the sum of the ratios.
Then loop over the enemy table, subtracting each ratio from your random number until you reach 0 or less. The previous enemy is then the one to spawn.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Things are always 'simple' once you've worked out the answer.
Oh yeah, that was really obvious, I'm surprised you even had to work it out
@Hopscotch Snippets of brilliance like this inspire me with some great ideas that I would never attempt on my own without your tutelage. Once again, thank you.
@Socks Well, yeah, things always get lost in translation somewhere between my brain and mouth, I blame it on a sinus condition.
My pleasure @PhilipCC
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com