Events, Spawns, Source Servers, and many more!

User Tools

Site Tools


Sidebar

home

issues

downloads


bukkit plugins

windows 8 apps

windows phone apps


Maintaining these plugins takes a lot of work, so if your server is enriched by them please consider sending some love my way!

If you're penniless I'm also partial to TF2 items. Send any you don't want my way! STEAM id: coldandtired

If you don't know what TF2 is, then start playing! It's free and fun!

events:calculating

Numbers are used extensively in Events, for example in setting mob HP, checking time conditions, enchantment levels, etc.

Any place you specify a number value you can insert a calculation instead

<event>
    <hp>20 + 7</hp>
</event>

Now, there's obviously not much sense in doing it this way instead of simply using 27, but how about

<event>
    <hp>20 + {world.player-count}</hp>
</event>

Now the constant will be replaced with the number of players in the world and added to 20.

<event>
    <hp>20 + range(0, {world.player-count})</hp>
</event>

Now we will get a value from 20 to 20 + the number of players in the world at the time.

Supported operators

Example Result
+ 5 + 7 12
- 10 - 5 5
* 2 * 7 14
/ 9 / 3 3
% 10 % 3 1
^ 5 ^ 2 25

Supported functions

Example Result Returns
abs abs(-22) 22 the absolute number (no negatives)
ceiling ceiling(3.117) 4 the nearest whole number up
floor floor(7.22) 7 the nearest whole number down
min min(4, 2) 2 the smaller number of the two
max max(5, 10) 10 the larger number of the two
random random(10, 20) 14.543252 a random number between the two values
round round(4.2745) 4 the nearest whole number (x.5 rounds up)
sqrt sqrt(81) 9 the square root of a number
events/calculating.txt · Last modified: 2015/01/21 14:12 by sylian