drunkenoodle's Recent Forum Activity

  • Hi All,

    I have a small predicament where I have two different npcs that exist in a family. Now each of these npcs has their own instance variable which is an ID. This ID doesn't actually ever change, as it points to a piece of content for that particular entity (a conversation for instance).

    But when I add them to a family, I can't actually access that static instance variable any more. I can get hold of it by converting it to a JSON string, but I figured there might be an easier way.

    This is different from the family instance variable, it's kind of one layer in instead. Another example might be that you have a fixed name on that particular entity, but again you wouldn't be able to access it via a family of npc types.

    Is there another way to get around this that anyone might know of? Hope this question makes sense, I can add more clarity if needs be.

    Thanks very much!

  • Alright then let's get down to business. So I've managed to split out what I need from the data structure I've had auto-generated by the C2 data editor. As I'm still a newbie, it doesn't 100% make sense yet, but I think I'm getting there. So I'll break it down in to sections in case it's useful to anyone else:

    Task 1: Generate initial data structure and exported (not perfect, and has some un-required bits, but it's a start).

    {
    	"c2array": true,
    	"firstRowIsColumnNames": true,
    	"size": [4, 2, 1],
    	"data": [
    		[
    			["belongsTo"],
    			["str"]
    		],
    		[
    			["player"],
    			["Hi, I don't suppose you have any materia?"]
    		],
    		[
    			["npc"],
    			["Er, we're fresh out actually. But feel free to take a look anyway."]
    		],
    		[
    			["player"],
    			["Oh, ok. Let's see what you have."]
    		]
    	]
    }
    [/code:32g4u4ru]
    
    Task 2: As a test, extract two things a) the name of the entity saying the sentence, b) the actual sentence:
    
    1) JSON string above is stored in a variable,
    
    2) Load that string in to an array using 'load json string' action,
    
    3) Set a new variable that gets the 'array.At(0, 1). This will basically go a level inwards and get us a sub array of entity names and strings.
    
    4) Make a secondary array that will store the current indexed data from step 3
    
    5) Within that new array, you can now access the data at (1, 0) and (1, 1), which will return the entity name and the string next to it.
    
    It's a bit rough and ready, and still have to get my head around it some more (hence why it may not make sense just yet), but it's getting there.
    
    I hope this helps anyway. Cheers!
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply mate, sorry it's taken a while to reply! I think I'm finally starting to understand. My brain was in a strange limbo between using recursion to get what I need, and the way C2 does things. But the 3D array stuff is making more sense now.

    Hopefully it'll work out okay when it all clicks in to place! I'll post up on here how I achieved the result when I get something working properly.

    Thanks again!

  • Hello everyone,

    I was searching for a solution to create a dialogue system that will be included in various adventure games / rpg's. And decided to purchase the C2 data editor to do the leg work, and it's awesome!

    But, I'm having a complete blank moment, and have gotten a bit stuck with how to deal with accessing the nested data within the structure (in this instance, an array of strings that sit inside a conversation object).

    Now some of the helper functions are useful in that they return certain row numbers based on your query, so that's great. But the main problem is what to do after that really.

    For example (apologies if it looks a bit messy):

    {
    	"c2array": true,
    	"size": [2, 2, 1],
    	"data": [
    		[
    			[1],
    			["{\"c2array\":true,\"firstRowIsColumnNames\":true,\"size\":[4,2,1],\"data\":[[[\"belongsTo\"],[\"str\"]],[[\"player\"],[\"Hi, I don't suppose you have any materia?\"]],[[\"npc\"],[\"Er, we're fresh out actually. But feel free to take a look anyway.\"]],[[\"player\"],[\"Oh, ok. Let's see what you have.\"]]]}"]
    		],
    		[
    			[2],
    			["{\"c2array\":true,\"firstRowIsColumnNames\":true,\"size\":[1,2,1],\"data\":[[[\"belongsTo\"],[\"str\"]]]}"]
    		]
    	]
    }
    [/code:3334wj70]
    
    Here I'd like to access the first set of data in the c2array, and, from within that, access each individual string. You might notice the 'belongsTo' property, that's basically where I want to end up.
    
    So my conclusion was to store that nested data within a different array, then I can cycle through it and show it on the page using the array.at() expression.
    
    But, my struggle comes when making the link between the JSON string, and then getting that sub data in to an array to access...
    
    Hope this all makes sense, thanks for your time!
  • Ah I see what you mean. Thanks very much for clarifying!

  • Ah that's a good idea actually. Thank you! I take it construct has its own special format due to the fact it needs to work on many different devices? Or is it just simply the way it's written?

  • Hello everyone,

    it's been a long time since I've been back here but glad to be back at the same time. I've recently been playing around with Construct 2 in the hope of creating a very simple RPG mechanic. But, I hit a roadblock when I found that I couldn't seem to get C2 to respond to the JSON format that I was passing .

    For example the following just wasn't getting me anywhere (as an array of objects):

    [{
    	"id": "1",
    	"string": "This is a string that belongs to the id of 1."
    }, {
    	"id": "2",
    	"string": "This is another string that belongs to the id of 2."
    }][/code:1ixvpplt]After some searching I found a couple of examples, so I could probably work with those. But I have a couple of questions, one being, why does Construct require a special format when it comes to JSON exactly? Or, is it the simple case that I'm just not doing it right by loading as Ajax and parsing it in to an array or dictionary?
    
    And secondly, is there some form of reference in the manual that I've overlooked that goes in to detail about it?
    
    My apologies if I've overlooked the obvious, but I'm not having too much luck and wondered if anyone else had a similar issue.
    
    Thanks!
  • Evening!

    Great plugin, just got it hooked up like a charm. Just wondering one thing though and this may be me being totally stupid, but I take it that we can't run this using preview mode?

    I mean, the project has to be exported every time we update anything such as event sheets on the capx?

    It got me wondering as I've been trying to get it working from the preview side, but wasn't sure if Construct has things in place that prevented one from doing so.

    (hopefully it's not too late to post on this thread!) :P

    Cheers!

  • Ah that's actually a really good idea, much better than getting all tied up with crazy matrix equations and things, I shall give that a try! Thank you very much for your reply! :]

  • Hello everyone,

    I'm wondering if it's at all possible to change the scale of a 2D sprite, dependent on where the horizon line of a background image is.

    For example, some games such as the first Resident Evil, Final Fantasy 7 seemed to be able to simulate a different scaling value as the player approached the back of the screen in some scenes (running down a corridor, etc).

    So far I've been able to create this effect but only on a singular vanishing point basis (looking straight in to the distance), but since the observer would potentially be looking down upon the player, this would require a 3 point perspective approach.

    I've read a few articles about it and am still a bit unsure about where to begin properly (after getting up to scratch with trigonometry of course) ;) Including the article on here about pseudo 3D games, which worked a treat, only, I wasn't really sure how to apply that to if you were looking down (again from a 3 point perspective idea).

    But I felt it a good idea to ask on here in case anyone else had either encountered the same problem, or, had wondered the same. If you have any ideas or could help in any way, it would be massively welcome.

    Thanks for reading and all the best!

drunkenoodle's avatar

drunkenoodle

Member since 29 Nov, 2013

None one is following drunkenoodle yet!

Connect with drunkenoodle

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies