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.
Question regarding maxSP manipulation and growth rates.

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 61
Silly Klok
Hi guys, Klokinator here, head of the Project Zelda Engine forums. I'm making a game called Fire Emblem Phoenix Saga, using the FEXP engine made by BwdYeti. Now, his massive script revisions are pretty complicated but I think my question shouldn't be too hard to answer, once I explain what I need to know.

First, Yeti rewrote the database's functions a little bit. None of them matter much, except that MaxSP has been rewritten to use as "growth rates". To be more descriptive...


Here, there are only two things that matter. Level, and Value.
Level is the numbers 1-7 which chooses which stat's growth rate to modify for a character.
1 = HP
2 = POW
3 = SKL
4 = SPD
5 = LUCK
6 = DEF
7 = RES

Value sets the growth rate. For example typing in a level of 3 and a value of 65 sets SKL to grow at a 65/100% chance, every level.

Now that this has been explained, I can explain what I want to do. I want to make it so typing in 500 or more in the value box makes it a reverse growth rate. So setting it to 501 would be a 1% chance of losing a stat, 555 gives you a 55% chance of losing a stat, etc.

The purpose for this is to have a character that starts out very, very strong in the early game, but gets weaker as you play because of his debilitating weakness.

Now, as I said, Yeti re-wrote the entire stat system, so I'll do two things here, and I know this is a big thing to tackle but I'll put your name in my game's credits if you help me :D
First I'll provide you a download link so you can search the scripts in his engine yourself. Get it here.
Next, here's a list of parameters to ctrl+shift+f for.
Code: [Select]
@stat_gain

and

