Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fat Pug Studio on May 13, 2017, 05:29:39 PM

Title: Compare variable range
Post by: Fat Pug Studio on May 13, 2017, 05:29:39 PM
Hello,

i'm making a wave spawn system that should operate the following way:

1.) First spawned wave is by default a small wave category
2.) Spawned ships are added to the array
3.) After a predetermined amount of time, an action gets the number of array items (destroyed and ship that left the screen are removed from the array)
4.) It the number of array items left is 0-5, big wave category is spawned, if the number is 5-10, medium wave category is spawned, if the number 11+, small wave category is spawned.

Using the int switch is a bad idea due to a large number of array items, and conditional expression should have two states (check if it's over 5, if it's false, check if it's over 10). Doesn't sound like much, but this is a simplified example, it will have probably much more to compare.

Any ideas on how i could handle it in one state? Maybe some custom int range switch action?
Title: Re: Compare variable range
Post by: terri on May 14, 2017, 09:44:33 AM
Yeah I think a modified Int Switch would be the way to go
Title: Re: Compare variable range
Post by: Fat Pug Studio on May 14, 2017, 12:10:16 PM
I'll try making an action, should be more od less simple, i'm just not sure how to handle overlapping ranges.
Title: Re: Compare variable range
Post by: tcmeric on June 28, 2017, 10:24:34 PM
So basically you need events to fire depending on the range of ints?

Between

1 - 5, - send event
6 - 10 - send event
11 - 20 - send event
21 - 30 send event
more than 30 - sent event.

Like this?

Ideally, you could add your own numbers for each range?
Title: Re: Compare variable range
Post by: tcmeric on June 29, 2017, 03:07:00 AM
So I wrote an int range switch. Unfortunately you cannot really handle overlapping logic in that sense. Or I wouldnt recommend it.

You can download it here: https://github.com/dumbgamedev/general-playmaker/blob/master/Logic/IntRangeSwitch.cs

I also made a quick youtube video of instructions, which is uploading now.
Title: Re: Compare variable range
Post by: tcmeric on June 29, 2017, 03:31:23 AM
Video here:
Title: Re: Compare variable range
Post by: Fat Pug Studio on June 29, 2017, 03:42:17 AM
Great, thanks, i PM'd you. Jean, would you be kind enough to put this to the ecosystem so everyone has it? :)
Title: Re: Compare variable range
Post by: tcmeric on June 29, 2017, 05:42:32 AM
Here is an updated version with a debug log, out of range event, and everyframe changed to a FSMbool.

- Eric
Title: Re: Compare variable range
Post by: Fat Pug Studio on June 29, 2017, 06:28:48 AM
Awesome man ;D