lTyl's Forum Posts

  • 10 posts
  • I do not actively use C2 (Have a business license though), but this method should be easy to port over to C2.

    Basically, I store dialogue in a JSON file and load the files (Via a 'GET' request) into memory when a new level is loaded. The JSON base structure is like so:

    http://aurava.com/labs/code/dialogueTree/dialogue.txt

    the "messages" array stores the dialogue the NPC says. The "setState" property tells the script which index of "messages" to go to when the player advances through the dialogueTree. The "responseIndex" property tells the script which response text to display, stored in the "responses" array, with -1 meaning their are no player responses for that message.

    The "responses" array works the exact same as the "messages" array. It has a setState property and a "message" property. The "message" property is the actual text to display. The setState property sets the message index to that value, advancing the dialogue.

    Here is a (very) rough example of it in action: http://aurava.com/labs/dialogueTree/

    Once you have the basic structure down, then you can expand the JSON file and have advanced things, such as showing certain responses depending on a global variable or anything really.

    It is also very simple to implement, this is the draw text code, located in my update() function:

    this.font.draw( this.data.messages[this.currentIndex].message, x, y );
    // Draw responses, if applicable
    if(this.data.messages[this.currentIndex].responseIndex.length > 1 || this.data.messages[this.currentIndex].responseIndex[0] >=1  ){
                for (var i = 0; i < this.data.messages[this.currentIndex].responseIndex.length; i++){
                    var response = this.data.messages[this.currentIndex].responseIndex[i]
                    this.font.draw(this.data.responses[response].message, 80, 10 *i);
                }
    
            }
    

    Where: this.data is the parsed JSON file. this.currentIndex is the location within the dialogueTree file (Keeping track of which message to display)

    and here is the code for moving around within the dialogueTree file, not including the actual movement code which should be self explanatory anyway (Push down, add one to this.index. Push up, subtract one from this.index.)

    this.response = this.data.messages[this.currentIndex].responseIndex[this.index];
    this.currentIndex = this.data.responses[this.response].setState;
    this.index = 0;
    

    Where: this.index = the location of the cursor and this.response = the index value of the response the player chose.

    I believe Construct 2 comes with a simple AJAX plugin out of the box that has 'GET.' You can use that to download your JSON file. I am not sure if it has built-in compatibility to parse the JSON file out of the box, but I'm sure something exists.

    I'm sure someone could convert this into a Construct 2 plugin quite easily.

    Best,

    Ty.

    EDIT: I just realized this was posted in the Construct Classic section (Whoops :D). The post above still applies, but instead of using 'GET' you can use XML or something and then just load the file directly.

  • You see, my biggest problem is that I am concerned about uploading any actual details about the game in case someone who is much better at using Construct 2 than me makes it faster than I do. I know that it is only a very small amount of people that would do this but I am still concerned.

    Ideas are free and worthless. What has value is the implementation of the idea.

  • I purchased a business license for future use and I will play around with it some more. Are there any plans to update the AJAX object? Such as adding AJAX POST or being able to more easily read the returned GET data?

  • Can this be updated to work with the most recent version of C2? Receiving a runtime error when I use it in Rev 65

  • Hello everyone,

    I made a MMO browser-based game SDK with C# & ASP.NET which primarily interacts with Adobe Flash. However, since my SDK is now almost six years old, it is time to update it, since when it was first released mobile phones were not the powerful pocket-computers we see today. So therefore, I want to drop Flash entirely and update my SDK to use HTML5 too more actively target mobile phone users. (Hell, the 'mobile versions of my games are basically just text at the moment!). Initially I was going to develop my own HTML5 back-end, but with Construct 2 progressing in such a way it would be much cheaper (And faster!) to integrate Construct 2 with my C# back-end and use C2 for my HTML5 needs.

    However, I have a question regarding the AJAX object. When you pass a Request to a file, will the code behind of that file be processed? As an example, say I want to collect the strength of a unit from a database I would pass along something like this:

    domain.com/gatherunitdata.aspx?unitid=17

    So that page takes the unitid of 17, connects to a database and returns the data as page content for Construct 2 to then use in the application. Would this work, or would Construct 2 just go to gatherunitdata.aspx and find a blank page?

    Thanks ^^

  • Try using the 'Enemy' family, which you already have set for the bird enemy. I changed a few events to use the family instead of the individual object, and the second bird enemy you have started working accordingly.

    Screenshot showing both birds jumping and the portion that I changed.

    http://img638.imageshack.us/i/unledyw.png/

  • Here's three different ways of doing it:

    <img src="http://img41.imageshack.us/img41/4854/15449449.png">

    <img src="http://img8.imageshack.us/img8/6515/84213026.png">

    <img src="http://img252.imageshack.us/img252/4372/98556401.png">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is my method using the Function object and Private Variables:

    http://www.4shared.com/file/CNBccmC6/RPG_Stats.html

  • *One month old topic bump : <*

    This is great! I was wondering if you could post the PHP Script so we can take a look at it =D

  • Hellllo, I was working with Construct for a few months now and I recently started on the framework of my first serious project using it, however I have some questions:

    1.) Is it possible to Add an Effect to an object while in runtime? For example, in the Editor I create a Green box with No effects, can I later add an effect to the object inside the game? One way to do this is to add the effects for the Object and then disable them, however even if the effects are not loaded it takes VRAM =/. So is there a better way of doing t?

    2.) Can you Import graphics while in Runtime? For example, you create an object with a blank graphic, can you come back to that object and give it a graphic at a later time? The reason why I want to be able to do this is to make adding new content/expansions easier and with a smaller filesize. (Ie. Instead of just shipping an entirely new EXE with the changes as well as the old content, I just need to send out the changes)

    Thanks.

  • 10 posts