playMaker

Author Topic: [SOLVED] Int Operator calculates incorrect answer?  (Read 1682 times)

Spataar

  • Playmaker Newbie
  • *
  • Posts: 4
[SOLVED] Int Operator calculates incorrect answer?
« on: September 28, 2014, 08:08:43 AM »
Hi all, I'm having issues with the INT Operator not calculating numbers correctly.

I have an FSM that gets two random INT's and then adds them up showing an answer. In certain instances it calculates incorrectly as per below.

This may be a silly question but i just can't figure it out....

« Last Edit: September 28, 2014, 04:59:23 PM by Spataar »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Int Operator calculates incorrect answer?
« Reply #1 on: September 28, 2014, 10:40:32 AM »
The variables are probably changing after the operation is done.

Try using some predefined variables, if it is correct then that is probably the case. Maybe a loop in your random generation or something, or some event being fired twice? What else is going on in the context?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Spataar

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Int Operator calculates incorrect answer?
« Reply #2 on: September 28, 2014, 01:17:07 PM »
Thanks, I figured it out - I use an array to shuffle the numbers which then end up overwriting the value. This is ok as I first save it into a separate variable and for my game to work this is necessary.
« Last Edit: September 28, 2014, 04:59:03 PM by Spataar »