Welcome to the Builder Academy

Question Stat Bonuses

More
05 Jul 2012 17:21 #321 by Liko
Stat Bonuses was created by Liko
I see the way stock Tba handles stat bonues like hp bonuses with con as shown belown;
Code:
* The field referenced is for hitpoint bonus. */ cpp_extern const struct con_app_type con_app[] = { {-4}, /* con = 0 */ {-3}, /* con = 1 */ {-2}, {-2}, {-1}, {-1}, /* con = 5 */ {-1}, {0}, {0}, {0}, {0}, /* con = 10 */ {0}, {0}, {0}, {0}, {1}, /* con = 15 */ {2}, {2}, {3}, /* con = 18 */ {3}, {4}, /* con = 20 */ {5}, {5}, {5}, {6}, {6} /* con = 25 */ };

I want to do something like that, but make it so like every 4 con points gives you 1 extra hp gain. How would I change it? Is it pretty simple?

Randian(0.0.0)
Owner/Developer

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

More
05 Jul 2012 17:43 #323 by Halenbane
Replied by Halenbane on topic Re: Stat Bonuses

Liko wrote: I see the way stock Tba handles stat bonues like hp bonuses with con as shown belown;

Code:
* The field referenced is for hitpoint bonus. */ cpp_extern const struct con_app_type con_app[] = { {-4}, /* con = 0 */ {-3}, /* con = 1 */ {-2}, {-2}, {-1}, {-1}, /* con = 5 */ {-1}, {0}, {0}, {0}, {0}, /* con = 10 */ {0}, {0}, {0}, {0}, {1}, /* con = 15 */ {2}, {2}, {3}, /* con = 18 */ {3}, {4}, /* con = 20 */ {5}, {5}, {5}, {6}, {6} /* con = 25 */ };

I want to do something like that, but make it so like every 4 con points gives you 1 extra hp gain. How would I change it? Is it pretty simple?


Not sure if I am misunderstanding your question but why not just change the values?

{1}, /* con = 10 */
{0},
{0},
{0},
{1},

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

More
05 Jul 2012 18:43 #324 by Liko
Replied by Liko on topic Re: Stat Bonuses
Because I stat cap at 500 and I don't want to define over 500 lines of code.

Randian(0.0.0)
Owner/Developer

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

More
05 Jul 2012 18:53 #325 by Halenbane
Replied by Halenbane on topic Re: Stat Bonuses
Ahhh I see

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

More
05 Jul 2012 23:57 - 05 Jul 2012 23:59 #328 by WhiskyTest
Replied by WhiskyTest on topic Re: Stat Bonuses
How about just edit the advance_level() function in class.c

Where it has:
Code:
add_hp = con_app[GET_CON(ch)].hitp;

Could be altered to a formula instead, example:
Code:
add_hp = MIN(MAX(0, GET_CON(ch)/4), 125);

That would set the bonus to be the players con divided by 4, but caps it between 0 and 125.

Another way would be to replace all the constant structures to formulas similar to the above one, but then you'd need to change a lot of references.. Depends what would make things easier in the long run I suppose :)
Last edit: 05 Jul 2012 23:59 by WhiskyTest. Reason: adding [code] thingies

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

More
06 Jul 2012 00:19 #329 by Liko
Replied by Liko on topic Re: Stat Bonuses

WhiskyTest wrote: How about just edit the advance_level() function in class.c

Where it has:

Code:
add_hp = con_app[GET_CON(ch)].hitp;

Could be altered to a formula instead, example:
Code:
add_hp = MIN(MAX(0, GET_CON(ch)/4), 125);

That would set the bonus to be the players con divided by 4, but caps it between 0 and 125.

Another way would be to replace all the constant structures to formulas similar to the above one, but then you'd need to change a lot of references.. Depends what would make things easier in the long run I suppose :)


That is true. I did end up using
Code:
add_hp = MIN(MAX(0, GET_CON(ch)/4), 125);

I should of just thought of using that easier instead of wanting to replace those old codes.

Randian(0.0.0)
Owner/Developer

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

Time to create page: 0.199 seconds