playMaker

Author Topic: Compare variable range  (Read 1112 times)

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 990
    • View Profile
    • Fat Pug Studio
Compare variable range
« on: May 13, 2017, 02: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?

terri

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

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 990
    • View Profile
    • Fat Pug Studio
Re: Compare variable range
« Reply #2 on: May 14, 2017, 09:10:16 AM »
I'll try making an action, should be more od less simple, i'm just not sure how to handle overlapping ranges.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 730
    • View Profile
Re: Compare variable range
« Reply #3 on: June 28, 2017, 07: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: 730
    • View Profile
Re: Compare variable range
« Reply #4 on: June 29, 2017, 12: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: 730
    • View Profile
Re: Compare variable range
« Reply #5 on: June 29, 2017, 12:31:23 AM »

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 990
    • View Profile
    • Fat Pug Studio
Re: Compare variable range
« Reply #6 on: June 29, 2017, 12: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? :)

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 730
    • View Profile
Re: Compare variable range
« Reply #7 on: June 29, 2017, 02:42:32 AM »
Here is an updated version with a debug log, out of range event, and everyframe changed to a FSMbool.

- Eric

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 990
    • View Profile
    • Fat Pug Studio
Re: Compare variable range
« Reply #8 on: June 29, 2017, 03:28:48 AM »
Awesome man ;D