ID:174623
 
How can I have a persuasion skill so the higher the skill is the less prices you get, without putting a whole bunch of ifs?
Why not do something like

obj.price -= rand(1,persuasion)

Or something like that, too random though.
Koolguy900095 wrote:
How can I have a persuasion skill so the higher the skill is the less prices you get, without putting a whole bunch of ifs?

Let's say you want a range of 0-100 for the skill, and you want someone with a skill of 100 to get half price. You can write a little function like this:

price = round(price/1+(persuasion/100))

Let's check the math for an item that costs 200...

1:
Persuasion = 0
price = 200/1+(0/100)
price = 200/1
price = 200

2:
Persuasion = 50
price = 200/1+(50/100)
price = 200/1.5
price = 133

3:
Persuausion = 100
price = 200/1+(100/100)
price = 200/2
price = 100

How does that look to you?
In response to Skysaw
Ha! Good call. I might use something like this in SHB, if ya don't mind. I didn't know what the /1 part was for until the end. Wow, I wish I can think up things like that one day.
In response to Skysaw
Looks kool! Thanks!!!
In response to Skysaw

price = round(price/1+(persuasion/100))

I think you need an extra set of paranthesis since the addition will take place after the price is divided by one.

price = round(price/(1+(persuasion/100)))
In response to Theodis
In fact, the second set of parenthesis aren't even needed, so it should just be price = round(price/(1+persuasion/100))