ID:174623
![]() Jul 31 2003, 6:28 am
|
|
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?
|
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? |
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.
|
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))) |
obj.price -= rand(1,persuasion)
Or something like that, too random though.