MoscowModder's Forum Posts

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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

  • Ah, thanks for the tip. Unfortunately some other issue I can't pin down is preventing me from running the game in NWJS mode at all, so I can't test it immediately. However, once that issue goes away, I'll try out the redraw plugin.

  • Before you ask, "why aren't you using Construct 3?", I have already migrated my new project to C3. However, my old project, already released to Steam, is done in C2 and it isn't feasible to migrate it over. So now I'm stuck supporting an existing game on an unsupported engine with an unsupported Steam plugin.

    I have a bizarre issue when my game runs in Steam. Whenever I pause the game or cover the screen with a blackout wipe, then the transparent background will flicker on and off while the opaque game layers behind it stay still.

    This seems to be a recent issue, and it only happens while I'm playing in Steam (it's fine when running standalone), and this issue retroactively appeared in earlier versions of the game that had been running fine.

    When I first implemented Steam support, I followed the advice of the Steam4C2 creators and created an invisible square object that moves in a sine pattern,

    Tagged:

  • Ah, thank you! Good to know.

  • I'm trying to write a set of unified methods to handle save data using either LocalStorage (for preview and a possible web release) or NWjs (for the desktop release). I'm having trouble getting the former to work, and I wonder if it's because LocalStorage is async while NWjs uses synchronous read/writes.

    Anyway, I'd like to write a JS method to call the correct storage handler internally in one method. Is it possible to access the NWjs object type and its methods (specifically create folder, write to file, and ReadFile) from the JS API? I examined runtime.objects.NWjs.getFirstInstance() and didn't find anything helpful on there.

    Edit: I know I can just make a C3 function that returns the value of NWjs.ReadFile() and call that from JS. I just wonder if there's a more direct approach.

    Edit 2: While I'm asking API questions, can I check the "System | Is in preview" property from JS too?

    Tagged:

  • Well, that's unfortunate. I use the NWJS version because it lets me save to a local file, and I'm building my game as an NWJS app and I use the associated plugin to manage my save data.

    Is migrating to the browser version, and using export instead of save to get local files, my only option for debugging?

  • Whenever I try to start up my project in debugger mode, Construct 3 instantly crashes. I'm using the NW.js version of C3, and this is a very big project so I'm not going to try to reproduce this in a test project.

    Is there any crash log I can look up to try to get some diagnostics or a stacktrace to explain why the debugger isn't working?

    Tagged: