playMaker

Author Topic: Create Object won't stop spawning objects  (Read 1985 times)

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Create Object won't stop spawning objects
« on: September 25, 2014, 10:22:25 AM »
I'm stuck with trying to make my space ship customizable. So basically I have a Global Float variable that's being checked for changes, for example I use Float Compare to 1. If it's 1 then spawn this part, if 2 spawn this part, etc. I'm using a Global variable so everything the player selects will also spawn in the next scene.

As you guys can see in the screen shot, the start state checks the Float every frame. Problem is it keeps spawning the Object and won't stop. If I switch of Every Frame, nothing seems to happen. Any tips on what I did wrong or if I should use a totally different approach? Thanks!


jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Create Object won't stop spawning objects
« Reply #1 on: September 25, 2014, 12:02:36 PM »
Use a bool to check whether the part exists.  Set it to true when you create your  object. Add another state to check that's it's false before going to the create state.

jayf

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Create Object won't stop spawning objects
« Reply #2 on: September 26, 2014, 04:17:35 AM »
Thanks jess84. That's one of the things I'm trying to figure out right now. Is there something like a "do nothing" action? Or better yet, what action do I have to use if the part already exists? Should it just lead to an empty State?

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Create Object won't stop spawning objects
« Reply #3 on: September 26, 2014, 10:16:02 AM »
It all depends on if you want to recheck it during your level.

At the moment you're in a neverending loop.

If you end in an empty state, that's fine, but if you want to recheck it in the future, you'll just need to send a global event to that FSM to tell it to recheck. (which is fine, and probably the route I would go).