MoscowModder's Forum Posts

  • Ah, nice! Thanks rhg1968!

  • DiegoM - Hmm. It's not as elegant as I might like, but I suppose that could work.

    Perhaps some day I'll learn the addon SDK and develop my own plugin for this.

  • Yeah, that sounds pretty similar to what I have.

    Using the layout name in the function call sadly won't help me because I also have a Pause menu that appears in most layouts. Some layouts have both the pause menu and another menu.

    I might swap out my own equivalent to your OnKeyPressed functions from callbacks to functions for consistency. I felt that might take a small performance hit, but it could be worth it.

  • Unfortunately, signals don't take parameters, which I rely on in many places.

  • Right. I am not doing this for repeatable bits of code. That's what I use the native Functions feature for.

    I'm only using the old Function plugin because it just so happens to provide exactly the functionality I need for callbacks.

    If we had custom events on objects, I could replace a lot of this. But I can't.

    I'm not asking how functions work. I am asking if there is anything else out there that could do exactly (or approximately) what I am doing now.

  • Okay, how about this case then: control inputs.

    My game supports both keyboard and gamepad inputs. All of these inputs are customizable with an in-game menu.

    I have 2 kinds of checks, similar to the built-in Keyboard & Gamepad plugins:

    * inputDown(control): Checks if the given input is being held down. Implemented with a native function. Checked with an expression.

    * inputPressed(control): Event called when this button is pressed. Implemented with the Functions plugin.

    For example, here's the code in my Controls event sheet that fires these events:

    And here's the code in my Menus event sheet that listens to keyboard input while a menu cursor is active:

    And here's the code in my Player event sheet that also listens to some of the same events:

    So basically, when I press a keyboard/gamepad button, the controls module sends out a callback that a playable character or a menu cursor or something else might possibly listen for. I can't make a single function out of all the possible things that might happen when you press a button.

  • My problem is that C3 functions can only have one definition in one event sheet, where as the Function plugin lets you define a response to the same function call multiple times.

    I need callbacks that can have multiple different effects depending on what event sheets are loaded. For example, my "on menu item selected" callback that's fired from my global Menus event sheet, which has a different callback listener on each event sheet that has menu items defined in it.

  • When I opened Construct 3 after the last update, it warned me that the old "Function" plugin (a carryover from C2) is deprecated and may be removed. In my project, I use that alongside the new-style C3 functions. My reason is that where the C3 functions have a single definition, the old Function plugin lets you define a function in multiple places. This, to me, makes it a perfect event/callback system. A piece of code can fire off an event without knowing if there will be a piece of code in the current event sheet that listens for it.

    For example, I have a callback-style function called "checkpointDone". Note that I changed the name of the "Function" plugin to "Callbacks" to reduce ambiguity.

    In this code, I have a standard function that will save the game at a checkpoint.

    Then, in this code for a specific level, the game is supposed to wait for the checkpoint to finish saving before it does something.

    I have many, many other uses of this plugin, including the callback when my universal menu cursor selects something. In this specific case, this would easily be handled by custom object events (similar to custom actions), if only C3 had those.

    Is there another method I could do to accomplish the same purpose?

  • Update: Ashley responded to my bug report and explained that in JS, you can check the `isEndingLayout` property of the event object in your listener to tell the difference.

  • Yeah, considering they changed that behavior in event sheets, that seems like an oversight.

    Anyway, I guess as a workaround I can just use an event sheet trigger to call my JS function for now.

  • I managed to replicate this behavior in a minimal example project. It's pretty consistent.

    I attached listeners to "MyObject"'s destroy event in event sheet and script. Destroying it directly triggers both. Changing layouts (in event sheet or script) triggers only the script listener.

    https://www.dropbox.com/scl/fi/uhbib9wozk9jct0qv9hnc/DestroyListenerTest.c3p?rlkey=7vu1msqyakrfq41qqhnyykjny&st=71wppsf2&dl=0

    I'm going to submit this as a bug and see what response I get.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, the layout change is triggered from an event sheet.

  • As the title suggests. I think when I use Construct 3 events, the "On destroy" events/conditions won't trigger when the layout ends.

    However, when I do the same thing in JS, every object with an on-destroy event DOES trigger. In this case, that involves a sound effect so this is very undesirable.

    Is there any way to prevent this from triggering, or detect within the callback if the layout is being ended?

    obj.addEventListener("destroy", () => { /* Do stuff */ });
    
  • I'm using the "Initial animation" property within a timeline to have multiple objects set their animations. Some of these animations need to play in a loop, but during the timeline, they'll be stuck on frame 0.

    Is there a way to let these animations play out naturally this way, or do I need to use events to set the animations instead?

    Edit: Alternatively, is there a way to set the "Initial frame" property in such a way that the frames will loop without needing to set every single frame change on the timeline?

  • I'm trying to release my game for Win/Mac/Linux on Steam. On Windows, it works fine. On Linux, the Steam overlay doesn't show up even though the Greenworks plugin is able to get my user ID.

    I followed the steps listed here: https://www.construct.net/en/make-games/addons/84/greenworks/documentation

    * The steam_app_id.txt file contains my app's ID. I tried to save it in ANSI encoding but I can't be 100% it's the right encoding.

    * I used chmod a+x on the two Steam API .so files.

    * I downloaded my game, and overwrote its download folder with this minimal test project so I could launch it from Steam.

    I know you can't run this project in Steam, but I don't suppose anyone can see anything clearly wrong with this project?

    You can download the c3p file and output here: https://www.dropbox.com/s/nk4li6q1di8pw8p/steamtest.zip?dl=0

    Has anyone else gotten the Steam overlay to work on Linux? Did you need to do anything different besides what's in the linked tutorial above?