This JavaScript is take instance of tapped skill via UID provided by function call. Gets SkillName as Function Name and fire it. Everything works.
It works, but it seems like a bad implementation because this is the only scripting workaround in this project. All other events use Construct's editor predefined actions and logic for now at least.
Do we have another solution to work for this without getting around it with JavaScript? If we don't have this kind of feature and I use these kind of scripting blocks in projects, I feel like eventually something will go wrong.
I have another solutions to this but with more than 200 sub events this is so much ugly to be honest. Here it is;
I want my skills as functions. Because this skills have additional mechanics for example Meteor Strike will trigger it's own additional function so can hit the it's AOE to different enemies. For example;
2) Construct gives you two options to load a file via AJAX. First, you can "Choose a Project File" from the dropdown list, and this option never fails on any device as the file exists on any device. However, when I try to get a file from "Request URL," the preview works, but when I deploy it to an Android Debug APK and connect it to my phone via the developer interface, I find that calling SpawnPoints.json results in a 404 error. It doesn't matter if the JSON file is located in a subfolder or if it is named correctly.
I tried with a subfolder (example/spawnpoints.json), without a subfolder (spawnpoints.json), camelCase.json, lowercase.json, CASED.json, underscores—everything I could think of regarding different file systems causing an issue about file naming. But no luck.
Why do I need this? I have different dungeon layouts, each with spawn points in different JSON files. When a player engages in a dungeon, certain conditions run (biome, level, etc.). These conditions check one by one and determine which layout is chosen as set in the "Instance Variable." With this Instance Variable, I load spawn points of enemies in the dungeon, load ambient sounds accordingly, and load different event mechanics triggered by entering this dungeon, etc.
But somehow Android can't locate the file if I call AJAX like this:
What is the cross platform solution to call this ajax from project files but i should call them by instance variable not from dropdown list. I just need to pattern of the url structure to call this file from project files but couldn't figure it out.
3) This is not an issue but a question. In Construct, you can name your functions whatever you want, even using spaces, and they still work. For example, on function "Player Hit GFX" works the same as on function "PlayerHitGFX". They both work correctly, but out of habit, I always define them as the latter. Why the Functions naming in Construct apart from JavaScript syntax rules and if we use spaces in function name like this will be different issues later on?
4) When i set "Wait 1 Seconds" in main event block, all sub events waiting this timer to end in order to trigger. However when i use "Wait 1 Seconds" in the first sub event, only first sub event actions waiting this timer, other sub events of the main event triggers at the same time. I think this is the feature of engine and i should adapt. Although i want to hear your experiences and opinions why this is so.
TL;DR
1- I need a way to call function names by instance variable values. For example, I have a "Skills" family. In this family, there is a skill named "Slash." When I click the "Slash" button, it gets its instance variable SkillName and this name should trigger the function with this name's value. (The function "Slash" must be triggered via the value of the SkillName variable.)
2- How do I make an AJAX call with right pattern from project files (not from the another server, but from the project files) without encountering a 404 issue on different platforms? It only works in preview mode and doesn't work on the Android APK.
3- What is the difference between using on function "Player Hit GFX" and on function "PlayerHitGFX"? Will using spaces in function names cause problems later on?
4- All sub events waiting for main event complete if we have a timer, when timer finishes all sub events fires at the same time if you don't chain them with else blocks. Note: This all sub events on same level. Please explain to me the logic behind why this is so.
Sorry for the long post, but if you have time, could you clarify these issues for me? I would really appreciate it.
Thanks.