06 Jan, 2008, tracker06 wrote in the 1st comment:
Votes: 0
Hey all,

I am a newer coder, trying to get the hang of things. I am looking to add some special effects to my items, but I can't figure out how to get it working correctly.

How do I find out what lets say 2% of their experience gain is, and then add that ontop of their experience gain?

So if I turn on a 2% experience bonus, they will gain an additional 2% experience per kill.

Thanks!
06 Jan, 2008, Justice wrote in the 2nd comment:
Votes: 0
Just multiple against a decimal. Basically. 0.02 = 2%, but if you're increasing their experience gain it'd be easier to use 1.02;

exp = exp*1.02;
06 Jan, 2008, tracker06 wrote in the 3rd comment:
Votes: 0
wouldn't that give 102%?
06 Jan, 2008, Justice wrote in the 4th comment:
Votes: 0
Exactly. Their experience plus an additional 2%.

tracker06 said:
So if I turn on a 2% experience bonus, they will gain an additional 2% experience per kill.
06 Jan, 2008, tracker06 wrote in the 5th comment:
Votes: 0
For some reason it's rounding up and just counting the 1, so it returns xp = xp basically, there another way to do this?
06 Jan, 2008, Justice wrote in the 6th comment:
Votes: 0
You'll need to cast then. Try…
exp = ((double)exp)*1.02;
07 Jan, 2008, Kline wrote in the 7th comment:
Votes: 0
Or just exp *= 1.02. If the gain is too small it may not be noticeable with only 2% and just truncate. IE: 10 exp *= 1.02 is 10.2 – so it'll just cut off to 10.
07 Jan, 2008, tracker06 wrote in the 8th comment:
Votes: 0
thanks
0.0/8