struct stVitals // Entity vitals
{
int str;
int xp;
int batk;
};
int doAttack(stVitals Aggressor, stVitals Defender) // Calculate attack results
{
doHit(getATK(Aggressor), getDEF(Defender), getDDG(Defender), getLVL(Aggressor), getLVL(Defender));
}
int doHit([...] // Calculate damage
int getATK(stVitals sourcemob) // Calculate attack value
{
int output = ((sourcemob.str * getLVL(sourcemob.xp)) * 0.1) + sourcemob.batk;
return output;
}
int getLVL(int xp) // Return level from XP
{
return (xp * 0.001);
}
Gives the following error:
ERROR: Conversion from 'int' to non-scalar type 'stVitals' requested
I work with ints within various stVital instances all around my program in this manner with no problems… what’s going on here that I’m missing?
edit: It is hollering about the first line inside of getATK
What’s missing here is the code in which you call
getATK. Presumably, you’re incorrectly passing anintargument rather than anstVitalsargument when you call that function.