Bullet hits a tile (Random action and no action)

Get help using Construct 2

Post » Thu Aug 06, 2015 1:52 pm

This is the case #1:

1) Bullet hits a tile >> Action

2) Bullet hits a tile 2nd time >> No Action

3) Bullet hits a tile 3rd time >> No action
.....

8-12) Bullet hits a tile ( choose randomly lets say between 8th and 12th time) >> Go to 1)


What do we use in this case, what you think?

The case #2:

Bullet hits a tile >> Check
Check1 >> True
Else >> Choose randomly between X actions ( Action 1, Action 2, Action X, No action)
Check2 >> True
Else >> Choose randomly between X actions ( Action 1, Action 2, Action X, No action)
Check 3...

Here, I use Local number Which = 0 .
Image

If I need to make something happen more frequently , lets say I increase the chance that TurretBodyAbove will be created, I do the following
Image

If I need to reduce the chances of actions within the roll , I do the following
Image

Is it correct? Are there better ways to do that?
B
8
S
2
Posts: 48
Reputation: 646

Post » Fri Aug 07, 2015 12:35 pm

I'm not too sure if I perfectly understand, but are you asking for methods on how to achieve what you mention? If yes, this is what I usually do.

For case1, I would use a local variable. For example, after hitting the tile for the first time, check to see if the tile's local variable is 1. If it is, do your actions and set the tile's local variable from 1 to 0. So the next time it hits it, it won't run anymore. If you want it to run for the 1st and maybe the 5th or other number, use a sub event and put the conditions if local variable = 1 "or" 5.

Case two, I usually do this as well. But if you want something to happen more frequently, instead of making 4 events for it, you could do it with just 2. Again just use the "or" event. Which = 1 "or" Which = 2 "or" Which = 3. For the last one, you could do that but if you are going to leave it empty, than there is no need to create the event there. If you have an event running that will reset it or your are not going to run that event again, you can just keep the two events and remove the rest.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Fri Aug 07, 2015 12:42 pm

If you want to increase the chance turretbodyabove would be created you could just use:

Choose(1,1,1,2,3)

I would actually recommend using a function call with the choose as one of the parameters..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Instrex and 25 guests