Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Difficulty effects

This script gives a complete control of the game challengue, not only with a initial decision.

Features:

-You can create all the difficulty effects you want and active and desactive at your will. Each effect can changue some nemy atributes based in %.
The effects are accumulative and saved when quit the game.

4 ways of choosing what enemies are using the effects:

-By enemies ids
-By maps ids
-Using the map tree system. You only have to write the name of the parent map and all the others are included in the effect.
-Global

-All the atributes are optional.

-You can use the value in a event variable to control all the values of a effect in real time.

-HP, SP, ATK, PDEF, PMAG, EVS, STR, DEX, AGI, INT, EXPERIENCIE, GOLD and DROP


As usual, the script is in development. Bugs,sugerences,etc...

Also i suppose that this script might be incompatible with other difficulty scripts. Just ask for a compatibilitzation.

Code:
#==============================================================================

# Difficulty effects

# By gerkrt/gerrtunk

# Version: 1

# License: GPL, credits

#==============================================================================

 

=begin

 

This script gives a complete control of the game challengue, not only with a 

initial decision.

 

Features:

 

-You can create all the difficulty effects you want and active and desactive

at your will. Each effect can changue some nemy atributes based in %.

The effects are accumulative and saved when quit the game.

 

4 ways of choosing what enemies are using the effects:

 

-By enemies ids

-By maps ids

-Using the map tree system. You only have to write the name of the parent map

and all the others are included in rhe effect.

-Global

 

-All the atributes are optional.

 

-You can use the value in a event variable to control all the values of a effect

in real time.

 

-HP, SP, ATK, PDEF, PMAG, EVS, STR, DEX, AGI, INT, EXPERIENCIE, GOLD and DROP

 

 

############ Values and sintaxis #########

 

Enemies atributes are calculated in %. Each atribute you add to a effect to

modify starts wuth a value of 100% and then you can sum or rest to it.

 

Example:

      Difficulty_effects[5] = {   

    :active  => false,            

    :type  => 3,                  

    :base_map_name  => 'Forest',   

    :hp => 50,                    

    :sp =>-30             

    }

  

This makes that the hp is 150 and sp 70.

 

:x => value of x,

 

You must respect :  before x name, the => separating them and the final ,

 

-Each new effect must have a new and unique number ID in Difficulty_effects[ID]

-Dont touch the {}. They mean start and end and have to be in that positions.

-You can add or remove any values, just use the same sintaxis.

-The last value dont use the  final ,

 

 

############ Option types #########

  

 

Obligatory:

 

active: If you give this a true value the script will start actived.

 

type: Define how is going to know the script wich enemies affect.

Values:

  1.By enemies ids

  2.By maps ids

  3.By map tree

  4.Global

  

enemies_ids: Obligatory when type is 1. Define wich enemies are affected.

  :enemies_ids => [1,2,3]

  

maps_ids: Obligatory when type is 2. Define wich maps are affected.

  :maps_ids => [1,2,3]

 

base_map_name: Obligatory when type is 3. Define the parent map name.

 

Optionals:

 

variable: Makes that all values of the effect depend of that event variable value.

value*event_variable/100

 

hp  

sp  

 

atk   

pdef  

mdef 

evs   

 

str   STRENGTH

dex   DEXTERITY

agi   AGILITY

int   INTELIGENCE

 

exp   EXPERIENCIE

gold  MONEY

drop  % OF ITEMS

 

Note that you can erase the example effects.

 

############ Select wich enemies will use the effect #########

 

 

-Global. All combats

 

-By enemies: Only the enemies that you add to the list.

 

-By maps: All combats in the maps that you add to the list.

 

-By map tree: With this you only have to define a parent map and write its name in

the effect. All the maps and combats under it will have the effect.

 

The map tree is show under the tileset tool. If you doubleclick to - or + you will 

see that the maps are shown in groups that depend in parent maps.

 

Note: I recomend having the maps having the maps ordered and directly relationed with 

its parent map to have optimal performance.

 

Use example:

 

Mapamundi

  Forest

    Mapa3

    Mapa4

    Mapa5

      Mapa6

      Mapa7

      

  Pantano del Wep

    Mapa9

    

Ex:

    

      Difficulty_effects[2] = {

    :active  => false,

    :hp => 50,

    :sp => 30,

    :atk   => 20,

    :spi   => 20,

    :agi   => 10,

    :drop  => -20,

    :variable  => 6,

    :type  => 3,

    :base_map_name  => 'Forest'

  }

 

  

Maps 3,4,5,6,7, and Forest have that effect. 

 

 

