How do I Work with multiple conditions per event

Get help using Construct 2

Post » Thu Mar 24, 2016 11:39 pm

I'm trying to set up an event to trigger while a monster is not on screen The way I am trying to make it work is by having a condition to spawn the monster ONLY WHEN another monster is not on screen.

And IF there is a monster on the screen the button will instead destroy it

I Tried several methods for making this work.

(Method 1)

I grouped all of my monsters into a family and gave it a Boolean for spawned. default is false

I then have two conditions set up for one set of events (Clicking add another condition)
First condition is that there are no monsters spawned
Second condition is when a button is clicked

So In my mind the way this is laid out is (If there are no monsters on screen, and the button is clicked. Spawn a monster)

This should trigger the event to spawn any one of my monsters but it doesn't the screen just stays blank

If I remove the Boolean condition I can spawn an infinite number of monsters but that's not what i want

(Method 2)

Rather than use Boolean I tried the same as above with an instance variable swapping between 1 and 0

No luck there either

I think I'm setting these conditions up wrong but cant think of any other way to do it :oops: :oops:

Here's a screenshot Just in case I'm not being clear
http://i.imgur.com/Y9NlF8U.png
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Thu Mar 24, 2016 11:50 pm

Those are instance variables. Since there are no monsters, they can't be checked. You can use Monsters.Count to see how many exist. So, in event one, check Monsters.Count=0.
ImageImageImage
B
71
S
22
G
248
Posts: 3,759
Reputation: 138,069

Post » Thu Mar 24, 2016 11:55 pm

blackhornet wrote:Those are instance variables. Since there are no monsters, they can't be checked. You can use Monsters.Count to see how many exist. So, in event one, check Monsters.Count=0.


How would I check for monsters.count? Do I chose instance variable still or do i I select something else entirely
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Fri Mar 25, 2016 12:24 am

"Compare two values"
ImageImageImage
B
71
S
22
G
248
Posts: 3,759
Reputation: 138,069

Post » Fri Mar 25, 2016 12:47 am

blackhornet wrote:"Compare two values"


Thanks for the help and now how would I add something to that value?
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Fri Mar 25, 2016 12:51 am

I don't understand the question.
ImageImageImage
B
71
S
22
G
248
Posts: 3,759
Reputation: 138,069

Post » Fri Mar 25, 2016 12:54 am

blackhornet wrote:I don't understand the question.

OH nevermind i think I made it more complicated in my head. The act of spawning a monster increases the count
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Fri Mar 25, 2016 12:57 am

Now second part of my problem I can get things to spawn once and thats great =D But now how do I set it so If something is spawned it will instead destroy that object.

I just tried spawner clicked and monster.count = 1 then destroy but that doesnt seem to work that stops things from spawning again
B
9
S
4
G
2
Posts: 39
Reputation: 1,805

Post » Fri Mar 25, 2016 1:06 am

Don't split up the events. Chances are you are spawning and deleting immediately. Make a sub-event for the count check.
On click
-> Monster.Count =0 -> spawn
-> Else
-> destroy
ImageImageImage
B
71
S
22
G
248
Posts: 3,759
Reputation: 138,069

Post » Fri Mar 25, 2016 1:15 am

blackhornet wrote:Don't split up the events. Chances are you are spawning and deleting immediately. Make a sub-event for the count check.
On click
-> Monster.Count =0 -> spawn
-> Else
-> destroy



Thank you so much its working correctly now
B
9
S
4
G
2
Posts: 39
Reputation: 1,805


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests