I'm trying to create a new variable, via change game variable, inside a formula that I can later compare against another variable created inside the same formula, but I need this variable to call a value generated by a different formula rather than assigning it one. I noticed this feature appears to be available under the float options, but I can't get it to work in testing. Always returns 0. Even when I connect directly to the initial node, still 0. The formula itself returns the correct value, I just can't figure out how to call its value by means of a variable. What am I missing here?
  • edited February 6
    Yeah, that's a bit of a limitation in ORK's formulas. The variable changes use the player when calculating the formula, not user/target of the current formula.

    You can work around that by first setting the formula's value to the formula you want stored and use a Store Formula Value node.
    Post edited by gamingislove on
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • So, thank you first for responding, and I was able to work this out... kind of. Here's a breakdown for those who might be interested.

    I started by calling my main formula value in the initial node, then creating a Store Formula Value node and saving it as a local variable which I named, 'VITbonus', and 'Set' it in order that it would correspond to whatever value is called via the proceeding formula. At least I think that's what happened, according to testing anyway. Also, I'm not at all certain of best practices regarding whether to store things as Local or Global, but I generally opt for local as a hard rule, being that I don't really know what the #*%@ I'm doing. If you're reading this, then I imagine there's a chance you feel the same.

    My next step was to create a Change Game Variables node, type in 'VITbonus' and set it to subtract a value of 1. I'll explain this step later. I linked everything to Value node that I 'Set' to return whatever value is called by another formula which rolls a 10 sided die 1 time, then I moved directly into a Check game Variables node. The node checks whether VITbonus is equal to Zero, and if that fails then it loops into another Change Game Variables node that subtracts 1 from VITbonus once again (and again, and again and again, etc.) before proceeding into the final Value node that 'Adds' the same dice formula mentioned prior and connects to the same Check Game Variable node that lead to it in the first place. As you may have guessed by now, this cycle will loop repeatedly until VITbonus finally equals zero, at which point it will empty into a Store Formula Value node that I've 'Set' to Global. Again, I don't know if that step is right or wrong, or whether it does anything at all; it just makes me feel better.

    The reason I subtracted 1 from VITbonus before cycling into the initial dice formula node is because I otherwise would have rolled an extra die by the time I'd gotten to the Check Game Variables node, being that that that first roll lies outside of the check loop. you have to 'Set' the first die roll in order to override the formula value called in the initial node that became VITbonus, but you'll need to 'Add' it every subsequent time or you'll end up going through all of this just to end up with the value generated by a single die roll. That would just be silly, and confusing.

    My remaining problem with this process is that the random value algorithm doesn't appear to express a full range of the dice I'm attempting to roll, and that it furthermore seems heavily skewed towards generating numbers central to its range. I know the formula itself is returning the correct number of times to roll, because I linked it to a few other formulas set to generate 1, 2 and 3 respectively, and those always return the correct multiples in line with my VITbonus. This is potentially a huge problem for me, personally, but not one that I'm going to worry about at the moment. At this particular moment I'm done rambling about how to turn a simple problem into a much bigger headache. I trust this whole explanation was as confusing as possible.

    Best regards,
    Three Nippled Wanda
  • Using Local variables is definitely the way to go here - global variables might interfere with other calculations going on.

    One thing to keep in mind is that calling a formula from another formula doesn't transfer the formula value, i.e. the formula that's called starts from 0 again (or whatever you use as initial value).

    I've looked into the Random Value node, it might be that the current implementation results in this when using the As Int option. I'll improve that in the next update.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Perhaps I'm using the vernacular incorrectly. The method I use to call a formula is to create a Value node and Set (Add, Subtract--whatever) it to a desired formula, which indeed appears to adjust to the correct value. Is that not 'calling' the formula? Regardless, that seems to work (at least in testing) and I've thus far managed to achieve most of my desired results via formula trees. I do wish there were some way to 'Check' Attributes, as there exists for Stats, but I can work around that by creating Stats and linking them to certain Defense Attributes (sex, race, size, etc.) via an assigned number, to check against them that way. It seems to make Attributes themselves a largely redundant feature, at least for my purposes, but it's a work around.

    What would be of great use, I feel, is to be able to unlink Statistics from Combatants specifically and choose how they're assigned: i.e. to an item. That would offer up a whole new world of flexibility, and users would no longer have to bother so much with how to implement their custom variables. Failing that, being able to use the 'Formula' value that I'd mentioned before--which shows as an available option (like a tease) but apparently isn't implemented--being able to use that inside a node to locally define the value for a custom variable, well that would be like a little miracle worker. Not sure about the feasibility of any of that, or how much work it might entail, but I must say the customer support at least in responding to so many random queries is commendable. It's one thing to purchase an asset like this which does a good portion of the programming work for you, but they're about as convenient as a reusable condom made from an electric pencil sharpener without the necessary guide to explain their features, so thanks for that. I'll have no shortage of questions going forward, I'm sure.
  • Yes, that's calling a formula - and returns the value of the called formula. However, the called formula doesn't has access to the formula value of the formula it was called from.

    You can check attack/defence attributes (and many other things) using a Check Status node.

    I didn't quite get what you mean by unlinking statistics from combatants - could you explain this in a bit more details (maybe also with an example)?
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Now that I've just realized I can check against literally anything with the Check Status node (Thanks for setting me straight there, I thought it only checked against Status values) I'm not sure it's relevant. What I meant was, for example, if I were to create a status value that I wanted linked solely to a piece of equipment rather than to a combatant, be able then to remove it from the combatant's status list. Perhaps limiting what Status Values attach to combatants by their type would be a way to achieve this, but as I said I don't believe it's relevant anymore. It would be nice, though, to be able to select what kind of status is checked *against* in the Check Status node. If that's possible, please let me know how. That would be awesome.

  • *Update* I've run into a new wall regarding my dice looping formula, one where I believe that I absolutely must find a way to compare two independently set values, or bust. Specifically, I need to create a variable inside the formula via Change Game Variables (calling it 'TimesLooped'), set it to a specific value and then loop it, adding 1 each go around until it equals my Strength score. Of course, neither the value set for 'TimesLooped' nor my Strength are the value I'm looking to assign via this particular formula; they're merely counter checks used to determine the number of times the formula will be required to loop before it's finished.

    The last bit there is relevant because I keep running into an issue where values seem to constantly overwrite themselves. I find that the value of 'TimesLooped', for instance, might equal a value that I've initially assigned, or it could equal 0, or occasionally it will pick up--or add to--the overall formula value that I'm attempting to configure. That could be another best practices stumbling block, but I'm not really sure how to debug it so that I can verify what precise value is currently assigned to everything at any particular stage. All I can do is check whether a certain point in the formula is less, greater than or equal to a specific number. Many of my formulas for determining stat allocations and behavior are going to run into this issue if I can't figure out a solution, so I'm praying there's a work around, or possibly some helpful integrated feature that I'm just not seeing. I'm this close to growing another nipple here, I'm so stumped.
  • All status values are available on all combatants, you can't exclude them. However, if there's a value you only need on e.g. an equipment, you can use the Equipment Variables for that, using selected data to get access to them in formula calculations.

    Could you post a screenshot from your formula? Also, why does it need to loop?
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • I'm not seeing an option to add a link for pics, but I can explain why the formula needs to loop. Maybe you've got another way to achieve my desired outcome. It's very simple: I'm creating a system centered around dice rolls to generate random outcomes. Furthermore, many of my stats have circular dependencies, so they derive their values by checking against one or more stats.

    One formula, for instance, that I'll need to sort out will be 'carry weight', which is derived from strength. I created a table which establishes a set carry weight at 1 Strength and then multiplies it by 2, and again by 1.1. I also subtract 0.1 from the first multiplier for every point of strength until only the second multiplier of 1.1 remains, and that lasts indefinitely.

    I created a sort of makeshift table, using the Check Status Value, to run through the initial numbers, but I need to move from there into a loop. I can create a Change Game Variable node called 'TimesLooped', but rather than have it count downward until it reaches 0--which I've done using other simpler formulas and it seems to work--I'll need to add 1 to it at each interval until it matches the target combatant's strength. So far, I haven't been able to discover any way of doing this. It should be relatively simple, if I could just auto-assign a value for a second variable to match (in this case) strength, and check against it until TimesRolled matches it. Is that possible? If not, do you know of any workarounds I could use to achieve the same result? I have quite a few instances that will require this functionality, and which I'll also need to set so that they auto adjust in real-time as certain dependent factors change.
  • You can check the counter variable against the strength if you also store the strength into a variable and use a Check Game Variable node.

    Storing strength into a variable can be done as I explained in my first answer, i.e. first set the variable to the strength value and use a Store Formula Value node to store it into a variable.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Yes, I attempted that from the beginning, and several times thereafter, employing various nuances. I've tried doing that from both the start of my formula and towards the end, before the loop. Before and after creating the TimesLooped variable. I've tried setting the initial formula node to a formula that calls Strength and setting it. I've attempted every combination of Global and Local variables. It's not that I can't ever get a test to return the correct value at any point in the formula, just that by a certain point when I need to compare the two values something is always being forgotten or overwritten. If I run a Check Game Variables to determine the current value of either of the two Variables I've set, the most common finding is that both will equal zero, though in some cases I'll have one that holds its value and the other will either be zero, or 71115 (my current formula value by this stage, measured in a base unit of grams).

    My plan currently, after posting this comment, is to scrap every formula that I've set up connecting to this one and re-input them from scratch, assuming that I might have dotted the wrong "T" at some point and that's what %#*@ing everything up. I've also set up shrines in my office to various occult and pagan deities, because Jesus is apparently sleeping on the job here and I need some results, damn it! Before I log off, however, just a few parting questions for posterity:

    1- How many variables can be created, retained and used in a formula?

    2- How many are able to be consecutively altered via Change Game Variables before the system freaks out and decides to set everything back to zero?

    3 - Does a Global Variable used by multiple instances overwrite its value every time it's called, or is it relatively safe?

    4 - Once I've finally figured this out and I've finished setting up my system to build around, how will I set up all of my various stats to continually check and update their values correctly in relation to their governing stats? Once I've successfully created a stable Strength variable for this weight formula, for instance, and Carry Weight has instantiated onto a character based on their initial strength score, will it keep track of the formula on its own? Can it be made to do so?

    5 - Is there a limit to how many formulas can be used to define and alter one stat?

  • Without seeing your formula it's hard to help you, since it's a very specific problem. Could you send me your ORK project asset (usually located here: Assets/ORK Framework/ORKProject.asset) to contact@orkframework.com?

    1) There's no limit implemented at all, you can use as many variables as you like.

    2) That never happens.

    3) A global variable isn't save - it can be changed from everywhere at any time, e.g. an event or a formula changing the variable will naturally override whatever was set before.

    4) Depends on how and where you use the formula.
    You could e.g. set up a Normal type status value that uses the Combined Value option to update the status value based on the formula whenever something changes.

    5) No.
    If you're enjoying my products, free updates and support, please consider supporting me on patreon.com!
  • Wow, I wanted to wait for a reply before I posted again to update that this issue was resolved, but then as of this morning it no longer appears to be. I don't know what fixed it before, but it was fixed. I deleted the formula, re-input everything from scratch and got it to work perfectly. I saved it, closed and reopened my project, tested it with multiple values against a calculator and it always returned correctly. Then I switched everything back to the initial values, tested again before saving and moved on to messing with events. I haven't touched anything formula wise since, until this morning.

    I wanted to create a tutorial using pics for people to better follow. Side note: the reason I wasn't seeing an option to add pics to my post was that I'm using Firefox's NoScript tool, so heads up there. Anyway, when I pulled up the formula this morning to begin snapping some step-by's, the first thing I did was to test it once again and was immediately reacquainted with an old adversary, Mr. Infinite Loop. I don't know what's happened inside my project within the past few days, but it's no longer recognizing variable values. Here's what's happening.

    I begin by calling up a formula that simply adds my Strength status value in the very first node...

    then I save it with a store value formula, like so.

    The formula runs through a series of checks-none of which return positive in this case-until it branches to a point where I create a new variable: TimesLooped.

    Here I've set it to 12 so that it equals Strength, which I've also now set to 12. I set up my Check Game Variables node accordingly...

    and I test.

    And everything is honky-dory, whatever the hell that's supposed to mean. TimesLooped is equal to twelve, as indicated by the calculated result. Just take my word for it-the value is correct. STRset is also equal to twelve...

    and if I go back and set TimesLooped to 8 and test it once again against a value of 12...

    I find that it loops around until it assigns the correct value. Again, take my word there. The problem is that when I set either variable's value to check against the other as a variable, I'm failing to call that second variable's actual value, which I know is stored correctly, because testing.

    I had to disconnect from the loop to test so as not to get stuck in another infinite looping paradox, but you can clearly see that it failed. That second variable is almost certainly setting to zero(not the seting value of zero, but it's own special zero which we don't see), which wouldn't seem quite as perplexing if I hadn't managed to reference it's correct value prior. What the devil is going on with this crazy thing? Was it a fluke that I had it working earlier? Might I have tweaked some setting, outside of formulas, by messing around with events and the menu settings which could have possibly removed ORK's ability to check a second variable? Am I losing my mind? Or, was it a mistake to take down all of those demonic shrines I'd set up in my office--I'm sorry, but they were just so #%*&ing creepy. I feel like something, either above or below, is seriously messing with my mojo here.

  • Well, drat, those image links from an imgbb.com account I set up aren't working. Sorry about that. Any way I can just send them directly to you?
  • *Update* As of this rainy Saturday morning I've got this crazy thing working again (for now). I'm not sure what broke it to start, but one of my first steps in troubleshooting was to go to the node at the beginning of the formula and change the 'Operator' from Add to Set, which if I'm not mistaken caused the variable I'd set up as its value, i.e. STRset, to set 0 for its value rather than add the proceeding formula value to its value. I wish these explanations could read clearer, but that's programming vernacular for you=obscure, circular cluster#%$@.

    I also wish that I could say with confidence that this one little step has resolved my issue, or that it will stay resolved, but it doesn't explain how the formula broke to begin with, nor certain other weird values I was coming up with trying to fix the crazy thing. For instance, although the Float Value 'Variable Key' would typically set itself to 0, regardless of however I transposed TimesLooped and STRset, sometimes it would return an odd value, such as one time when I thought I'd somehow manage to fix the formula only to apprehensively reconnect the loop and discover that it was returning a value of 3.8306E+7. What the #^*% was that about!? I have no idea, and maybe I don't even want to know.

    Also, regardless of what I'd done to mess up the Value of STRset, it seems that setting TimesLooped equal to the Variable Key, TimesLooped, should still succeed. I could always get it to work by assigning a direct value to compare against, but the value wouldn't print as a variable. Might that be because I'd merely set a value for TimesLooped using the proceeding 'Change Game Variable' node, but never saved it using a 'Store Formula Value' node? This entire variable system, though I've little doubt relating to it's versatility, is endlessly abstruse to a novice such as myself. In any event, I can't claim-not at this point, anyway-that the issue is truly resolved, merely that I seem to have discovered a patch for now and hope it holds. I've got too many other things to do in setting up my game to remain hung on it any longer, but hopefully some epiphany might clarify everything as I progress to gradually understand this system... or not, so long as nothing else breaks seemingly out of the blue. Thank you, GIL, for all of your help trying to walk me through, and any follow up comments will of course be similarly appreciated.
Sign In or Register to comment.