MoscowModder's Recent Forum Activity

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

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

  • Sometimes, when I try to use the built in Save function (for checkpoints to load on death), I get the following error:

    Uncaught (in promise) TypeError: this._wasOverJumpthru.GetUID is not a function at PlatformInstance.SaveToJson (runtime.js:9:507) at BehaviorInstance.SaveToJson (behaviorInstance.js:4:172) at Instance.SaveToJson (instance.js:28:407) at objectClass.js:30:45 at Array.map (<anonymous>) at ObjectClass._SaveToJson (objectClass.js:30:30) at C3Runtime._SaveToJsonString (runtime.js:105:420) at C3Runtime._DoSaveToSlot (runtime.js:102:335) at C3Runtime._HandleSaveOrLoad (runtime.js:100:143) at C3Runtime.Tick (runtime.js:76:186)

    Has anyone ever seen this before? This only happens on 2 specific (and large) layouts with a lot of objects using the Jumpthru behavior.

    Case 1: Sometimes when you load the level, some of my Jumpthru objects get despawned immediately (the level changes over the course of the story). The game saves when the player performs a specific action.

    Case 2: The game tries to save 0.1s after the layout starts (to give dynamically-created objects time to spawn). No Jumpthru objects are despawned by this point.

    Take note that the player object (with the Platform behavior) is dynamically created at the start of the layout, as there are multiple players to choose from. Could this be related?

    EDIT: Deleting every Jumpthru object from the layout ahead of time makes the bug go away, so they are definitely the culprit here. I just don't know how to fix this without drastically altering my level design to work without them.

    EDIT 2: Statically placing the player object (instead of spawning it dynamically) does not help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It looks like you're setting the animation to "Crawl" from the beginning every frame. You should either a) make sure it's not already playing the animation you want first, or b) set it to play from the current frame.

  • I know how to convert instances to/from JSON using event sheets - using the expression Object.AsJSON and the action Set from JSON string.

    Is there a way to do the same things from JavaScript? It would be nice to be able to make code that can save/load arbitrary objects of any type without them needing to share a family.

    Tagged:

MoscowModder's avatar

MoscowModder

Member since 24 May, 2013

None one is following MoscowModder yet!

Connect with MoscowModder

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

16/44
How to earn trophies