playMaker

Author Topic: Event Verification [SOLVED]  (Read 2664 times)

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Event Verification [SOLVED]
« on: October 26, 2017, 01:16:29 PM »
Hello, I'm noob and today I bought a Playmaker and ran into a problem that I can not solve. I'm trying to make sure that the Spawn points are started after certain actions, so how to make the State perform the check and wait until its result is equal to the desired value and only after the condition is fulfilled to proceed to the next State?
I use the method to determine whether the enemy prefab is Despawned or not and then turn off the first Spawn point. (I use the Asset "Pooly - Professional Pooling System")
Code: [Select]
public void countDS()
    {
        if (Pooly.GetDisabledCloneCount(enemy1) == 1)
        {
            spawner.StopSpawn();
            Pooly.DespawnAllClonesInCategory("enemy1");
        }

This method I use in the Playmaker Editor as in the picture below:
https://imgur.com/iscmTH3
« Last Edit: October 30, 2017, 05:35:04 AM by Poltor »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Event Verification
« Reply #1 on: October 27, 2017, 01:51:30 AM »
Hi,

you need to insert one state prior spawning and in that early state, you will run everyframe a check against a variable or calling a method and checking the results.

 for example if the variable is a bool, you get it everyframe and the next action in the same state use Bool check and will make you transit to the next state if the variable is true for example.

 Don't use the FINISH transition for this, create your own event like "READY" and that's what you wikl call from within the bool check action.

 if it's an int, use "Int compare", if it's a float use "Float compare" etc.

 Bye,

 Jean

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Event Verification
« Reply #2 on: October 27, 2017, 07:58:46 AM »
Don't use the FINISH transition for this, create your own event like "READY" and that's what you wikl call from within the bool check action.

Many thanks for the answer, are there Tutorials in which you can see a similar implementation? Because I did not quite understand how to use "Ready" when I create it because it will not write what I need, but I do not know where to set its properties.

In general, I have a problem with understanding how to do "Сhecks" in the Playmaker and that as a result of this check the next State in the Playmaker editor was launched.
« Last Edit: October 27, 2017, 12:47:41 PM by Poltor »

Ofonna

  • Full Member
  • ***
  • Posts: 230
Re: Event Verification
« Reply #3 on: October 28, 2017, 02:29:18 PM »
hi, use a public bool that sets to true when you if statement is == 1. drag the script into your editor and get the bool variable, use the bool test action to test
 [if (Pooly.GetDisabledCloneCount(enemy1) == 1)]

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Event Verification
« Reply #4 on: October 28, 2017, 03:01:11 PM »
hi, use a public bool that sets to true when you if statement is == 1. drag the script into your editor and get the bool variable, use the bool test action to test
 [if (Pooly.GetDisabledCloneCount(enemy1) == 1)]

Thanks, it turned out, but the Pooly for some reason immediately gives out true, although not even all the prefab clones appeared on the scene (and in theory should give out true when the prefab clone is Despawn)

Ofonna

  • Full Member
  • ***
  • Posts: 230
Re: Event Verification
« Reply #5 on: October 28, 2017, 04:04:06 PM »
hi, use a public bool that sets to true when you if statement is == 1. drag the script into your editor and get the bool variable, use the bool test action to test
 [if (Pooly.GetDisabledCloneCount(enemy1) == 1)]

Thanks, it turned out, but the Pooly for some reason immediately gives out true, although not even all the prefab clones appeared on the scene (and in theory should give out true when the prefab clone is Despawn)

hi does that function check to see if the enemies in the scene are disabled, like object pool, to re-activate them instead of instantiating?

you could easily accomplish this with playmaker too

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Event Verification
« Reply #6 on: October 28, 2017, 04:47:17 PM »
hi, use a public bool that sets to true when you if statement is == 1. drag the script into your editor and get the bool variable, use the bool test action to test
 [if (Pooly.GetDisabledCloneCount(enemy1) == 1)]

Thanks, it turned out, but the Pooly for some reason immediately gives out true, although not even all the prefab clones appeared on the scene (and in theory should give out true when the prefab clone is Despawn)

hi does that function check to see if the enemies in the scene are disabled, like object pool, to re-activate them instead of instantiating?

you could easily accomplish this with playmaker too
it performs the following function:
To find the number of despawned clones in the pool for a certain prefab
but for some reason in the playmaker, the Boolean value is returned at once without paying attention to whether the object is destroyed or not.

Ofonna

  • Full Member
  • ***
  • Posts: 230
Re: Event Verification
« Reply #7 on: October 29, 2017, 01:53:05 AM »
hi, use a public bool that sets to true when you if statement is == 1. drag the script into your editor and get the bool variable, use the bool test action to test
 [if (Pooly.GetDisabledCloneCount(enemy1) == 1)]

Thanks, it turned out, but the Pooly for some reason immediately gives out true, although not even all the prefab clones appeared on the scene (and in theory should give out true when the prefab clone is Despawn)

hi does that function check to see if the enemies in the scene are disabled, like object pool, to re-activate them instead of instantiating?

you could easily accomplish this with playmaker too
it performs the following function:
To find the number of despawned clones in the pool for a certain prefab
but for some reason in the playmaker, the Boolean value is returned at once without paying attention to whether the object is destroyed or not.

hi, it must be your script, put a debog.log or print function right above where you set the bool to true to see if it returns true in the script, there's no way the bool will return true to playmaker if your script doesn't return true.

Poltor

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Event Verification
« Reply #8 on: October 30, 2017, 05:34:05 AM »
hi, use a public bool that sets to true when you if statement is == 1. drag the script into your editor and get the bool variable, use the bool test action to test
 [if (Pooly.GetDisabledCloneCount(enemy1) == 1)]

Thanks, it turned out, but the Pooly for some reason immediately gives out true, although not even all the prefab clones appeared on the scene (and in theory should give out true when the prefab clone is Despawn)

hi does that function check to see if the enemies in the scene are disabled, like object pool, to re-activate them instead of instantiating?

you could easily accomplish this with playmaker too
it performs the following function:
To find the number of despawned clones in the pool for a certain prefab
but for some reason in the playmaker, the Boolean value is returned at once without paying attention to whether the object is destroyed or not.

hi, it must be your script, put a debog.log or print function right above where you set the bool to true to see if it returns true in the script, there's no way the bool will return true to playmaker if your script doesn't return true.
Thanks, the problem was solved.