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.
How do I edit EXP script?

0 Members and 3 Guests are viewing this topic.

***
Rep:
Level 82
We learn by living...
So here's the basic code I found in game actor:

Code: [Select]
# * Calculate EXP
  #--------------------------------------------------------------------------
  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

I want to modify it so the experience requirement is based on (level)*(level+2)*(10 + inflation)
with inflation being an integer from say, 0-30.

Can it be done?

The first equation: (level)*(level+2) produces integers 1-9999, when level range is 1-99 by the way.

*
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
Umm, try:

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] = (i*(i + 2))*(actor.exp_inflation)
      end
    end
  end

And you would set exp inflation where you normally set it in the database. Umm, note that I excluded the 10 + since you can set inflation from 0-50 in the database, so you could just make the range 10-40 if you only wanted it to be within that range.

If you really want the 10 + for whatever reason, then just change this line:
Code: [Select]
        @exp_list[i] = (i*(i + 2))*(actor.exp_inflation)
to:
Code: [Select]
        @exp_list[i] = (i*(i + 2))*(10 + actor.exp_inflation)

***
Rep:
Level 82
We learn by living...
Code: [Select]
@exp_list[i] = (i*(i + 2))*(actor.exp_inflation / 10)

I just realized needed to set the numbers to base. it appears the default "inflation" is 10, so I divided by 10.

so level 2 = (2*(2+2=4)) = 8.
« Last Edit: April 22, 2010, 07:56:23 PM by shintashi »

*
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
What do you have the inflation set at? 10?

It should be 8 * inflation, since level*(level+2) = 2*(2+2) = 8

Unless you meant that it should be previous level * (previous level + 2); I assumed you meant the goal level and wrote the code with that in mind.

If you want it to be previous level, then change:

Code: [Select]
@exp_list[i] = (i*(i + 2))*(actor.exp_inflation)

to:

Code: [Select]
@exp_list[i] = ((i -1)*(i + 1))*(actor.exp_inflation)
« Last Edit: April 22, 2010, 07:57:50 PM by modern algebra »

***
Rep:
Level 82
We learn by living...
i don't know how to manually over ride the database. The basis and inflation defaults are both 10.

If I could edit some stuff in the database, programming this thing would be 100 times faster.

*
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
Just click the exp curve bar on the actor page in the database, and move the slide bars at the bottom of the window that comes up.

The modified formula won't show up in the database though - but it will still work in-game

***
Rep:
Level 82
We learn by living...
that works for basis, but in my version of the program, the inflation cannot be set below 10 - even if I manually type in 0 or 1, it resets to 10. That's why I divided by 10 in the script. Am I missing something or do I have to know Ruby to change the data base?

*
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
Oh, no you're right about Inflation. And you can't use Ruby to change the database. But why divide by 10? Shouldn't you just subtract it if you want the minimum to be 0?

***
Rep:
Level 82
We learn by living...
Oh, no you're right about Inflation. And you can't use Ruby to change the database. But why divide by 10? Shouldn't you just subtract it if you want the minimum to be 0?

I tried subtracting 9 but it crashed.

You would think a base multiplier of (10-9) would be the same as x1, but apparently not. :-\

*
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
Well, you might not have had the right syntax. Was it:

Code: [Select]
@exp_list[i] = (i*(i + 2))*(actor.exp_inflation - 9)
?

***
Rep:
Level 82
We learn by living...
Well, you might not have had the right syntax. Was it:

Code: [Select]
@exp_list[i] = (i*(i + 2))*(actor.exp_inflation - 9)
?

yes, that's what i put, then the thing went haywire for a while.

*
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
Well, works fine when I tested it.

***
Rep:
Level 82
We learn by living...
yes, it does work now. I think I misplaced a space or something.