I need a snippet of some sort...
I need it to do this:
I wish the increase exp gained .1% for every level of every connected player currently connected.
Example:
3 players connected
Level 3 Human Test1
Level 4 Human Test2
Level 2 Human Test3
Exp Increased by : 1.90%
If someone could help me i would be very happy coder cuz i tried and it didnt work.
I believe it goes in update.c (void gain_exp)
by the way, im running a smaug1.4a dirived MUD.
Thanks, U can ether post the snippet here or email it to me at zunit1920@yahoo.com
Ive tried this...
for( wch = first_char; wch; wch = wch->next)
{
wch_next = wch->next;
if(!IS_NPC(wch))
{
if(!IS_IMMORTAL(wch))
{
iexp += wch->level / 10;
}
}
if(iexp > 15)
{
iexp = 15;
break;
}
}
modgain += (modgain / iexp) + modgain;
I doubt anyone will write it for you, what happened why didnt it work? What kinda errors did you get did you get a core file?
Do you want this increased by 0.1%, by 1%, or by 10% ?
Your function is taking the level, dividing it by 10, and using that as your result. Dividing by 10 is 10% of the value. As in 100/10 = 10, 10 is 10% of 100.
What you wrote does not look like it would fail, though it's somewhat inefficient if you only want the bonus to be based on how many live players are logged on. You're looping the entire charlist, when looping the descriptor list would be far less resource intensive.
1) I want it increased by .1%
2) Im getting this error update.c:425: warning: `iexp' might be used uninitialized in this function
I seriously cant get it to work... n its really frustrating
I really hate that error cuz it doesnt help me at all :P
line 425 is int iexp;
Ok that fixed the error
And a couple more things
1)Exp Increased by : 0.000000% thats on the who list...
the code looks like this:
sprintf(buf, "Exp Increased by : %f%% &R(currently disabled)&D",iexp);
Thats the first problem the second problem is
2) <Life(100) Mana(124) Exp(414/414)>
You jolt Test1. [6]
You gain 6 exp.
<Life(100) Mana(124) Exp(435/421)>
You decimate Test. [26]
You gain 14 exp.
You jump over Test1's attack. [0]
<Life(100) Mana(124) Exp(479/435)>
You decimate Test1. [27]
You gain 15 exp.
Im gaining 2x what im supposed to and its not raising current exp (base-exp/current exp)
the current is gaining what it should the base is gaining like 2x what it should
1)Exp Increased by : 0.000000% thats on the who list...
the code looks like this:
sprintf(buf, "Exp Increased by : %f%% &R(currently disabled)&D",iexp);
This is because do_who does not know the value of iexp. You would have to make iexp a global variable so that all functions can use its value and not one thats local to the gain_exp function (or whatever its called).
How would i go about doing that???
Sry im not extremly experienced with all of this
You will not get good results at 0.1% by using integers. You would have to take the level and divide by 1000 to acheive this. Or multiply the level by 0.1, either way.
The problem is the value you are working with is an integer and C code rounds integers to the nearest whole number. So you would either need to change everything you're working with to floats ( not good ) or use temp variables to multiply the values by 1000, do your stuff, then return the final value back to normal. I suspect with such a small percentage desired that neither method will end up working out very well.