Changing negative integer variables to positive

Valtarian

Member
Reaction score
3
Hello
I have a bank integer variable that is arrayed for each of the six players on the map. It is used to hold gold past the 1M limit.

For some reason, once the bank integer reaches in the hundred millions/billions, it automatically switches to a negative integer.

Is there a way I can keep an integer positive?

Thanks!
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Another way of doing this, is to use the BigInt system by Nestharus.

The reason you are seeing your values go negative, is because you are 'overflowing' the integer type. It has a maximum/minimum value, and it is signed. In a typical language, the way to get around this is to use a larger datatype such as an unsigned long, or coding a new type yourself. Warcraft III has none of these.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top