Template: Square Roots
Difficulty: Intermediate
RPG Maker: 2000/2003
Author: Statix

This is a true squareroot callable common event. Of course since RM doesn't support decimals the returned squareroot cannot be a decimal, but the system does round properly as if there were decimals. Eg. Root6 = 2.449 thus it rounds down to 2, while Root7 = 2.645 thus it rounds up to 3.

squareroot

To use:
Simply copy the common event in this template to your game. Then when you want a square root set Variable #100 to the number you want to root, then call the common event you copied. After the call Variable #100 will be the square root! (See the tree stump event in the middle of the template's map for an example) By default the system uses variables 97-100. This can be changed in a minute or two by changing all the variable references in the common event to other ones. Just make sure they all match up.
(Note: There is an upper limit on square roots. Not because the system is limited, but because I thought nobody would want to square root that high anyway, so I put it there to prevent infinite loops that might happen for some reason. See the bottom of the common event to set this higher if you need it higher.)

Enjoy!


Click here to Download

Click to Return to the Templates Page