############ Activating effects #########

 

Activate: start_difficulty_effect(effect number)

 

Desactivate: stop_difficulty_effect(effect number)

 

Ex: start_difficulty_effect(1)

 

############ Last notes #########

 

-All the effects to an enemy are sumed and then applied.

 

-You can create large number groups with this:

 

  :enemies_ids => (1..25).to_a

  

  This is like putting the enemies ids 1-25

  

-Creditss: this script have been created studying  KGC 

BattleDifficuly

 

 

=end

 

module Wep

  # Dont touch this

  Difficulty_effects = []

  

  

  Difficulty_effects[1] = {

    :active  => false,

    :hp => 50,

    :mp => 30,

    :atk   => 20,

    :agi   => 10,

    :drop  => 20,

    :variable  => 4,

    :type  => 1,

    :enemies_ids  => [2,3]

  }

    Difficulty_effects[2] = {

    :active  => false,

    :hp => 50,

    :mp =>30,

    :atk   => 20,

    :agi   => 10,

    :drop  => 20,

    :gold => 20,

    :exp => 20,

    :variable  => 5,

    :type  => 2,

    :maps_ids  => [1,2,3,4,6,7]

  }

      Difficulty_effects[3] = {

    :active  => false,

    :hp => 50,

    :mp => 30,

    :atk   => 20,

    :dex   => 20,

    :agi   => 10,

    :drop  => -20,

    :variable  => 6,

    :type  => 3,

    :base_map_name  => 'Forest'

  }

        Difficulty_effects[4] = {

    :active  => false,

    :hp => 50,

    :mp => 30,

    :atk   => 20,

    :agi   => 10,

    :drop  => -20,

    :variable  => 6,

    :type  => 4 

  }

  

end

 

class Game_System

  attr_accessor :difficulty_effects

  alias gs_wep_cc_init initialize

  def initialize

    @difficulty_effects = Wep::Difficulty_effects

    gs_wep_cc_init

  end

  

end

 

class Interpreter

  

  def start_difficulty_effect(num)

     $game_system.difficulty_effects[num][:active] = true

  end

  

  def stop_difficulty_effect(num)

     $game_system.difficulty_effects[num][:active] = false

  end

 

end  

 

class Game_Party

  def tree_includes_map? (name)

    # Load mapinfos for map name

    mapinfos = load_data("Data/MapInfos.rxdata")    

    # If his name is the name searched

    if mapinfos[$game_map.map_id].name == name

        return true

    end

 

    map = $game_map.map_id

    

    # Iterate all parents maps 

    while mapinfos[map].parent_id != 0

        if mapinfos[mapinfos[map].parent_id].name == name

          return true

        else

          map = mapinfos[map].parent_id

        end

    end

  end

end

 

#==============================================================================

# ■ Game_Enemy

#==============================================================================

 

