About triggers event

0 favourites
  • 8 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • 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 ?

  • 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

  • Gearworkdragon

    have you tried with collision event?

    as in example image.. (go to url)

    pasteboard.co/18I5yGRg.jpg

  • 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 ?

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You could add a variable to the chest sprite to identify if the chest has random loot or fixed.

  • 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 ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)