I'm currently writing some background game point system and there are several small problems i came across.
1) I created a Integer global variable. At default, the value is 0. I check this value throught the game which says "its not being used".
I create an button which calls for an actionlist asset that "variable set : Set as random" to 4.
But 1 out of 5 chance, the number again sets to 0. And this causes the "its not being used" status.
So is there a way to make Set as Random between two numbers rather than from 0 to some number.
2) Can we also add randomizer in to formulas without giving them a variable . This would be super sweet (which would clean a whole lot steps in my case). Something like 1 + 3 (random = 4 to 8) / 2 = xxx
thanks
Comments
I've been hitting it for a while now and didnt see 4 till now. Previously i had similar problem but thought it simply is luck.
I got a 3 global variables (a,b,c) which are being updated by local (in scene) action list every time i click the button "update". And there is an actionlist asset that i run at the end of that local actionlist which sums up a+b+c and writes the result on an global variable d
Problem is, On my first click , i see "a(with value of 5)", "b(6)" and "c(8)" variables are being updated but "global variable d" does not. And on my second click, variable d is updated (with combination of a5+b6+c8 which is in total 19) but now a,b and c have already updated with new values.
So , formulas in action asset files are updated one click later? Why might this be?
Another point is, this approach causes the result (d) to be never accurate. Is there a way to force this calculation done immediately ?
Im randomizing an integer of a localvariable from 0 to 10. And next, im checking the same variable to see if its equal to 0. If condition met (meaning, if its 0) i re connect it back to the randomizing local integer.
This setup should (in teory) always re randomize the local variable value if the result is 0. But i still see 0 after few tries.
And i check this variable, if its yes, i add "+" to the begining of another variable:set action like this " +[localvar:1] " and if the value is No, i add "-" so the value becomes " -[localvar:1] "
Unfortunately while trying this formula, sometimes after 2 sometimes after 3 values, Unity crashes
So is there a way to add - or + to the integers values
This is the error code.
Mono.Xml.XPath.XPathParser.yyparse (yyInput yyLex)
Mono.Xml.XPath.XPathParser.Compile (System.String xpath)
Rethrow as XPathException: Error during parse of number( + 2)
Mono.Xml.XPath.XPathParser.Compile (System.String xpath)
System.Xml.XPath.XPathExpression.Compile (System.String xpath, IXmlNamespaceResolver nsmgr, IStaticXsltContext ctx)
System.Xml.XPath.XPathExpression.Compile (System.String xpath)
System.Xml.XPath.XPathNavigator.Compile (System.String xpath)
System.Xml.XPath.XPathNavigator.Evaluate (System.String xpath)
AC.AdvGame.CalculateFormula (System.String formula) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:149)
AC.ActionVarSet.SetVariable (AC.GVar var, VariableLocation location, Boolean doSkip) (at Assets/AdventureCreator/Scripts/Actions/ActionVarSet.cs:130)
AC.ActionVarSet.Run () (at Assets/AdventureCreator/Scripts/Actions/ActionVarSet.cs:86)
AC.ActionList+<RunAction>c__Iterator1.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:202)
UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:174)
AC.ActionList:EndAction(Action) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:285)
AC.<RunAction>c__Iterator1:MoveNext() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:229)
2) The formula code is handled by Unity’s own Text libraries. What it can/can’t do is out of my hands.
3) The “4” is inclusive.
4) I can’t see why that would happen. Clicking what, exactly - a Unity of AC button? Try placing an “Engine: End game” Action within the asset file - that way we can see if it’s being run at all in the first click. If it does, replace it with a (very tiny) pause just before setting Variable D.
5) Are you using Integers or Floats? Try “3.0 / 2.0” instead.
6/7) Screenshots of the ActionLists?
"Set it as 0-4, then add by 3, etc."
Alright, will give a try.
2) Alright than.
3) With a counter label counting the clicks and showing the results. I've yet to see value 4 in 400 randomising clicks. If i set it between 0-5, than i see 4 but again , never 5.
4) D'oh! I forget to click "run in paralel" for the engine: run actionlist. And also set the previous Actionlists to "wait until finish". That was my bad. Now its working!
5) I would like to try ".0" values but the numbers comes from randomizing variables.
But i guess i can write an action list to check the result and replace it with .0 values before dividing them. Would this be advisable ?
6)
7) this one is solved with me re arranging the actions and not writing + values but rather giving complete formulas like [var:1]+[var:2]
There is also the posiblity that im just that unlucky and never get the top number
5) A custom Action could do whatever you want with variables very simply.
6) Which variable is always being set to 0 - 10_zar or sonuc? Again, a custom Action would do everything you need here.