Welcome to the Builder Academy

Question cheaper shop prices for humans

More
01 Nov 2016 22:48 #6228 by JTP
Replied by JTP on topic cheaper shop prices for humans
ehh im confused, how ?

Please Log in or Create an account to join the conversation.

More
01 Nov 2016 23:06 #6229 by thomas
Code:
- int HUMAN_FACTOR = .7; + float HUMAN_FACTOR = .7;

Please Log in or Create an account to join the conversation.

More
01 Nov 2016 23:09 - 01 Nov 2016 23:10 #6230 by JTP
Replied by JTP on topic cheaper shop prices for humans
ahhh that worked brilliantly

Can it also be done similar with sell prices, just give better sell prices ?
Last edit: 01 Nov 2016 23:10 by JTP.

Please Log in or Create an account to join the conversation.

More
01 Nov 2016 23:20 #6231 by thomas
I suggest you try it out :)

Please Log in or Create an account to join the conversation.

More
02 Nov 2016 10:09 #6235 by JTP
Replied by JTP on topic cheaper shop prices for humans
Figured it out with human_factor 1.25 :)

Please Log in or Create an account to join the conversation.

More
02 Nov 2016 21:31 #6237 by thomas
I suggest you read the comment above the function. It suggests that the comparison in the middle is there to prevent money making loopholes where you can sell something at a higher price than you can buy it for.
To make this still work, the alterations must happen before that check.
So, you add the same change as in the buy_price function (to calculate the correct buy factor) and then tweak the sell factor by dividing by the HUMAN_FACTOR:
Code:
static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller) { float HUMAN_FACTOR = .7; float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / (float)70) / (!IS_NPC(seller) && GET_RACE(seller) == RACE_HUMAN ? HUMAN_FACTOR : 1); float buy_cost_modifier = SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(seller)) / (float)70) * (!IS_NPC(seller) && GET_RACE(seller) == RACE_HUMAN ? HUMAN_FACTOR : 1); if (sell_cost_modifier > buy_cost_modifier) sell_cost_modifier = buy_cost_modifier; return (int) (GET_OBJ_COST(obj) * sell_cost_modifier); }
as always, browser code, you may need to tweak it :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.306 seconds