class Game_Enemy < Game_Battler

  #--------------------------------------------------------------------------

  # ● MaxHP 

  #--------------------------------------------------------------------------

  alias base_maxhp_Challengue_Compensator base_maxhp

  def base_maxhp

    # Gets normal atribute

    n = base_maxhp_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:hp] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:hp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:hp]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:hp] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:hp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:hp]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:hp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:hp]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:hp]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:hp] != nil 

           if effect[:variable] != nil

             total+=effect[:hp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:hp]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● MaxSP 

  #--------------------------------------------------------------------------

  alias base_maxsp_Challengue_Compensator base_maxsp

  def base_maxsp

    # Gets normal atribute

    n = base_maxsp_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:sp] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:sp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:sp]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:sp] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:sp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:sp]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:sp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:sp]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:sp]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:sp] != nil 

           if effect[:variable] != nil

             total+=effect[:sp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:sp]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxstr 

  #--------------------------------------------------------------------------

  alias base_str_Challengue_Compensator base_str

  def base_str

    # Gets normal atribute

    n = base_str_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:str] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:str]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:str]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:str] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:str]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:str]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:str] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:str]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:str]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:str] != nil 

           if effect[:variable] != nil

             total+=effect[:str]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:str]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxdex 

  #--------------------------------------------------------------------------

  alias base_dex_Challengue_Compensator base_dex

  def base_dex

    # Gets normal atribute

    n = base_dex_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:dex] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:dex]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:dex]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:dex] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:dex]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:dex]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:dex] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:dex]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:dex]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:dex] != nil 

           if effect[:variable] != nil

             total+=effect[:dex]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:dex]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxagi 

  #--------------------------------------------------------------------------

  alias base_agi_Challengue_Compensator base_agi

  def base_agi

    # Gets normal atribute

    n = base_agi_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:agi] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:agi]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:agi]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:agi] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:agi]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:agi]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:agi] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:agi]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:agi]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:agi] != nil 

           if effect[:variable] != nil

             total+=effect[:agi]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:agi]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxint 

  #--------------------------------------------------------------------------

  alias base_int_Challengue_Compensator base_int

  def base_int

    # Gets normal atribute

    n = base_int_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:int] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:int]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:int]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:int] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:int]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:int]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:int] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:int]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:int]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:int] != nil 

           if effect[:variable] != nil

             total+=effect[:int]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:int]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxatk 

  #--------------------------------------------------------------------------

  alias base_atk_Challengue_Compensator base_atk

  def base_atk

    # Gets normal atribute

    n = base_atk_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:atk] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:atk]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:atk]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:atk] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:atk]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:atk]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:atk] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:atk]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:atk]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:atk] != nil 

           if effect[:variable] != nil

             total+=effect[:atk]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:atk]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxpdef 

  #--------------------------------------------------------------------------

  alias base_pdef_Challengue_Compensator base_pdef

  def base_pdef

    # Gets normal atribute

    n = base_pdef_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:pdef] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:pdef]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:pdef]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:pdef] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:pdef]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:pdef]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:pdef] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:pdef]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:pdef]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:pdef] != nil 

           if effect[:variable] != nil

             total+=effect[:pdef]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:pdef]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxmdef 

  #--------------------------------------------------------------------------

  alias base_mdef_Challengue_Compensator base_mdef

  def base_mdef

    # Gets normal atribute

    n = base_mdef_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:mdef] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:mdef]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:mdef]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:mdef] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:mdef]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:mdef]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:mdef] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:mdef]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:mdef]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:mdef] != nil 

           if effect[:variable] != nil

             total+=effect[:mdef]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:mdef]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxeva 

  #--------------------------------------------------------------------------

  alias base_eva_Challengue_Compensator base_eva

  def base_eva

    # Gets normal atribute

    n = base_eva_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:eva] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:eva]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:eva]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:eva] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:eva]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:eva]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:eva] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:eva]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:eva]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:eva] != nil 

           if effect[:variable] != nil

             total+=effect[:eva]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:eva]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxexp 

  #--------------------------------------------------------------------------

  alias exp_Challengue_Compensator exp

  def exp

    # Gets normal atribute

    n = exp_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:exp] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:exp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:exp]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:exp] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:exp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:exp]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:exp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:exp]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:exp]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:exp] != nil 

           if effect[:variable] != nil

             total+=effect[:exp]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:exp]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxgold 

  #--------------------------------------------------------------------------

  alias gold_Challengue_Compensator gold

  def gold

    # Gets normal atribute

    n = gold_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:gold] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:gold]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:gold]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:gold] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:gold]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:gold]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:gold] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:gold]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:gold]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:gold] != nil 

           if effect[:variable] != nil

             total+=effect[:gold]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:gold]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

  

  #--------------------------------------------------------------------------

  # ● Maxdrop 

  #--------------------------------------------------------------------------

  alias treasure_prob_Challengue_Compensator treasure_prob

  def treasure_prob

    # Gets normal atribute

    n = treasure_prob_Challengue_Compensator

    # Sets total to a base 100%

    total = 100

    # Search in all effects

    for effect in $game_system.difficulty_effects

         # Effect type 1

         if effect[:active] and effect[:type] == 1  and effect[:drop] != nil and  effect[:enemies_ids].include?(@enemy_id)

           if effect[:variable] != nil

             total+=effect[:drop]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:drop]

           end

         end

         # Effect type 2

         if effect[:active] and effect[:type] == 2  and effect[:drop] != nil and  effect[:maps_ids].include?($game_map.map_id)

           if effect[:variable] != nil

             total+=effect[:drop]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:drop]

           end

         end

         # Effect type 3

         if effect[:active] and effect[:type] == 3  and effect[:drop] != nil and $game_party.tree_includes_map? (effect[:base_map_name])

           if effect[:variable] != nil             

             total+=effect[:drop]*$game_variables[effect[:variable]].to_f/100

           else

             total+=effect[:drop]

           end

         end

         # Effect type 4

         if effect[:active] and effect[:type] == 4 and effect[:drop] != nil 

           if effect[:variable] != nil

             total+=effect[:drop]*$game_variables[effect[:variable]]/100

           else

             total+=effect[:drop]

           end

         end

    end

    n = n * total / 100  

    return n.to_i

  end

end

 

 
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top