How do I trigger once, wrong use?

0 favourites
  • 10 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • I just discovered the "trigger once" mechanic and it looks useful. I am trying to spawn a sprite to orbit around the character, but when the conditions are met, it is not happening. Even if the vent triggered once, it should still orbit correct?

    The issue I was trying to solve, was that Create Object was creating many objects in orbit so it just looked like a complete circle around the character hence the Trigger Once solution.

    Is this the right use case?

    thanks

  • Trigger Once is one of the most misunderstood features in Construct and many people are using it incorrectly, which often causes serious bugs. My advice - don't use it unless you are 100% sure what it does and how it works.

    It's hard to tell by your screenshot why the code doesn't work. What exactly are you trying to achieve?

    If you want to add 1 utensil to each farci_input, it's much easier to do this manually in the layout editor. Add utensil sprite as a child to farsi_input, configure Orbit behavior and it will rotate around the parent.

  • I just discovered the "trigger once" mechanic and it looks useful. I am trying to spawn a sprite to orbit around the character, but when the conditions are met, it is not happening. Even if the vent triggered once, it should still orbit correct?

    The issue I was trying to solve, was that Create Object was creating many objects in orbit so it just looked like a complete circle around the character hence the Trigger Once solution.

    Is this the right use case?

    thanks

    Hi.

    It looks like you want to make mechanics as shown in many commercials, where weapons like swords rotate around the player.

    I recommend you to check all text objects and then compare their contents.

    Trigger once in your case will not help, it is better to check the number of objects on the sheet before creating, if zero then create a new one, you can compare with a variable limiting the maximum number of spoons. This way you can add many weapons of the same type.

  • Hi.

    It looks like you want to make mechanics as shown in many commercials, where weapons like swords rotate around the player.

    In that case I have an example: dropbox.com/scl/fi/3r96xbou4uoqrkxjmi9jr/aero_sword.capx

  • In that case I have an example: dropbox.com/scl/fi/3r96xbou4uoqrkxjmi9jr/aero_sword.capx

    That's funny.

    I wanted to create an example like that too.

    File *.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • igortyhon I was inspired by aerial blade from 'Blade Kitten' so there my take on it.

  • > I just discovered the "trigger once" mechanic and it looks useful. I am trying to spawn a sprite to orbit around the character, but when the conditions are met, it is not happening. Even if the vent triggered once, it should still orbit correct?

    >

    > The issue I was trying to solve, was that Create Object was creating many objects in orbit so it just looked like a complete circle around the character hence the Trigger Once solution.

    >

    > Is this the right use case?

    >

    > thanks

    >

    >

    Hi.

    It looks like you want to make mechanics as shown in many commercials, where weapons like swords rotate around the player.

    I recommend you to check all text objects and then compare their contents.

    Trigger once in your case will not help, it is better to check the number of objects on the sheet before creating, if zero then create a new one, you can compare with a variable limiting the maximum number of spoons. This way you can add many weapons of the same type.

    Hi Igor, I really appreciate you taking the time to help me.

    My first question is, my core mechanic is that users will say a word like "knife" and this will cause something to happen. In this case a knife will start rotating around the player. I am capturing that input by reading what is going into the text box "farsi_input". Is there a better way to do this? Should I be storing this in a variable instead and doing the check against that?

    The challenge this poses, is that it will often spawn many objects because the condition stays true and I often want just one.

    I am having trouble understanding the blue and red text you provided. For the System check every 1 to 10 seconds, I want this to be event driven, based on the word spoken, so whats the purpose of that check? Then the For Each loop makes sense to check whether the utensil was created or not.

    thanks

  • > Hi.

    >

    > It looks like you want to make mechanics as shown in many commercials, where weapons like swords rotate around the player.

    >

    In that case I have an example: dropbox.com/scl/fi/3r96xbou4uoqrkxjmi9jr/aero_sword.capx

    hi Alex, thanks for the example, its cool what you built. I am happy with the item just orbiting around the player, what's been challenging is getting just one item to orbit upon saying the specific word and then having it be destroyed when the other word is said. What Igor suggested makes sense so I will experiment with that but it looks like I will always need to have variables to check the count for whatever word I say throughout the game which feels very tedious and inefficient. Maybe this is just part of my learning curve

  • That's okay going on your route that way. You can store several words in variable, list, array, dictionary or even text. Threat them as string so you can use tokenat to pick a word that met certain condition. For example you have variable "utensil" with value: fork#spoon#knife

    Now you can check in condition whether there is any value has one of these word:

    For 0 to 2

    farsi_input = Tokenat(utensil, loopindex, "#")

    Trigger once

    Then you can call object based on farsi_input with whatever you want to do with them. Put those object in Family or separate them in different animation name will make things efficient.

  • hi everyone, I got it to work!! thank you so much for the help, adding the variable to count the number was important as well as creating the object BEFORE pinning it. Here is the final result if anyone else needs it

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