Sofa_King's Forum Posts

  • You do not have permission to view this post

  • It seems a little strange to me that my only option is the load it as 'LastData'. There must be a way to call it up using the 'Tag' that I set when it was loaded in the AJAX.

    Update: I got it to work. I had to use the 'LastData' action, but it works.

  • I will do this and then report back. Thanks! :)

    Alas, I added the JSON object to my project and tried to 'JSON.Download', but it made my browser download the file to my desktop... lol. Cool but not what I was going for.

    Also, I went onto the online guide and it says the following:

    It seems a little strange to me that my only option is the load it as 'LastData'. There must be a way to call it up using the 'Tag' that I set when it was loaded in the AJAX.

  • The idea you mentioned in the first post is the reason why i'm running into problems. I know that I can 'Load JSON from AJAX.LastData' but I dont want to do this, because then I would need one array for each JSON that I am load (because if I didnt load it right after, the second JSON in the string of commands would replace the first as the new 'last data').

    And... is there a reason you're using the ajax request? Normally that's to contact an external website to get data but I don't see any url info in your request. Is that json file stored in the project? If so, you should be able to just Json.download | "Working_Word_List_Array.json"

    I could be wrong about that. Haven't worked with loading json directly from files either.

    Cool! I will give that a try. I was using AJAX because that's the only way i've seen to load JSONs from my project files in the past, but what you said seems way easier.

    I will do this and then report back. Thanks! :)

  • I'm still a newbie, but my first thought would be to put the variable 'AttackPattern' as a variable on the monster sprite itself, instead of as a global number, just to clean things up a little.

    That way you might be able to have more than one monster?

  • What am I doing wrong? I just can't seem to make this work. The 'set size' to (9, 36) action is working successfully, but in the debug i'm just seeing a zeroed out array of that size.

  • (JSON) AND linked to the Dictionary documentation which explains the expression for saving/loading a Dictionary as JSON.

    To Save Data:

    Condition: Whatever condition you want

    Action: Instant Games>Set Player Data>Dictionary.AsJSON

    To Load Data:

    Condition: Whatever condition you want

    Instant Games>Load Player Data

    Instant Games>On Loaded Player Data>Dictionary>Load From JSON string>InstantGames.PlayerData

    Hi twg and everyone else :D Old thread, but a new and related question:

    Can I substitute the data saved into a dictionary for data saved into an array, and then save that to the Instant Games network?

    Thanks,

  • Woah! I was able to download one! Thank you so much! This has come exactly at the right time!

  • Have you completed the Beginner's Guide tutorial? It doesnt deal with swords, but I think it would give you a good starting point.

  • This is an issue for me as well. Is there a reason why C3 caps out at 144? It seems arbitrary to me and an easy thing to fix.

  • Mikal That C3P! Thanks. It was helpful to see it in action.

    mekonbekon Thank you, for breaking it down step-by-step.

    I think I understand the logic behind this method. I have tried to implement what you guys have been saying, but I keep ending up with errors. So I think it's probably stemming from somewhere outside the randomization logic.

    I. Give. Up. I cant keep trying to do this because its killing my drive to actually get the work done. At some point down the line, i'm going to revisit this thread and figure it out, but for now, i'm going to stick to the following idea based on what AllanR said.

    AllanR Dude, your right about it already being randomized. I took that a little further and just made a simple 'random 0-3' variable and that seemed to be enough to randomize the text values that I was pulling.

    For some reason the animation frame selection is still not syncing up correctly and I have no idea why not. In the screen capture, you can see the I have disabled the first two lines of code. This code just pulls the info from the 0 Y-axis. The frustrating thing is that this works perfectly every time, but the randomized Y-axis code doesn't work (it works for the text values, but the frame selection is fucked).

    My image sprites are 19 animation frames, named 0, 1, 2, 3 ..., 19, which correspond to the IELTS_Array which is also 0 to 19.

    Anyways my friends, thank you so much for walking me through this step by step! I will 100% revisit this thread in the future. I really appreciate the time you guys took to help me. It's unfortunate that I wasn't able to implement it, but I will at some point.

  • AllanR I really appreciate the time you took to write that! I understood most of what you said, but I am still struggling to implement Mikal 's code or the code in the aforementioned tutorial. I feel like you both gave great information, but no matter what I try to do, I keep getting 0, NaN, or text values from other locations in the first array.

    I decided to try my own code that (in my head) should work. Perhaps you could stake a look and identify why its not working? Keep in mind that I am trying to pull the Y values from (0 to 3) in the 'Working_Answers_Array's Y axis, and randomly place them into 'Working_Answers_Array_Shuffled' at random random Y value locations. I then will pull these text values from 'Working_Array_Shuffled' and use them to set the in-game text.

    Why doesn't this work!??! It works in my head... :(

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Shuffle array function below. Uses new 'beta' function feature, but should be easy to translate to older function or just plain events.

    Thank you for your reply. I imitated your event sheet as close as possible, but it gave me some pretty serious errors (0 in some places, and jumbled data in other places).

    If you have the time, could you explain how this works? I cant 't understand what it is supposed to be doing.

    a

    - Why are you subtracting one from the width in the first system event? ("from 0 to Array.Width-1")

    - Why are you subtracting the LoopIndex from the Array.Width in the 'set RandomIndex' action?

    - How does this lead to a shuffled array?

    - Will it work with text values in the array?