playMaker

Author Topic: Compare variable range  (Read 2512 times)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Compare variable range
« 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?
Available for Playmaker work

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Compare variable range
« Reply #1 on: May 14, 2017, 09:44:33 AM »
Yeah I think a modified Int Switch would be the way to go

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Compare variable range
« Reply #2 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.
Available for Playmaker work

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Compare variable range
« Reply #3 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?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Compare variable range
« Reply #4 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.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Compare variable range
« Reply #5 on: June 29, 2017, 03:31:23 AM »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Compare variable range
« Reply #6 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? :)
Available for Playmaker work

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Compare variable range
« Reply #7 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

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Compare variable range
« Reply #8 on: June 29, 2017, 06:28:48 AM »
Awesome man ;D
Available for Playmaker work