RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Experience system scrpt [ not resolved ] T_T

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 87
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 for:
Code: [Select]

//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
so, any takers?
« Last Edit: April 13, 2007, 09:04:54 PM by Kurochi »
Project: Kurotsuki -Black Moon Fable
Progress: 3%

**
Rep: +0/-0Level 87
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.

**
Rep:
Level 87
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
Project: Kurotsuki -Black Moon Fable
Progress: 3%

**
Rep: +0/-0Level 87
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.

**
Rep:
Level 87
Yep, thats exactly how its supposed to work
Project: Kurotsuki -Black Moon Fable
Progress: 3%

**
Rep: +0/-0Level 87
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.

Code: [Select]
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

**
Rep:
Level 87
Quote from: JustinAC link=topic=15185.msg194662#msg194662
Code: [Select]
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:
Code: [Select]
if i > actor.final_level

and

@exp_list[i] = @exp_list[i-1] + Integer(n)
Project: Kurotsuki -Black Moon Fable
Progress: 3%

**
Rep: +0/-0Level 87
Code: [Select]
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.

**
Rep:
Level 87
Code: [Select]
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.
Project: Kurotsuki -Black Moon Fable
Progress: 3%

**
Rep: +0/-0Level 87
Code: [Select]
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

**
Rep:
Level 87
thanks for the help
Project: Kurotsuki -Black Moon Fable
Progress: 3%

**
Rep:
Level 87
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?
Project: Kurotsuki -Black Moon Fable
Progress: 3%

**
Rep: +0/-0Level 87
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.

**
Rep: +0/-0Level 87
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

**
Rep:
Level 87
I replaced
Code: [Select]
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

Code: [Select]
  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
Project: Kurotsuki -Black Moon Fable
Progress: 3%

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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?

**
Rep:
Level 87
Code: [Select]
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
Code: [Select]
?????'Game_Actor'? 101 ??? SyntaxError ??????????
Project: Kurotsuki -Black Moon Fable
Progress: 3%

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Try replacing that line with:


       
Code: [Select]
@exp_list[i] = @exp_list[i-1] + 40*(i-2) + 10

I think it might be that you did not put *

**
Rep:
Level 87
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
Project: Kurotsuki -Black Moon Fable
Progress: 3%