The Dink Network

Stat Reliant Stats

December 29th 2005, 01:26 PM
dragon.gif
I need to make it so Dink's Attack, Defence, Magic and Life values are altered by new stats I'm doing. How do I do this?
December 29th 2005, 02:22 PM
knightg.gif
cypry
Peasant He/Him Romania
Chop your own wood, and it will warm you twice. 
What do you mean by altered?
December 29th 2005, 03:31 PM
slimeb.gif
DaVince
Peasant He/Him Netherlands
Olde Time Dinkere 
He means like, his own stats influence the amount of damage the enemy does on Dink, for example.

I think the damage / attack / defense formulae are built-in in the source... So you can't change it.
December 30th 2005, 01:22 AM
anon.gif
toa
Ghost They/Them
 
It can be done. Convoluted, but possible.

All New Stats should result in D/A/M values for Dink and the enemy. After the attack, the New Stats should update or be updated from the change in health as necessary (health would be the main evidence of what happened during the attack).

I imagine a ton of code. My recent hacking on Dink (removing exp and expraise from the engine completly) suggests, at the bare minimum, adding unconditional external() calls (or inlined cut-n-paste of the same code) to every instance of attack() and/or hit(). (I changed the names of those a long time ago so I forget which does what...)

The end result is that all stats become a wrapper for D/A/M.

And if you want the new stats to be displayed, you'd better create a non-capitalist society.
December 30th 2005, 06:44 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
For these kind of things I use semi-functions.

Make a global &argument1 and you can set, for example:

&argument1 = 1;
external("stats","add_agility");

then in stats.c,

void add_agility( void )
{
int &crap = &argument1;
//Say we want to raise Dink's defense for every two points of agility
//this standing for his ability to better evade incoming blows
//Silly, I know, but for example's sake
&agility += &crap;
&crap = &agility;
&crap / 2;
&defense = &crap;
}

Of course this doesn't work.
What if there are other defensive bonuses active, not based on agility (like Dink has equipped a shield, or some magical shielding charm). What if there's another stat, like Luck, that improves defense as well?

Globals are usually my friend: simply count the amount of points invested in Agility, and see for each point if it should raise the defense (and maybe other stats) as well.
December 30th 2005, 02:49 PM
dragon.gif
What I mean is that say, to borrow off dnd 3rd edition, 18 Dexterity raised defence by 4 (Armour Class in dnds case). Or that 18 Constitution raises health by 4 per level.
December 30th 2005, 02:52 PM
dragon.gif
No I don't mean it like that. I mean, say that a score called dexterity could raise your defence
December 30th 2005, 02:56 PM
dragon.gif
The only problem with that is that it would raise by too much because each time it runs it would add an ammount and eacg ammount would stake.
December 30th 2005, 03:35 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
How do you mean? I don't see

defense += ...;

anywhere?

void add_ag( void )
{
&crap = &argument1;
add_ag_loop:
wait(1);
&crap -= 1;
&agility += 1;
&ag_def_count += 1;
if (&ag_def_count == 8)
{
//8 agility raises 1 defense
&defense += 1;
&ag_def_count = 0;
}
//For example, if agility should also raise magic for some crazy reason
&ag_mag_count += 1;
if (&ag_mag_count == 5)
{
//5 agility raises 1 magic
&magic += 1;
&ag_mag_count = 0;
}
goto add_ag_loop;
}

This might work too...
December 31st 2005, 01:30 AM
anon.gif
toa
Ghost They/Them
 
"What if there are other defensive bonuses active, not based on agility (like Dink has equipped a shield, or some magical shielding charm)."

arm() disarm()

In existing weapons, a set value is added to and subtracted from Dink's stats. Watch Attack when changing swords.
December 31st 2005, 01:36 AM
anon.gif
toa
Ghost They/Them
 
"The only problem with that is that it would raise by too much because each time it runs it would add an ammount and eacg ammount would stake."

An easy way is (to add half of your stat to defense):

&defense -= &mystat_modval;
&mystat_modval = &mystat_val;
&mystat_modval / 2;
&defense += &mystat_modval;

In other words, subtract the old modifier value before adding the new modifier value. If the calculation between the subtract/add is done without a wait(), then the status display shouldn't get all jumpy (displaying a lower val then a higher val).