08 Nov, 2013, Grieffels wrote in the 1st comment:
Votes: 0
Basically, the code represents value 0 - 4 on an object and the level of an object
This below statement is if the level of the object is greater than the value give them the skill.

for (i = 0; i < 5; i++)
{
if (materia->value[i] == sn && materia->level > i )
skill = 100;

}


Now i'm trying to toy with this and make it so I can start the object off at level 0.
I tried using materia->level >= i but that gives me value 0 and value 1 for whatever reason.
I've tried materia->level + 1 > i and that gives me two. I've tried subtracting - 1 from i
such as > i - 1). Most everything i've listed is the stating the same thing so how do I add one to materia->level falsely
just so it will allow objects at level 0 to have the value0 skill?

To go into more with this just to make sure i've covered my grounds.
Level: 0
v0 Fire
v1 Fire2
v2 Fire3
v3 None
v4 Fire4

With this, I get no spell/skill from it. When it levels to 1, I get the value0,level 2 value0 and 1. So mainly, im just trying
to get the value 0 even if the object is level 0. This goes for all of them. If the object level is the same or greater than the value, you gain that skill/spell associated with it.


Edit by kiasyn: added code tags
08 Nov, 2013, Kaz wrote in the 2nd comment:
Votes: 0
Can you re-post, but substituting the variable named i for something else. What I presume are array indexes using it got lost in italics.
08 Nov, 2013, Grieffels wrote in the 3rd comment:
Votes: 0
for (i = 0; i < 5; i++) 
{
if (materia->value[i] == sn && materia->level > i )
skill = 100;
}


Edit by kiasyn: add code tags
08 Nov, 2013, Kaz wrote in the 4th comment:
Votes: 0
Ok, renaming i to level, because that is what it seems to be:

Quote
This below statement is if the level of the object is greater than the value give them the skill.

for (level = 0; level < 5; level++) 
{
if (materia->value[level] == sn && materia->level > level )
skill = 100;
}


Incoming stream of consciousness:

Replacing "level" for "0..4", then if I understand correctly, materia->value[0..4] are a group of spells (sn is usually skill/spell number, IIRC) that the materia uses. So, this algorithm is in two parts. The first of these parts is to see if the materia uses the sn in question. That is the "materia->value[0..4] == sn" check. The second part is to see if the user (?) is qualified to use it. That's the "materia->level > 0..4" check. The consequence of this is:

materia->value[0] can only be used if materia->level > 0
materia->value[1] can only be used if materia->level > 1
materia->value[2] can only be used if materia->level > 2
materia->value[3] can only be used if materia->level > 3
materia->value[4] can only be used if materia->level > 4

From your text, it seems that you want this effect:

materia->value[0] can always be used. (materia->level >= 0)
materia->value[1] can only be used if materia->level > 1
materia->value[2] can only be used if materia->level > 2
materia->value[3] can only be used if materia->level > 3
materia->value[4] can only be used if materia->level > 4

If this is what you mean, then you have an exception, and what you end up with is:

if (materia->value[0] == sn)
{
skill = 100;
}
else
{
/* previous for-loop */
}


Standard Knuth Disclaimer*
-> Edited for correctness and irony.
08 Nov, 2013, Grieffels wrote in the 5th comment:
Votes: 0
Yes, pretty much that is what I mean. So how can I make materia->level >= value]iYes, pretty much that is what I mean. So how can I make materia->level >= value]i[ give a skill? Im just not understanding how >= makes the statement give even the next value, past what the object level is compared to which of the 5 values it can it starting at 0.
0 >= 0 doesnt equal anything different. It just says hey, OBJ LEVEL is 0 and it >= value0, give them a prize.
If the object level is 1 and value0 and value1 prize belongs to them.
0.0/5