About triggers event

Get help using Construct 2

Post » Wed Jun 10, 2015 8:09 pm

Ok i get that construct 2 doesn't like two trigger in the same event lines. But yet you can have overlapping as a non trigger. I view overlapping and on collision the same thing.

Atm i want to create an event where when i on hit the collision with a treasure chest and have the space bar pressed to open it sort of like a 2nd condition so that when i am near a chest like stand in front of it or bumping into chest to open it.

But what i cant understand is why does construct two restrict two completely different trigger as one being to detect collision and one to wait for a key press have to be separated but overlapping doesn't it create more headache because i end up having to create more needless event just to get it to work ? oh and i planning on having it be a family event as well so the collision would have solve it all.

and yes the overlapping does not work for the chest alone because of not being able to overlap it dude to solid behaviors.

If anyone like to tell me why on press (trigger) and detect collision (trigger) cannot be in the same event Id like to know ? Will it open a black hole ? will it cause a nuclear meltdown ?
B
52
S
24
G
6
Posts: 391
Reputation: 7,845

Post » Wed Jun 10, 2015 10:14 pm

Edit
try:

on keyboard space key pressed
--Sub event on sprite overlap sprite2 : action open chest
-- Else(or another event overlap): action: Don't open or nothing
Image Image
B
25
S
14
G
139
Posts: 876
Reputation: 72,510

Post » Thu Jun 11, 2015 9:56 am

Message: chanchino can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
@Gearworkdragon

have you tried with collision event?

as in example image.. (go to url)

http://pasteboard.co/18I5yGRg.jpg
B
9
S
2
G
1
Posts: 13
Reputation: 669

Post » Thu Jun 11, 2015 12:27 pm

Thx for the help but i found a better way I am currently using Overlaping sprite that spawn with the chest behind it as well as nearest picked

While we are on topic of chest. Let say we are using the same chest sprite but we want to control the different items that you get from the chest like one for the same random fuction but others a more control such as key item or equipment that must be in this treasure chest What would be the best choice ?
B
52
S
24
G
6
Posts: 391
Reputation: 7,845

Post » Thu Jun 11, 2015 12:42 pm

C2 accept only one triggered condition per event because of how events work.

The event sheet is read top to bottom each execution tick.
As such, the order of the event has an impact on the program's logic.

Triggered conditions are a bit of an exception as they are "triggered" at a different time then when the event is read/encountered.

In your case, what you want is to add a second sprite to your chest, a bigger that acts as an "area of effect" and use the "is overlapping" condition.
When your character is overlapping the range of a chest AND your player presses the action key (so one triggered event), then the chest is opened.

That could give you something like this example capx.

For random drops, I made this tutorial a while ago that could answer your new question.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,312
Reputation: 71,092

Post » Thu Jun 11, 2015 2:03 pm

I get how to do the random fuction to work. Let say that you have two treasure chest of the same sprite. How would i go about coding one to be randomly drop and the other one to be a contant drop.

And while i do know the clone feature but having that many clones would just be idiotic. Is there a way to do a Unique ID of the object and use it to put the contant variable in.

Let say that in a quest you need to find a key but in the room there are ten chest. Three of the chest will always contain a helmet, a sword, and the key. While the other 7 would be the random factor. And i would want to code all of this in a single sprite family form instead of 4 same sprite clone

The idea here is create a contant world that the dugeon master has setup while setting up a away to make it feel personalized such not two of the same person is going to get all the same loot at the same time. This is where the constant variable with the randomness helps with that replayable experience.
B
52
S
24
G
6
Posts: 391
Reputation: 7,845

Post » Thu Jun 11, 2015 3:37 pm

You could add a variable to the chest sprite to identify if the chest has random loot or fixed.
B
12
S
2
Posts: 22
Reputation: 648

Post » Thu Jun 11, 2015 5:24 pm

@Exile03330 You are a genius also I like to add in Put <varies> helps to make the sprite be different as well. Also For those who want to do it correctly in the instance. Do this Variable text <varies> and then once you have them on the screen you can change it to what ever. And to make the event to further separate the difference of the two sprites put in an invert section of when it is not the key do the random.

I have a question regaurding this discoveries Will i have to keep on using Invert fuction for every new constant loot ? or can i just leave it alone and pray that the variable will do it for me ?
B
52
S
24
G
6
Posts: 391
Reputation: 7,845


Return to How do I....?

Who is online

Users browsing this forum: blackhornet and 25 guests