@hp_growth (Or pdef_growth, etc etc.

You can find the relevant portions to modify in Fire Emblem Game_Battler script and Window Level Up.

Also, here are the codes in case you don't want to download it, but you'll probably need to.

Leveling up, this is what makes the level up window.
Code: [Select]
  def stat_update
    stat_sound = false
    case @timer
    when 0
      case @stat
      when 0
        get_stats
        Audio.se_play('Audio/SE/Level_Up_Level')
      when 1..8
        @stat_gain = @stat_ary[@stat-1]
        case @stat
        when 1
          @battler.actor.maxhp += @stat_gain
        when 2
          @battler.actor.pow += @stat_gain
        when 3
          @battler.actor.skl += @stat_gain
        when 4
          @battler.actor.spd += @stat_gain
        when 5
          @battler.actor.lck += @stat_gain
        when 6
          @battler.actor.pdef += @stat_gain
        when 7
          @battler.actor.mdef += @stat_gain
        when 8
          @battler.actor.con += @stat_gain
        end
        @stat_ary[@stat-1] = 0
        if @skipping
          stat_sound = true
        else
          Audio.se_play('Audio/SE/Level_Up_Stat')
        end
      end
      refresh
    when 1
      @stat_up_sparks.push(Stat_Up_Spark.new(@viewport1))
      case @stat
      when 0
        @stat_up_sparks[-1].x = @header.x + 79
        @stat_up_sparks[-1].y = @header.y - @header.oy - 18
        @stat_up_sparks[-1].z = 500
      when 1..8
        @stat_up_sparks[-1].x = @window.x + 19 + (@stat<5 ? 0 : 64)
        @stat_up_sparks[-1].y = @window.y - 16 + (16*((@stat-1)%4))
        @stat_up_sparks[-1].z = 500
        @stat_up_sparks.push(Stat_Change_Arrow.new(@viewport1))
        @stat_up_sparks[-1].value = ((@stat_gain < 0) ? 1 : 0)
        @stat_up_sparks[-1].x = @window.x + 56 + (@stat<5 ? 0 : 64)
        @stat_up_sparks[-1].y = @window.y - 8 + (16*((@stat-1)%4))
        @stat_up_sparks[-1].z = 200
        unless @stat_gain < 0
          @stat_up_sparks.push(Stat_Change_Bar.new(@viewport1))
          @stat_up_sparks[-1].x = @window.x + 12 + (@stat<5 ? 0 : 64)
          @stat_up_sparks[-1].y = @window.y + 12 + (16*((@stat-1)%4))
          @stat_up_sparks[-1].z = 2
        end
      end
    # Stat change number
    when 15
      unless @stat == 0
        @stat_up_sparks.push(Stat_Up_Num.new(@viewport1, @stat_gain))
        @stat_up_sparks[-1].x = @window.x + 64 + (@stat<5 ? 0 : 64)
        @stat_up_sparks[-1].y = @window.y + 14 + (16*((@stat-1)%4))
        @stat_up_sparks[-1].z = 400
      end
    when 17
      # Large numbers appear now for promotion
    when 20
      get_next_stat
    end
    @timer = (@timer+1) % 21
    return stat_sound
  end
 
  def get_next_stat
    cancel = true
    for i in 0...@stat_ary.length
      if @stat_ary[i] != 0
        cancel = false
        @stat = i + 1
        break
      end
    end
    @execute = !cancel
  end

This is for growth rates, I think. There might be other scripts.

Code: [Select]
  def item_effect(item)
    type = item.is_a?(RPG::Weapon) ? 0 : 1
    # Clear critical flag
    self.critical = false
    # If item scope is for ally with 1 or more HP, and your own HP = 0,
    # or item scope is for ally with 0 HP, and your own HP = 1 or more
    #if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
    #   ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
    #  # End Method
    #  return false
    #end
    # Clear effective flag
    effective = false
    # Set effective flag if common ID is effective
    effective |= item.common_event_id > 0
    # Determine hit
    hit_result = (rand(100) < item.hit)
    # Set effective flag is skill is uncertain
    effective |= item.hit < 100
    # If hit occurs
    if hit_result == true
      # Calculate amount of recovery
      recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
      # Element correction
      recover_hp *= elements_correct(item.element_set)
      recover_hp /= 100
      # Dispersion
      if item.variance > 0 and recover_hp.abs > 0
        amp = [recover_hp.abs * item.variance / 100, 1].max
        recover_hp += rand(amp+1) + rand(amp+1) - amp
      end
      # HP recovery
      self.hp += recover_hp
      # State change
      @state_changed = false
      effective |= states_plus(item.plus_state_set)
      effective |= states_minus(item.minus_state_set)
      # Stat gain
      if STAT_BOOSTERS.include?([type, item.id])
        boost = STAT_BOOSTERS[[type, item.id]]
        boost[1].each do |stat, bonus|
          case stat
          when :maxhp
            self.maxhp += bonus
          when :pow
            self.pow += bonus
          when :skl
            self.skl += bonus
          when :spd
            self.spd += bonus
          when :lck
            self.lck += bonus
          when :pdef
            self.pdef += bonus
          when :mdef
            self.mdef += bonus
          when :mov
            @move_plus += bonus
          when :con
            @con_bonus += bonus
          when :wlvl
            type = $data_weapons[self.items[
                self.equipped - 1][1]].weapon_type[0]
            wexp = FE_Config::WPNLVL_THRESHOLDS[[get_weapon_level(type) + bonus,
                FE_Config::WPNLVL_THRESHOLDS.length - 1].min] -
                weapon_levels(type)
            weapon_exp_gain(type, wexp)
            clear_wlvl_up
          when :wexp
            type = $data_weapons[self.items[
                self.equipped - 1][1]].weapon_type[0]
            weapon_exp_gain(type, bonus)
            clear_wlvl_up
          end
        end
      end
      # Growth boost
      if GROWTH_BOOSTERS.include?([type, item.id])
        boost = GROWTH_BOOSTERS[[type, item.id]]
        boost[1].each do |stat, bonus|
          case stat
          when :maxhp
            @hp_growth += bonus
          when :pow
            @pow_growth += bonus
          when :skl
            @skl_growth += bonus
          when :spd
            @spd_growth += bonus
          when :lck
            @lck_growth += bonus
          when :pdef
            @def_growth += bonus
          when :mdef
            @res_growth += bonus
          end
        end
      end
    end
  end
end

I've been told by many scripters that his code is sloppy, so if it is, I apologize in advance. I've pretty sure it's something like "If growth is < 500, decrease stat" or something, I'm just not a good scripter yet and I'm still learning.
« Last Edit: February 19, 2012, 07:03:17 AM by Klokinator »