Okay, what I need to know is how to display a survival rate variable as a percent by looking at the mobs kills, deaths, and total_battles var(s). Since I know thats to vague to be of help, heres an example of what I mean.
Lets say a mob(/mob/player) has fought a total of 71 battles(total_battles=71), and out of those 71 battles, he died 22 times(deaths=22) and won the other 49(kills=49). Now, what I need to know is how to get a percent of survival by comparing the kills to the deaths, and calculating how many times out of the total_battles var that the mob won(wins being defined as kills) and expressing it as a percent.
Thanks In advance for help
ID:167207
Apr 15 2006, 8:11 am
|
|
var/mob/Player/P
round((P.Kills/P.TotalBattles)*100) P.Kills/P.TotalBattles will give you the decimal percent. Then we multiply that by 100 so it is in the form of a percent, and round off any remaining decimals. |
In response to DarkCampainger
|
|
Yeah, that's actually a better approach than mine.
|
I think that should do it.