Is this integer overflow?
Hey everyone!
I'm running into an issue.
Essentially, I want to increase the max spawn count of an object when a button is toggled on (2), so that the user can decide whether they want the standard ability, or the extended ability to spawn even more objects, but it seems that setting "treehilo", the max spawns, any number higher than 7 or 8 results in the actual spawn count increasing from 1 to 6 like normal as the objects are spawned, but then the number stops at 6, and the spawns are infinite. If I set "treehilo" to 3 and the buttons "treehilo" to 5 for instance, it works perfectly fine. "treecnt" is the current amount the player has spawned.
Heres the code:
this.treehilo = 3;
if (GetGUI.toggles[2])
{
this.treehilo = 5;
}
this.treecnt = 0;
for (int m = 0; m < this.mytree.Length; m++)
{
if (this.mytree[m] != null)
{
this.treecnt++;
}
if (this.treecnt < this.treehilo)
{ .....
Is this integer overflow thats happening? How do I fix this issue so that I can increase the numbers to the hundreds instead.
I'm not sure what exactly this script is supposed to do but i can assure you, it's not integer overflow. Int32 max value is 2147483647.
Your answer