Dividing by fractions?

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Dividing by fractions?

Post by GottaLove88s »

Gents,

Will BA let me do this...

SetAttrib(id, "LOS", GetBaseAttrib(id, "LOS")/1.5) ;

Or is there an issue with dividing by non-integer values?
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
pipfromslitherine
Site Admin
Site Admin
Posts: 9881
Joined: Wed Mar 23, 2005 10:35 pm

Re: Dividing by fractions?

Post by pipfromslitherine »

The script doesn't understand floating point numbers. You would be best doing something like:

los = GetBaseAttrib...
los = 75 * los ;
los = los / 100 ;
SetAttrib...

Cheers

Pip

[edit: misread your maths]
follow me on Twitter here
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Dividing by fractions?

Post by GottaLove88s »

Thanks Pip,
Works a treat!
:-)
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Post Reply

Return to “Battle Academy : Modders Corner ”