Ecation's Recent Forum Activity

  • Thank you for your answers!

    dop2000 That is a brilliant function, will definitely keep that one around for reference.

    In my situation, I ended up solving the need of "backing down" or "traversing up" the hierarchy by storing the paths at various points into variables and loading the required nesting level from those.

  • Hi!

    I know I can dig deeper into a nested JSON object by adding new elements to a path.

    For example if I have an array of objects called NPCs then I can add ."my1NPC" to change the path to NPCs.my1NPC and then ".health" to change the path to NPCs.my1NPC.health and so on.

    But is there a way of moving back up in the chain? If the JSON.path is currently set to NPCs.my1NPC.health then how can I back it down back to just NPCs.my1NPC (for example)?

    Tagged:

  • Hi!

    Thanks for all the answers!

    Alextro, I donwloaded your file but didn't quite understand it.

    Dop2000, the Advanced Random -plugin solution looks good!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My goal is to use choose(1,2,3,4) to choose one of four values. But I want to always exclude the value which was chosen previously, which I store in a variable.

    Is it possible to exclude the previously chosen value from the arguments inside choose() with some kind of an expression?

    I would like to keep things simple and not use an array for this.

  • That's a clever and good solution! Thanks!

  • Hi!

    I have some variables in my game that indicate how many ready things the games has so far; for example a variable called "readyLevels" that I use to indicate how many levels the game currently has.

    I'm not certain how to handle these variables on app updates. The problem is that I'm using the save-feature of construct which will save all the variable states. So even if I indicate that the amount of "readyLevels" has increased from 10 to 12, when the end user loads the game, the saved state of that variable will override the new value and set it back to 10.

    What would be a good way of handling such variables when using the save feature?

    Tagged:

  • One thing I miss from After Effects sorely at the moment is a way of evening out the spacing between keyframes in order to smooth the speed of the motion. It's called "rove across time" in After Effects and turning it on will automatically space the select keyframes on the timeline so that the speed of the motion (measured in pixels per second) is always the same.

    I'm animating a character running around the map at the moment and it's quite difficult to keep the speed of the character even somewhat constant without this feature. It's one of those things that is difficult for a human to do but quite easy for the computer to calculate.

  • Okay I simplified the code and for some reason this version works just fine:

    const arrayForSplitText = localVars.randomylChosenScrollText.split((/(?<=[.;:])/gi));
    const a = runtime.objects.ArrayFromConstruct.getFirstPickedInstance();
    
    console.log(JSON.stringify(arrayForSplitText));
    
    a.setSize(10, 1);
    
    for (let i=0; i<arrayForSplitText.length; i++ ){
    	a.setAt(arrayForSplitText[i], i);
    
    }
    
    
  • Hi!

    I'm trying to get into scripting, but can't figure out what I'm doing wrong here. My goal is to populate a C3 Array object using a javascript array.

    Here is my script:

    //creating a JS array by splitting a string:
    const arrayForSplitText = localVars.randomylChosenScrollText.split('.');
    
    //accessing a C3 array object:
    const a runtime.objects.ArrayFromConstruct.getFirstPickedInstance();
    
    //This console log works as expected:
    console.log(JSON.stringify(arrayForSplitText));
    
    //Function someone here on the forums built for loading a C3 array with a JS array:
    function setC3Array(c3ArrayInstance, arr){
    
    	try {
    		const w = arr.length;
    		let h = arr.sort((a, b) => a.length - b.length)[0].length;
    		c3ArrayInstance.setSize(w, h);
    		arr.forEach((x, xi) => {
    			x.forEach((y, yi) => {
    				c3ArrayInstance.setAt(y, xi, yi);
    			})
    		})
    	} catch(err){
    		console.log('Errror on setC3Array function', err);
    
    	}
    
    }
    
    //call the function:
    setC3Array(a, arrayForSplitText)
    
    //What I get is:
    Errror on setC3Array function TypeError: x.forEach is not a function
    

    Tagged:

  • Thank you for all the replies!

    I will try to implement R0J0hound's suggestion next.

  • Hi!

    I'm trying to create a dialogue system in which the input text for a dialogue can be any length. The game should then take the input and break it into chunks that can be displayed comfortably on the screen.

    How can I break a long string into chunks of say 200 characters while also considering the spaces between words (so that a word doesn't get broken in half)?

    Tagged:

  • Hi sachos345!

    I think that trailer was somehow automatically generated by the play store. I wouldn't have chosen those exact seconds from the game myself. I did provide a YouTube link in my play store listing, so perhaps Google captured the trailer from that?

Ecation's avatar

Ecation

Member since 12 Oct, 2020

Twitter
Ecation has 2 followers

Trophy Case

  • 4-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x2
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

8/44
How to earn trophies