ID:139610
 
Code:
mob
var
Health = 50
MaxHealth = 50
DR = 0
RR = 0
Strength = 5
Perception = 5
Endurance = 5
Charisma = 5
Intelligence = 5
Agility = 5
Luck = 5
AP = 65
MaxAP = 65
Level = 1
Experience = 0
MaxExperience = 30
Caps = 0
weight = 0
maxweight = 25
Rads = 0
bank_Caps = 0
Barter = 2+(Charisma * 2)+(Luck / 2)


Problem description:
What seems to be the problem? I want it so it you know, It gives you the total for the equation.
Kakashi153 wrote:
Code:
> mob
> var
> Health = 50
> MaxHealth = 50
> DR = 0
> RR = 0
> Strength = 5
> Perception = 5
> Endurance = 5
> Charisma = 5
> Intelligence = 5
> Agility = 5
> Luck = 5
> AP = 65
> MaxAP = 65
> Level = 1
> Experience = 0
> MaxExperience = 30
> Caps = 0
> weight = 0
> maxweight = 25
> Rads = 0
> bank_Caps = 0
> Barter = 2+(Charisma * 2)+(Luck / 2)
>

Problem description:
What seems to be the problem? I want it so it you know, It gives you the total for the equation.

You can't do that under a definition. You have to set it in a proc, or verb. Try mob/New(), or mob/Login() for example.
You'll want to create a mob proc that calculates the "Barter" variable.

mob/proc
CalcStats()
Barter = 2 + (Charisma * 2) + (Luck / 2)
// You, additionally, may add other stat calculations in this proc.



You'll want to call this proc whenever the Charisma or Luck variables are changed, ideally.
In response to Duelmaster409
Is there a way that it could round the number to the nearest whole?
In response to Kakashi153
Kakashi153 wrote:
Is there a way that it could round the number to the nearest whole?

mob/proc
CalcStats()
Barter = round(2 + (Charisma * 2) + (Luck / 2))


Rather easily.
In response to Gigimoi
You'll want round(expression, 1) to round the value to the nearest whole number. Just having round(expression) will floor the value.
In response to Mega fart cannon
Thanks a ton guys! :)