The Daily Click ::. Forums ::. Klik Coding Help ::. Maths Help!? And Stuff
 

Post Reply  Post Oekaki 
 

Posted By Message

Nessy



Registered
  20/01/2009
Points
  361
20th May, 2014 at 20/05/2014 16:29:05 -

So basically

100 - 50 * ((0 / 100) + (50 / 100)) = 75 Right
Thats on a normal calculator

now when I go into clickteam fusion and
subtract 50 * ((0 / 100) + (50 / 100)) from a value, nothing happen.
Basically I wanted to do when you use a fire attack on a creature that is weak agains fire it does 50% more damage. So 50% of 50 is 25 so 50 + 25 is 75. But it won't do it.

The code was a bit more complicated but I even put in what it says right there.

Here is it without being cut into numbers

Fire at( "Player" ) * ( ( Fire Res( "Enemie" ) / 100 ) + ( Fire Weak( "Enemie" ) / 100 ) )
Fire at being whatever number but in this case 50
Fire Res being 0 at this current moment
Fire Weak being 50

I wanted to have equipment that changed the % of damage vs monsters, also taking into account resistance and weaknesses.

So basically why does
subtract 50 * ((0 / 100) + (50 / 100))

Do nothing???

Edit - someone just made me aware that following different rules of maths it equals 25. Which in that case is okay, because all I need to do is at that on to the original normal attack. But it still doesnt do it.

so say i done

(50 * ((0 / 100) + (50 / 100)))+ 50
or something like that. basically just adding everything there and 50...it just works it out to 50!

Edited by Nessy

 
n/a

Nessy



Registered
  20/01/2009
Points
  361
21st May, 2014 at 21/05/2014 17:25:37 -

Its okay got it. CTF doesnt like decimal points. So I had to do it different. All sorted.

 
n/a

Alonso Martin



Registered
  29/12/2010
Points
  294
21st May, 2014 at 21/05/2014 17:39:26 -

If you want MMF to handle decimal values in an expression, just add it yourself. For example: 1/2.0 = 0.5. If you just say 1/2, MMF will return 0. I suppose this design choice was made because it's more memory intensive to handle all operations as floats instead of integers.

Edited by Alonso Martin

 
www.hfalicia.com
www.alonsomartin.mx

Nessy



Registered
  20/01/2009
Points
  361
22nd May, 2014 at 22/05/2014 19:38:33 -

orly? Thats good to know Thanks for that.

 
n/a

LordHannu

Crazy?

Registered
  22/04/2007
Points
  7909

VIP MemberStarTeddy BearRibbonGame of the Week Winner2021 Halloween Competition Winner2022 Hi-Score Mash-up Competition (Bronze)2023 Halloween Competition (Bronze)2023 Halloween Competition Entrant
23rd May, 2014 at 23/05/2014 21:32:57 -

(( "Player" )*1.0) * ( (( Fire Res( "Enemie" )*1.0) / 100 ) + (( Fire Weak( "Enemie" )*1.0) / 100 ) )
all decimal values you wish to use, you need to ((value)*1.0) to force it to a float. To get decimals.

Edited by LordHannu

 
n/a

Jenswa

Possibly Insane

Registered
  26/08/2002
Points
  2722
24th May, 2014 at 24/05/2014 09:51:56 -

Multiply your values by 100 and divide them by 100 as the last step.

That also works. It becomes a sort of fixed point math that way, handy for integers and keeping accuracy.

But adding the decimals in the expression is probably what you want.

Cheers,
Jenswa


 
Image jenswa.neocities.org
   

Post Reply



 



Advertisement

Worth A Click