MoscowModder's Forum Posts

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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • pandabear7413 As a matter of fact I did, but it's not pretty.

    First, I put in keyframes named "Animation|objectName|myAnimationName"

    I have an event with the conditions:

    • On any keyframe reached
    • find(Timeline.KeyframeTags, "Animation") >= 0

    In the actions for this, I have the following JavaScript snippet. This parses the object name and animation name out of the keyframe, finds the object, and applies the animation. Note that "localVars.keyframes" is a variable I saved the value of "Timeline.KeyframeTags" to.

    const tags = localVars.keyframes.split(" ");
    console.log(tags);
    
    tags.forEach(tag => {
    	const args = tag.split("|");
    	
    	if(args[0] == "Animation") {
    		// Change an object's animation
    		// Animation|{ObjectName}|{AnimationName}
    		const obj = runtime.objects[args[1]].getFirstPickedInstance();
    		obj.setAnimation(args[2]);
    		obj.isVisible = true;
    	}
    });
    

    This isn't very flexible so you may need to refine it for your own purposes.

  • Yeah, shortly after making that last reply I came to the same conclusion and filed a bug here: github.com/Scirra/Construct-3-bugs/issues/6187

    Ashley has taken a look at it and says it should be fixed by the next beta release.

  • UPDATE: This error has cropped up again. This time, even if I don't have a reproducible case, I DO have a stacktrace and I examined the value to see why the error is happening:

    this is an object with the Platform behavior. While the instance is being saved as JSON when I save the game state,

    this._wasOverJumpthru.GetUID() fails because this._wasOverJumpthru === true. Somewhere in the Construct 3 code, this property is being set to a boolean value when it's supposed to be an object.

    Is this enough to help track down the cause of the bug, in combination with the stacktrace in my first post?

    EDIT:

    I tracked down the offending code in the minified runtime.js:

    this._wasOverJumpthru=!!this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst)

    It looks like this code is incorrectly setting the variable to a boolean when it's supposed to be an object or null. When I call that method without the "!!", it correctly returns an IInstance with a Jumpthru behavior.

  • Great, thank you!

  • For a camera script, I store a reference to the object that the camera is following. When the focused object despawns, I want to automatically detach the camera from it. How can I check if an IWorldInstance has been destroyed? Or can I attach an event handler (still in JS) to fire when this object gets destroyed?

  • Thanks, swapping the JumpThrus with dummy objects seemed to fix the problem.

    I would definitely submit a bug report if I thought I could reproduce this reliably, but it just started happening out of the blue and I can't think of anything these 2 test cases have in common.