How do I Load List of Names to Randomly Pull From (JSON?)?

0 favourites
From the Asset Store
Progress\Loading Bar. Now Load you game like a Professional.
  • FileChooser Click action only emulates a click on this object. You still need to wait for the user to pick the file they want to load.

    So you can't put AJAX Request immediately after that. You need to use "On changed" trigger and request the selected FileURL, not "teams.txt":

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, I have this all set but am stuck at the "do your own thing part" haha. That's precisely my issue! I'm so close, but while I have it setup to allow a user to load in their own teams.txt file, it doesn't seem to be connecting/replacing the existing teams.txt as when I run the simulator again after loading the teams.txt, the names are not changing.

  • What do you mean by "replace the existing teams.txt"? You can't physically replace a project file with some other file in runtime.

    What you can do is ignore the project file and load the data from the file provided by user.

    If you want to save the data between sessions, you will need to save the list of teams (either from the project or provided by the player), say, in Local Storage. Then the logic could be something like this:

    On start of the game:
    
     If Local Storage has saved data -> Load teams from Local Storage
     Else: 
     ...Ask if the player wants to use standard teams
     ...If yes -> Load from teams.txt
     ...Else -> show FileChooser dialogue and load from selected file
    
    
    At the end of the session/level -> Save current teams in Local Storage
    
  • Yeah, this should work. I'm having trouble following which plugins would contain these parts to get it up and running. I like what you laid out though.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)