Im not too fluent at RGSS but I have mild knowlege of C++, so I was wondering if anyone could translate this code into RGSS and help me figure out how to implement it:
See post 11 for current issue
[spoiler]
//Im trying to make a lvl up system that uses this formula:
(Enemy_Level/Char_Level)((Enemy_Level+Char_Level-1)^2)
//for the experience calculator and:
LevelUP(Exp,Char_Level,x){;
int req_exp;
if(Char_level==1){;
x=0;
}
req_exp=10+40(Char_Level-1))+x;
if(Exp>=req_exp)
Char_level=Char_level+1;
cout<<"Level Up!!";
x=req_exp;
}
return Char_level,x;
}
//for the required exp to level up. I aslo need x to keep its value throughout the whole
//game and needs to be different for each playabl character so obviously x would only be
//used in that function
[/spoiler]
so, any takers?
Could you be a little more clear about how exactly you want the formula to work in non-code terms? I'm fairly proficient in both langauges and could probably pull off a conversion.
Sure. I want the exp generated from any given monster to follow the formula and as for the function basically I want the exp requred for a level up to be 10 + 40 times 1 less than the characters level + the amount of exp the last level required. this would be probably simpler if I just reset the characters EXP to 0 each time s/he leveled but I want EXP to carry over so it kinda complicates things. hope this helps
So for a simple example, let's define the base xp for next level, 1 to 2, to be 10 xp. So the XP required to go from 2 to 3 would be 10 + 40(1) + 10 = 60. The first 10 you gave me as a constant, the 40 is another constant, the 1 is character level - 1, and the last 10 is the amount of XP that the last level required. So level 3 to 4 would be 10 + 40(2) + 60 = 140. Am I understanding this correctly? This shouldn't be too hard to implement. Basically you'll need to define the base case for XP required for level 2. The rest, you can script the calculation to fill in the blanks. Until I'm sure that I'm right about your formula, though, I don't want to go into any RGSS.
Yep, thats exactly how its supposed to work
This is the method in which the "exp list" for the actor is calculated (found in Game_Actor). Basically what this does is set the amount requird to level to level 1 to zero. Then it goes through the entire list of data about leveling up that you provide in the database, by default. All you'd have to do is replace this code with the EXP calculation algorithm you want. If you give me base values, I can throw together what SHOULD work.
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@exp_list[i] = @exp_list[i-1] + Integer(n)
end
end
end
Quote from: JustinAC link=topic=15185.msg194662#msg194662
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@exp_list[ i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@exp_list[i] = @exp_list[i-1] + Integer(n)
end
end
end
so...ok im completely lost
lemme see if i understand this.
The i is the characters level,
the first line tells which character the code affects,
@exp_list(i) is the exp required to level at that level,
pow_i is the inflation rate of the list every time I level but that is going to be replaced,
what I dont understand are these lines:
if i > actor.final_level
and
@exp_list[i] = @exp_list[i-1] + Integer(n)
if i > actor.final_level
and
@exp_list[i] = @exp_list[i-1] + Integer(n)
The first line is so that the algorithm knows once you've reached 100 elements in the list so that it stops calculating. Otherwise, it'd calculate for levels beyond 100, which obviously isnt necessary.
The second basically takes whatever experience was required for the next level and adds 'n' which is the calculated increment in necessary experience, using the growth factor. But you pretty much don't need to worry about the rest of the code where that is calculated, since you're replacing the system.
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
@exp_list[i] = @exp_list[i-1] + 40(i-1) + 10
end
end
end
would this work then? i hope i got it right, and if so the only thing left to do is to use that formula to change the exp given by mobs.
def make_exp_list
[b]actor = $data_actors[@actor_id][/b]
@exp_list[1] = 0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
@exp_list[i] = @exp_list[i-1] + 40(i-1) + 10
end
end
end
You may not even need to worry about the bolded line and actor.final_level, I'm not sure. I'd implement that code, comment out all of the old stuff by putting #'s before everything, and try that. The way you have it right now, it would take 50 experience to level to 2 (@exp_list[2-1] = 0 + 40(2-1) + 10). See if it works and if not i'll fiddle a bit more. good luck
thanks for the help
Ok... I still need help
Ive got the code but now it comes up with an error for the actor class at line 101 so now i need a way to use this without screwing up my game...Any ideas
also, can someone help me make a system where different stats increase based on what weapon in equipped when the character levels?
I'm currently on vacation but I can try to implement the system in a sample project once i get home tomorrow and I'll see if i get the same error as you.
Sorry for the double post just giving this a bump asking you if you could copy the entire method that you changed and indicate the line you're getting the error on, thanks
I replaced
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@exp_list[ i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@exp_list[i] = @exp_list[i-1] + Integer(n)
end
end
end
With
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
@exp_list[i] = @exp_list[i-1] + 40(i-1) + 10
end
end
end
and the error is on line 101 in the Game_Actor section I believe
I think he meant indicate the line of the copied script. I.e. point out the error in the code you present, not just line number since he can't see the line number. Also, what did the error say? What type of error is it?
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
@exp_list[i] = @exp_list[i-1] + 40(i-2) + 10 #This line is the error, might have to do with the 40(i-2) part
end
end
end
and as for the error it says ?????'Game_Actor'? 101 ??? SyntaxError ??????????
Try replacing that line with:
@exp_list[i] = @exp_list[i-1] + 40*(i-2) + 10
I think it might be that you did not put *
oh, never thought of that.
sorry for the late response, school work is dragging me down.
I'll try it as soon as i get home