9
edits
(Added the updated formula section.) |
m (Formatting and added example info at end.) |
||
Line 15: | Line 15: | ||
<big>Barter Formulas.</big> | |||
The formula used to check if a trade will be accepted by the merchant depending on the position of the slider is: | The formula used to check if a trade will be accepted by the merchant depending on the position of the slider is: | ||
Value = fBarterHaggleDispMult * floor(fActorLuckSkillMult * (Disposition - 10) / 4) + (100 + min(PlayerSkill + fActorLuckSkillMult * (PlayerLuck - 50), 100) - min(MerchantSkill + fActorLuckSkillMult * (MerchantLuck - 50), 100)) / (10 - (SliderPosition * fBarterHaggleBase)) | Value = fBarterHaggleDispMult * floor(fActorLuckSkillMult * (Disposition - 10) / 4) + (100 + min(PlayerSkill + fActorLuckSkillMult * (PlayerLuck - 50), 100) - min(MerchantSkill + fActorLuckSkillMult * (MerchantLuck - 50), 100)) / (10 - (SliderPosition * fBarterHaggleBase)) | ||
* SliderPosition is a value between 0 and 40 (fBarterHaggleMax) and represents the position in which the slider is located | * SliderPosition is a value between 0 and 40 (fBarterHaggleMax) and represents the position in which the slider is located. | ||
* If the value returned by the formula is greater or equal than 0 the trade will be accepted by the merchant | * If the value returned by the formula is greater or equal than 0, the trade will be accepted by the merchant. | ||
* Note that sometimes the result of the formula may give 0 (arithmetically) and therefore the trade should be accepted but it is not. This is because of floating-point errors. The handling of these errors can be done but that would over complicate the representation of the formula on this page. | * Note that sometimes the result of the formula may give 0 (arithmetically) and therefore the trade should be accepted but it is not. This is because of floating-point errors. The handling of these errors can be done but that would over complicate the representation of the formula on this page. | ||
* Editor note: it has yet to be found if and where fBarterHaggleCurve fits into the above formula. | * Editor's note: it has yet to be found if and where fBarterHaggleCurve fits into the above formula. | ||
Alternatively if you wish to know the best slider position you can use: | |||
Alternatively, if you wish to know the best slider position you can use: | |||
BestSliderPosition = floor(((fBarterHaggleDispMult * floor(fActorLuckSkillMult * (Disposition - 10) / 4) + (100 + min(PlayerSkill + fActorLuckSkillMult * (PlayerLuck - 50),100) - min(MerchantSkill + fActorLuckSkillMult * (MerchantLuck - 50),100)) /10) ^fBarterHaggleCurve) / fBarterHaggleBase) | BestSliderPosition = floor(((fBarterHaggleDispMult * floor(fActorLuckSkillMult * (Disposition - 10) / 4) + (100 + min(PlayerSkill + fActorLuckSkillMult * (PlayerLuck - 50),100) - min(MerchantSkill + fActorLuckSkillMult * (MerchantLuck - 50),100)) /10) ^fBarterHaggleCurve) / fBarterHaggleBase) | ||
To change the slider position through script, use [[SetMenuFloatValue]] with the default path for the slider value being; "Negotiate_Background\Negotiate_Scroll\Horizontal_Scroll_Marker\_Value_Scrolled_To". | |||
Example: SetMenuFloatValue "Negotiate_Background\Negotiate_Scroll\Horizontal_Scroll_Marker\_Value_Scrolled_To" 1025 SliderPositionVar |
edits