Nilom's Recent Forum Activity

    move on - which is what we do ourselves with all other software when we need something more than they provide

    You mean move on like giving GDevelop a try? Maybe you are right and the time has come. I will definitely not risk not being able to open my projects anymore. While you more and more close-source Construct I will look for more open-source alternatives where the community is actually given a voice.

  • Okay thank you. Than I will just stick to using templates and use my suggestion votes for multiplayer or native android export features (lol) instead. :D

  • Are there any updates on this? How can the list object type be changed in runtime like with the input object?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wow, thanks a lot for the example. It looks pretty complex. I appreciate the time you took to do it. I will see how I can build on it.

  • Oh that sounds great! Is it possible to have the parser check for biggest hp amongst enemies, smallest atk of a character etc.?

    I imagine having skills stored inside a JSON file and storing some script formulas in them (Data Driven Design).

    Like:

    {
    	"skills": [
    		{
    		"name": "Sword Slash",
    		"description": "Deals 3*a.atk damage to an enemy.",
    		"target": 1 enemy,
    		"effect": doDamage(a.atk*3-b.def)
    		},
    		{
    		"name": "Mass Healing",
    		"description": "Heals all allies for a.mag*2.",
    		"target": all allies,
    		"effect": Heal(a.mag*2)
    		},
    	]
    }

    Edit: Whoops my phone slipped in my hand and made me post halve of my post before finishing typing.

  • I'm a very lazy person. I like efficient systems.

    I plan to store just about everything in JSON objects except local variables. From savedata to databases and so on.

    But there are some things that I do not like about the nature of the Construct 3 JSON object. Whenever I want to manipulate a value I have to choose the Set value, Add to or Subtract from event commands from a list of 16 JSON event commands after I first navigated to the JSON object in the object list. And the other thing is that I don't like to type JSON.Get("") all the time.

    First I thought about using global json variables inside the script interface. It is very typing-efficient.

    Instead of:

    • choosing the json object "Data" from the object list
    • choosing Subtract from, from a list of 16 json events
    • defining the path "defender.hp"
    • setting Data.Get("attacker.atk") - Data.Get("defender.def") as the value

    I can just type this inside a script:

    • data.defender.hp -= data.attacker.atk - data.defender.def

    The problem with this is that I would need to update the "Data" JSON object after every change so that I can continue to use event conditions like checking for variables.

    So instead I thought I could use a JSON handler function.

    When I call the function and put data.defender.hp -= data.attacker.atk - data.defender.def as the parameter/argument the function could translate this into the event system.

    But how would I be doing this?

    My first guess is to first check for the operation that is done using find(). Then use tokenat() to find the path.

    But for the value it gets tricky for me. Because I can not know beforehand if the value just consists of a normal number or if it will need to check 1, 2 or 20 json values. Maybe I would need a loop in combination of tokenat() and every time it finds a math operation ( + - * / ) it creates a local variable and adds Data.Get("") around the argument.

    Example from the formula above:

    • Function call: JsonHandler(defender.hp -= attacker.atk - defender.def)
    • Function: find(formula, "-=") > -1 -> Data Substract Data.Get("attacker.atk") - Data.Get("defender.def") from Data.Get(str(tokenat(formula, 0, "-="))

    But as I said I'm not sure how I can handle the formulas arguments (example: attacker.atk ; defender.def). What is giving me even more headaches is the fact that the arguments could even refer to other json files.

    Like:

    Data.Get("defender.hp") -= ( Data.Get("attacker.atk") + Skills.Get("swordslash.dmg") ) - Data.Get("defender.def")

    Or is there a whole other way how I could do this?

    Thanks for reading! :)

    Edit:

    Okay after hours of tinkering around I think I found a great solution. I use a JSON handler function but I do it with a script instead of trying it with funky events like from the screenshot above.

    The function is very simple and looks as follows:

    It just copies the JSON objects, then evaluates the function parameter (the formula) and then copies the data back to the JSON objects.

    Here is the simple function call:

    And it worked! Screenshot below is from the debugger and after the evaluation/damage calculation.

  • Oh yeah, my bad. In my previous post I had an extra comma at the end. But in my original JSON file I don't have this mistake.

    I will try it again though.

    Edit:

    Ok strange. Now it just works the way that I tested it before. Maybe I had a formatting issue or something like that...

    Thanks for your help!

  • Hmmm. I don't know why it didn't work.

    {
    	"classes": {
    		"class_01": {
    			"name": "Name1"
    		},
    		"class_02": {
    			"name": "Name2"
    		},
    		"class_03": {
    			"name": "Name3"
    		},
    		"class_04": {
    			"name": "Name4"
    		},
    	}
    }

    ..wasn't working with a relative path.

    {
    	"classes": [
    		{
    			"name": "Name1"
    		},
    		{
    			"name": "Name2"
    		},
    		{
    			"name": "Name3"
    		},
    		{
    			"name": "Name4"
    		},
    	]
    }

    ..was working fine with a relative path.

    Wich is a shame because I would prefer having a JSON path rather than using an array so I can do things like classes.warrior.attack. I guess I could have an array with the class names for easily listing them and then still have their own paths as objects with their class stats in them.

  • Thank you for the example project. Very handy.

    I realized why it wasn't working before. Because I used an object for the classes instead of an array.

  • I know that I had this kind of structure working before. But I'm kind of unconcentrated right now and I just can't get it to work.

    What I'm trying to do is just reading the class names "Name1" to "Name4" from a JSON object.

    What is the path to it? Why don't relative paths work?

    I tried so many different ways to read them. The screenshot below just has about half of everything that I tried.

    Only this exact path works Data.Get("classes.class_01.name"). I thought that inside a for each entry loop the path will be set relative. Why doesn't Data.Get(".name") work if the logic iterates through each entry of classes (class_01 to class_04)?

    Thanks for reading!

  • Strange. I reuploaded it here.

    Edit: Updated the link again. I guess I will never ever use file.io again.

  • If the bot had the ability to open up C3

    Unfortunately it is not able to. And it is far away from this capability. The openly available AI's are just very smart auto-completions like these which we use while typing on smartphones. But just a lot better. ChatGPT also has no connection to the internet. It was fed with a lot of data from it, but it is outdated from 2021.

Nilom's avatar

Nilom

Member since 26 Dec, 2019

Twitter
Nilom has 1 followers

Trophy Case

  • 4-Year Club
  • Forum Contributor Made 100 posts in the forums
  • 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

9/44
How to earn trophies