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.

  1. #==============================================================================
  2. # Difficulty effects
  3. # By gerkrt/gerrtunk
  4. # Version: 1
  5. # License: GPL, credits
  6. #==============================================================================
  7.  
  8. =begin
  9.  
  10. This script gives a complete control of the game challengue, not only with a
  11. initial decision.
  12.  
  13. Features:
  14.  
  15. -You can create all the difficulty effects you want and active and desactive
  16. at your will. Each effect can changue some nemy atributes based in %.
  17. The effects are accumulative and saved when quit the game.
  18.  
  19. 4 ways of choosing what enemies are using the effects:
  20.  
  21. -By enemies ids
  22. -By maps ids
  23. -Using the map tree system. You only have to write the name of the parent map
  24. and all the others are included in rhe effect.
  25. -Global
  26.  
  27. -All the atributes are optional.
  28.  
  29. -You can use the value in a event variable to control all the values of a effect
  30. in real time.
  31.  
  32. -HP, SP, ATK, PDEF, PMAG, EVS, STR, DEX, AGI, INT, EXPERIENCIE, GOLD and DROP
  33.  
  34.  
  35. ############ Values and sintaxis #########
  36.  
  37. Enemies atributes are calculated in %. Each atribute you add to a effect to
  38. modify starts wuth a value of 100% and then you can sum or rest to it.
  39.  
  40. Example:
  41.       Difficulty_effects[5] = {  
  42.     :active  => false,            
  43.     :type  => 3,                  
  44.     :base_map_name  => 'Forest',  
  45.     :hp => 50,                    
  46.     :sp =>-30            
  47.     }
  48.  
  49. This makes that the hp is 150 and sp 70.
  50.  
  51. :x => value of x,
  52.  
  53. You must respect :  before x name, the => separating them and the final ,
  54.  
  55. -Each new effect must have a new and unique number ID in Difficulty_effects[ID]
  56. -Dont touch the {}. They mean start and end and have to be in that positions.
  57. -You can add or remove any values, just use the same sintaxis.
  58. -The last value dont use the  final ,
  59.  
  60.  
  61. ############ Option types #########
  62.  
  63.  
  64. Obligatory:
  65.  
  66. active: If you give this a true value the script will start actived.
  67.  
  68. type: Define how is going to know the script wich enemies affect.
  69. Values:
  70.   1.By enemies ids
  71.   2.By maps ids
  72.   3.By map tree
  73.   4.Global
  74.  
  75. enemies_ids: Obligatory when type is 1. Define wich enemies are affected.
  76.   :enemies_ids => [1,2,3]
  77.  
  78. maps_ids: Obligatory when type is 2. Define wich maps are affected.
  79.   :maps_ids => [1,2,3]
  80.  
  81. base_map_name: Obligatory when type is 3. Define the parent map name.
  82.  
  83. Optionals:
  84.  
  85. variable: Makes that all values of the effect depend of that event variable value.
  86. value*event_variable/100
  87.  
  88. hp  
  89. sp  
  90.  
  91. atk  
  92. pdef  
  93. mdef
  94. evs  
  95.  
  96. str   STRENGTH
  97. dex   DEXTERITY
  98. agi   AGILITY
  99. int   INTELIGENCE
  100.  
  101. exp   EXPERIENCIE
  102. gold  MONEY
  103. drop  % OF ITEMS
  104.  
  105. Note that you can erase the example effects.
  106.  
  107. ############ Select wich enemies will use the effect #########
  108.  
  109.  
  110. -Global. All combats
  111.  
  112. -By enemies: Only the enemies that you add to the list.
  113.  
  114. -By maps: All combats in the maps that you add to the list.
  115.  
  116. -By map tree: With this you only have to define a parent map and write its name in
  117. the effect. All the maps and combats under it will have the effect.
  118.  
  119. The map tree is show under the tileset tool. If you doubleclick to - or + you will
  120. see that the maps are shown in groups that depend in parent maps.
  121.  
  122. Note: I recomend having the maps having the maps ordered and directly relationed with
  123. its parent map to have optimal performance.
  124.  
  125. Use example:
  126.  
  127. Mapamundi
  128.   Forest
  129.     Mapa3
  130.     Mapa4
  131.     Mapa5
  132.       Mapa6
  133.       Mapa7
  134.      
  135.   Pantano del Wep
  136.     Mapa9
  137.    
  138. Ex:
  139.    
  140.       Difficulty_effects[2] = {
  141.     :active  => false,
  142.     :hp => 50,
  143.     :sp => 30,
  144.     :atk   => 20,
  145.     :spi   => 20,
  146.     :agi   => 10,
  147.     :drop  => -20,
  148.     :variable  => 6,
  149.     :type  => 3,
  150.     :base_map_name  => 'Forest'
  151.   }
  152.  
  153.  
  154. Maps 3,4,5,6,7, and Forest have that effect.
  155.  
  156.  
  157. ############ Activating effects #########
  158.  
  159. Activate: start_difficulty_effect(effect number)
  160.  
  161. Desactivate: stop_difficulty_effect(effect number)
  162.  
  163. Ex: start_difficulty_effect(1)
  164.  
  165. ############ Last notes #########
  166.  
  167. -All the effects to an enemy are sumed and then applied.
  168.  
  169. -You can create large number groups with this:
  170.  
  171.   :enemies_ids => (1..25).to_a
  172.  
  173.   This is like putting the enemies ids 1-25
  174.  
  175. -Creditss: this script have been created studying  KGC
  176. BattleDifficuly
  177.  
  178.  
  179. =end
  180.  
  181. module Wep
  182.   # Dont touch this
  183.   Difficulty_effects = []
  184.  
  185.  
  186.   Difficulty_effects[1] = {
  187.     :active  => false,
  188.     :hp => 50,
  189.     :mp => 30,
  190.     :atk   => 20,
  191.     :agi   => 10,
  192.     :drop  => 20,
  193.     :variable  => 4,
  194.     :type  => 1,
  195.     :enemies_ids  => [2,3]
  196.   }
  197.     Difficulty_effects[2] = {
  198.     :active  => false,
  199.     :hp => 50,
  200.     :mp =>30,
  201.     :atk   => 20,
  202.     :agi   => 10,
  203.     :drop  => 20,
  204.     :gold => 20,
  205.     :exp => 20,
  206.     :variable  => 5,
  207.     :type  => 2,
  208.     :maps_ids  => [1,2,3,4,6,7]
  209.   }
  210.       Difficulty_effects[3] = {
  211.     :active  => false,
  212.     :hp => 50,
  213.     :mp => 30,
  214.     :atk   => 20,
  215.     :dex   => 20,
  216.     :agi   => 10,
  217.     :drop  => -20,
  218.     :variable  => 6,
  219.     :type  => 3,
  220.     :base_map_name  => 'Forest'
  221.   }
  222.         Difficulty_effects[4] = {
  223.     :active  => false,
  224.     :hp => 50,
  225.     :mp => 30,
  226.     :atk   => 20,
  227.     :agi   => 10,
  228.     :drop  => -20,
  229.     :variable  => 6,
  230.     :type  => 4
  231.   }
  232.  
  233. end
  234.  
  235. class Game_System
  236.   attr_accessor :difficulty_effects
  237.   alias gs_wep_cc_init initialize
  238.   def initialize
  239.     @difficulty_effects = Wep::Difficulty_effects
  240.     gs_wep_cc_init
  241.   end
  242.  
  243. end
  244.  
  245. class Interpreter
  246.  
  247.   def start_difficulty_effect(num)
  248.      $game_system.difficulty_effects[num][:active] = true
  249.   end
  250.  
  251.   def stop_difficulty_effect(num)
  252.      $game_system.difficulty_effects[num][:active] = false
  253.   end
  254.  
  255. end  
  256.  
  257. class Game_Party
  258.   def tree_includes_map? (name)
  259.     # Load mapinfos for map name
  260.     mapinfos = load_data("Data/MapInfos.rxdata")    
  261.     # If his name is the name searched
  262.     if mapinfos[$game_map.map_id].name == name
  263.         return true
  264.     end
  265.  
  266.     map = $game_map.map_id
  267.    
  268.     # Iterate all parents maps
  269.     while mapinfos[map].parent_id != 0
  270.         if mapinfos[mapinfos[map].parent_id].name == name
  271.           return true
  272.         else
  273.           map = mapinfos[map].parent_id
  274.         end
  275.     end
  276.   end
  277. end
  278.  
  279. #==============================================================================
  280. # ■ Game_Enemy
  281. #==============================================================================
  282.  
  283. class Game_Enemy < Game_Battler
  284.   #--------------------------------------------------------------------------
  285.   # ● MaxHP
  286.   #--------------------------------------------------------------------------
  287.   alias base_maxhp_Challengue_Compensator base_maxhp
  288.   def base_maxhp
  289.     # Gets normal atribute
  290.     n = base_maxhp_Challengue_Compensator
  291.     # Sets total to a base 100%
  292.     total = 100
  293.     # Search in all effects
  294.     for effect in $game_system.difficulty_effects
  295.          # Effect type 1
  296.          if effect[:active] and effect[:type] == 1  and effect[:hp] != nil and  effect[:enemies_ids].include?(@enemy_id)
  297.            if effect[:variable] != nil
  298.              total+=effect[:hp]*$game_variables[effect[:variable]]/100
  299.            else
  300.              total+=effect[:hp]
  301.            end
  302.          end
  303.          # Effect type 2
  304.          if effect[:active] and effect[:type] == 2  and effect[:hp] != nil and  effect[:maps_ids].include?($game_map.map_id)
  305.            if effect[:variable] != nil
  306.              total+=effect[:hp]*$game_variables[effect[:variable]]/100
  307.            else
  308.              total+=effect[:hp]
  309.            end
  310.          end
  311.          # Effect type 3
  312.          if effect[:active] and effect[:type] == 3  and effect[:hp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  313.            if effect[:variable] != nil            
  314.              total+=effect[:hp]*$game_variables[effect[:variable]].to_f/100
  315.            else
  316.              total+=effect[:hp]
  317.            end
  318.          end
  319.          # Effect type 4
  320.          if effect[:active] and effect[:type] == 4 and effect[:hp] != nil
  321.            if effect[:variable] != nil
  322.              total+=effect[:hp]*$game_variables[effect[:variable]]/100
  323.            else
  324.              total+=effect[:hp]
  325.            end
  326.          end
  327.     end
  328.     n = n * total / 100  
  329.     return n.to_i
  330.   end
  331.  
  332.   #--------------------------------------------------------------------------
  333.   # ● MaxSP
  334.   #--------------------------------------------------------------------------
  335.   alias base_maxsp_Challengue_Compensator base_maxsp
  336.   def base_maxsp
  337.     # Gets normal atribute
  338.     n = base_maxsp_Challengue_Compensator
  339.     # Sets total to a base 100%
  340.     total = 100
  341.     # Search in all effects
  342.     for effect in $game_system.difficulty_effects
  343.          # Effect type 1
  344.          if effect[:active] and effect[:type] == 1  and effect[:sp] != nil and  effect[:enemies_ids].include?(@enemy_id)
  345.            if effect[:variable] != nil
  346.              total+=effect[:sp]*$game_variables[effect[:variable]]/100
  347.            else
  348.              total+=effect[:sp]
  349.            end
  350.          end
  351.          # Effect type 2
  352.          if effect[:active] and effect[:type] == 2  and effect[:sp] != nil and  effect[:maps_ids].include?($game_map.map_id)
  353.            if effect[:variable] != nil
  354.              total+=effect[:sp]*$game_variables[effect[:variable]]/100
  355.            else
  356.              total+=effect[:sp]
  357.            end
  358.          end
  359.          # Effect type 3
  360.          if effect[:active] and effect[:type] == 3  and effect[:sp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  361.            if effect[:variable] != nil            
  362.              total+=effect[:sp]*$game_variables[effect[:variable]].to_f/100
  363.            else
  364.              total+=effect[:sp]
  365.            end
  366.          end
  367.          # Effect type 4
  368.          if effect[:active] and effect[:type] == 4 and effect[:sp] != nil
  369.            if effect[:variable] != nil
  370.              total+=effect[:sp]*$game_variables[effect[:variable]]/100
  371.            else
  372.              total+=effect[:sp]
  373.            end
  374.          end
  375.     end
  376.     n = n * total / 100  
  377.     return n.to_i
  378.   end
  379.  
  380.   #--------------------------------------------------------------------------
  381.   # ● Maxstr
  382.   #--------------------------------------------------------------------------
  383.   alias base_str_Challengue_Compensator base_str
  384.   def base_str
  385.     # Gets normal atribute
  386.     n = base_str_Challengue_Compensator
  387.     # Sets total to a base 100%
  388.     total = 100
  389.     # Search in all effects
  390.     for effect in $game_system.difficulty_effects
  391.          # Effect type 1
  392.          if effect[:active] and effect[:type] == 1  and effect[:str] != nil and  effect[:enemies_ids].include?(@enemy_id)
  393.            if effect[:variable] != nil
  394.              total+=effect[:str]*$game_variables[effect[:variable]]/100
  395.            else
  396.              total+=effect[:str]
  397.            end
  398.          end
  399.          # Effect type 2
  400.          if effect[:active] and effect[:type] == 2  and effect[:str] != nil and  effect[:maps_ids].include?($game_map.map_id)
  401.            if effect[:variable] != nil
  402.              total+=effect[:str]*$game_variables[effect[:variable]]/100
  403.            else
  404.              total+=effect[:str]
  405.            end
  406.          end
  407.          # Effect type 3
  408.          if effect[:active] and effect[:type] == 3  and effect[:str] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  409.            if effect[:variable] != nil            
  410.              total+=effect[:str]*$game_variables[effect[:variable]].to_f/100
  411.            else
  412.              total+=effect[:str]
  413.            end
  414.          end
  415.          # Effect type 4
  416.          if effect[:active] and effect[:type] == 4 and effect[:str] != nil
  417.            if effect[:variable] != nil
  418.              total+=effect[:str]*$game_variables[effect[:variable]]/100
  419.            else
  420.              total+=effect[:str]
  421.            end
  422.          end
  423.     end
  424.     n = n * total / 100  
  425.     return n.to_i
  426.   end
  427.  
  428.   #--------------------------------------------------------------------------
  429.   # ● Maxdex
  430.   #--------------------------------------------------------------------------
  431.   alias base_dex_Challengue_Compensator base_dex
  432.   def base_dex
  433.     # Gets normal atribute
  434.     n = base_dex_Challengue_Compensator
  435.     # Sets total to a base 100%
  436.     total = 100
  437.     # Search in all effects
  438.     for effect in $game_system.difficulty_effects
  439.          # Effect type 1
  440.          if effect[:active] and effect[:type] == 1  and effect[:dex] != nil and  effect[:enemies_ids].include?(@enemy_id)
  441.            if effect[:variable] != nil
  442.              total+=effect[:dex]*$game_variables[effect[:variable]]/100
  443.            else
  444.              total+=effect[:dex]
  445.            end
  446.          end
  447.          # Effect type 2
  448.          if effect[:active] and effect[:type] == 2  and effect[:dex] != nil and  effect[:maps_ids].include?($game_map.map_id)
  449.            if effect[:variable] != nil
  450.              total+=effect[:dex]*$game_variables[effect[:variable]]/100
  451.            else
  452.              total+=effect[:dex]
  453.            end
  454.          end
  455.          # Effect type 3
  456.          if effect[:active] and effect[:type] == 3  and effect[:dex] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  457.            if effect[:variable] != nil            
  458.              total+=effect[:dex]*$game_variables[effect[:variable]].to_f/100
  459.            else
  460.              total+=effect[:dex]
  461.            end
  462.          end
  463.          # Effect type 4
  464.          if effect[:active] and effect[:type] == 4 and effect[:dex] != nil
  465.            if effect[:variable] != nil
  466.              total+=effect[:dex]*$game_variables[effect[:variable]]/100
  467.            else
  468.              total+=effect[:dex]
  469.            end
  470.          end
  471.     end
  472.     n = n * total / 100  
  473.     return n.to_i
  474.   end
  475.  
  476.   #--------------------------------------------------------------------------
  477.   # ● Maxagi
  478.   #--------------------------------------------------------------------------
  479.   alias base_agi_Challengue_Compensator base_agi
  480.   def base_agi
  481.     # Gets normal atribute
  482.     n = base_agi_Challengue_Compensator
  483.     # Sets total to a base 100%
  484.     total = 100
  485.     # Search in all effects
  486.     for effect in $game_system.difficulty_effects
  487.          # Effect type 1
  488.          if effect[:active] and effect[:type] == 1  and effect[:agi] != nil and  effect[:enemies_ids].include?(@enemy_id)
  489.            if effect[:variable] != nil
  490.              total+=effect[:agi]*$game_variables[effect[:variable]]/100
  491.            else
  492.              total+=effect[:agi]
  493.            end
  494.          end
  495.          # Effect type 2
  496.          if effect[:active] and effect[:type] == 2  and effect[:agi] != nil and  effect[:maps_ids].include?($game_map.map_id)
  497.            if effect[:variable] != nil
  498.              total+=effect[:agi]*$game_variables[effect[:variable]]/100
  499.            else
  500.              total+=effect[:agi]
  501.            end
  502.          end
  503.          # Effect type 3
  504.          if effect[:active] and effect[:type] == 3  and effect[:agi] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  505.            if effect[:variable] != nil            
  506.              total+=effect[:agi]*$game_variables[effect[:variable]].to_f/100
  507.            else
  508.              total+=effect[:agi]
  509.            end
  510.          end
  511.          # Effect type 4
  512.          if effect[:active] and effect[:type] == 4 and effect[:agi] != nil
  513.            if effect[:variable] != nil
  514.              total+=effect[:agi]*$game_variables[effect[:variable]]/100
  515.            else
  516.              total+=effect[:agi]
  517.            end
  518.          end
  519.     end
  520.     n = n * total / 100  
  521.     return n.to_i
  522.   end
  523.  
  524.   #--------------------------------------------------------------------------
  525.   # ● Maxint
  526.   #--------------------------------------------------------------------------
  527.   alias base_int_Challengue_Compensator base_int
  528.   def base_int
  529.     # Gets normal atribute
  530.     n = base_int_Challengue_Compensator
  531.     # Sets total to a base 100%
  532.     total = 100
  533.     # Search in all effects
  534.     for effect in $game_system.difficulty_effects
  535.          # Effect type 1
  536.          if effect[:active] and effect[:type] == 1  and effect[:int] != nil and  effect[:enemies_ids].include?(@enemy_id)
  537.            if effect[:variable] != nil
  538.              total+=effect[:int]*$game_variables[effect[:variable]]/100
  539.            else
  540.              total+=effect[:int]
  541.            end
  542.          end
  543.          # Effect type 2
  544.          if effect[:active] and effect[:type] == 2  and effect[:int] != nil and  effect[:maps_ids].include?($game_map.map_id)
  545.            if effect[:variable] != nil
  546.              total+=effect[:int]*$game_variables[effect[:variable]]/100
  547.            else
  548.              total+=effect[:int]
  549.            end
  550.          end
  551.          # Effect type 3
  552.          if effect[:active] and effect[:type] == 3  and effect[:int] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  553.            if effect[:variable] != nil            
  554.              total+=effect[:int]*$game_variables[effect[:variable]].to_f/100
  555.            else
  556.              total+=effect[:int]
  557.            end
  558.          end
  559.          # Effect type 4
  560.          if effect[:active] and effect[:type] == 4 and effect[:int] != nil
  561.            if effect[:variable] != nil
  562.              total+=effect[:int]*$game_variables[effect[:variable]]/100
  563.            else
  564.              total+=effect[:int]
  565.            end
  566.          end
  567.     end
  568.     n = n * total / 100  
  569.     return n.to_i
  570.   end
  571.  
  572.   #--------------------------------------------------------------------------
  573.   # ● Maxatk
  574.   #--------------------------------------------------------------------------
  575.   alias base_atk_Challengue_Compensator base_atk
  576.   def base_atk
  577.     # Gets normal atribute
  578.     n = base_atk_Challengue_Compensator
  579.     # Sets total to a base 100%
  580.     total = 100
  581.     # Search in all effects
  582.     for effect in $game_system.difficulty_effects
  583.          # Effect type 1
  584.          if effect[:active] and effect[:type] == 1  and effect[:atk] != nil and  effect[:enemies_ids].include?(@enemy_id)
  585.            if effect[:variable] != nil
  586.              total+=effect[:atk]*$game_variables[effect[:variable]]/100
  587.            else
  588.              total+=effect[:atk]
  589.            end
  590.          end
  591.          # Effect type 2
  592.          if effect[:active] and effect[:type] == 2  and effect[:atk] != nil and  effect[:maps_ids].include?($game_map.map_id)
  593.            if effect[:variable] != nil
  594.              total+=effect[:atk]*$game_variables[effect[:variable]]/100
  595.            else
  596.              total+=effect[:atk]
  597.            end
  598.          end
  599.          # Effect type 3
  600.          if effect[:active] and effect[:type] == 3  and effect[:atk] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  601.            if effect[:variable] != nil            
  602.              total+=effect[:atk]*$game_variables[effect[:variable]].to_f/100
  603.            else
  604.              total+=effect[:atk]
  605.            end
  606.          end
  607.          # Effect type 4
  608.          if effect[:active] and effect[:type] == 4 and effect[:atk] != nil
  609.            if effect[:variable] != nil
  610.              total+=effect[:atk]*$game_variables[effect[:variable]]/100
  611.            else
  612.              total+=effect[:atk]
  613.            end
  614.          end
  615.     end
  616.     n = n * total / 100  
  617.     return n.to_i
  618.   end
  619.  
  620.   #--------------------------------------------------------------------------
  621.   # ● Maxpdef
  622.   #--------------------------------------------------------------------------
  623.   alias base_pdef_Challengue_Compensator base_pdef
  624.   def base_pdef
  625.     # Gets normal atribute
  626.     n = base_pdef_Challengue_Compensator
  627.     # Sets total to a base 100%
  628.     total = 100
  629.     # Search in all effects
  630.     for effect in $game_system.difficulty_effects
  631.          # Effect type 1
  632.          if effect[:active] and effect[:type] == 1  and effect[:pdef] != nil and  effect[:enemies_ids].include?(@enemy_id)
  633.            if effect[:variable] != nil
  634.              total+=effect[:pdef]*$game_variables[effect[:variable]]/100
  635.            else
  636.              total+=effect[:pdef]
  637.            end
  638.          end
  639.          # Effect type 2
  640.          if effect[:active] and effect[:type] == 2  and effect[:pdef] != nil and  effect[:maps_ids].include?($game_map.map_id)
  641.            if effect[:variable] != nil
  642.              total+=effect[:pdef]*$game_variables[effect[:variable]]/100
  643.            else
  644.              total+=effect[:pdef]
  645.            end
  646.          end
  647.          # Effect type 3
  648.          if effect[:active] and effect[:type] == 3  and effect[:pdef] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  649.            if effect[:variable] != nil            
  650.              total+=effect[:pdef]*$game_variables[effect[:variable]].to_f/100
  651.            else
  652.              total+=effect[:pdef]
  653.            end
  654.          end
  655.          # Effect type 4
  656.          if effect[:active] and effect[:type] == 4 and effect[:pdef] != nil
  657.            if effect[:variable] != nil
  658.              total+=effect[:pdef]*$game_variables[effect[:variable]]/100
  659.            else
  660.              total+=effect[:pdef]
  661.            end
  662.          end
  663.     end
  664.     n = n * total / 100  
  665.     return n.to_i
  666.   end
  667.  
  668.   #--------------------------------------------------------------------------
  669.   # ● Maxmdef
  670.   #--------------------------------------------------------------------------
  671.   alias base_mdef_Challengue_Compensator base_mdef
  672.   def base_mdef
  673.     # Gets normal atribute
  674.     n = base_mdef_Challengue_Compensator
  675.     # Sets total to a base 100%
  676.     total = 100
  677.     # Search in all effects
  678.     for effect in $game_system.difficulty_effects
  679.          # Effect type 1
  680.          if effect[:active] and effect[:type] == 1  and effect[:mdef] != nil and  effect[:enemies_ids].include?(@enemy_id)
  681.            if effect[:variable] != nil
  682.              total+=effect[:mdef]*$game_variables[effect[:variable]]/100
  683.            else
  684.              total+=effect[:mdef]
  685.            end
  686.          end
  687.          # Effect type 2
  688.          if effect[:active] and effect[:type] == 2  and effect[:mdef] != nil and  effect[:maps_ids].include?($game_map.map_id)
  689.            if effect[:variable] != nil
  690.              total+=effect[:mdef]*$game_variables[effect[:variable]]/100
  691.            else
  692.              total+=effect[:mdef]
  693.            end
  694.          end
  695.          # Effect type 3
  696.          if effect[:active] and effect[:type] == 3  and effect[:mdef] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  697.            if effect[:variable] != nil            
  698.              total+=effect[:mdef]*$game_variables[effect[:variable]].to_f/100
  699.            else
  700.              total+=effect[:mdef]
  701.            end
  702.          end
  703.          # Effect type 4
  704.          if effect[:active] and effect[:type] == 4 and effect[:mdef] != nil
  705.            if effect[:variable] != nil
  706.              total+=effect[:mdef]*$game_variables[effect[:variable]]/100
  707.            else
  708.              total+=effect[:mdef]
  709.            end
  710.          end
  711.     end
  712.     n = n * total / 100  
  713.     return n.to_i
  714.   end
  715.  
  716.   #--------------------------------------------------------------------------
  717.   # ● Maxeva
  718.   #--------------------------------------------------------------------------
  719.   alias base_eva_Challengue_Compensator base_eva
  720.   def base_eva
  721.     # Gets normal atribute
  722.     n = base_eva_Challengue_Compensator
  723.     # Sets total to a base 100%
  724.     total = 100
  725.     # Search in all effects
  726.     for effect in $game_system.difficulty_effects
  727.          # Effect type 1
  728.          if effect[:active] and effect[:type] == 1  and effect[:eva] != nil and  effect[:enemies_ids].include?(@enemy_id)
  729.            if effect[:variable] != nil
  730.              total+=effect[:eva]*$game_variables[effect[:variable]]/100
  731.            else
  732.              total+=effect[:eva]
  733.            end
  734.          end
  735.          # Effect type 2
  736.          if effect[:active] and effect[:type] == 2  and effect[:eva] != nil and  effect[:maps_ids].include?($game_map.map_id)
  737.            if effect[:variable] != nil
  738.              total+=effect[:eva]*$game_variables[effect[:variable]]/100
  739.            else
  740.              total+=effect[:eva]
  741.            end
  742.          end
  743.          # Effect type 3
  744.          if effect[:active] and effect[:type] == 3  and effect[:eva] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  745.            if effect[:variable] != nil            
  746.              total+=effect[:eva]*$game_variables[effect[:variable]].to_f/100
  747.            else
  748.              total+=effect[:eva]
  749.            end
  750.          end
  751.          # Effect type 4
  752.          if effect[:active] and effect[:type] == 4 and effect[:eva] != nil
  753.            if effect[:variable] != nil
  754.              total+=effect[:eva]*$game_variables[effect[:variable]]/100
  755.            else
  756.              total+=effect[:eva]
  757.            end
  758.          end
  759.     end
  760.     n = n * total / 100  
  761.     return n.to_i
  762.   end
  763.  
  764.   #--------------------------------------------------------------------------
  765.   # ● Maxexp
  766.   #--------------------------------------------------------------------------
  767.   alias exp_Challengue_Compensator exp
  768.   def exp
  769.     # Gets normal atribute
  770.     n = exp_Challengue_Compensator
  771.     # Sets total to a base 100%
  772.     total = 100
  773.     # Search in all effects
  774.     for effect in $game_system.difficulty_effects
  775.          # Effect type 1
  776.          if effect[:active] and effect[:type] == 1  and effect[:exp] != nil and  effect[:enemies_ids].include?(@enemy_id)
  777.            if effect[:variable] != nil
  778.              total+=effect[:exp]*$game_variables[effect[:variable]]/100
  779.            else
  780.              total+=effect[:exp]
  781.            end
  782.          end
  783.          # Effect type 2
  784.          if effect[:active] and effect[:type] == 2  and effect[:exp] != nil and  effect[:maps_ids].include?($game_map.map_id)
  785.            if effect[:variable] != nil
  786.              total+=effect[:exp]*$game_variables[effect[:variable]]/100
  787.            else
  788.              total+=effect[:exp]
  789.            end
  790.          end
  791.          # Effect type 3
  792.          if effect[:active] and effect[:type] == 3  and effect[:exp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  793.            if effect[:variable] != nil            
  794.              total+=effect[:exp]*$game_variables[effect[:variable]].to_f/100
  795.            else
  796.              total+=effect[:exp]
  797.            end
  798.          end
  799.          # Effect type 4
  800.          if effect[:active] and effect[:type] == 4 and effect[:exp] != nil
  801.            if effect[:variable] != nil
  802.              total+=effect[:exp]*$game_variables[effect[:variable]]/100
  803.            else
  804.              total+=effect[:exp]
  805.            end
  806.          end
  807.     end
  808.     n = n * total / 100  
  809.     return n.to_i
  810.   end
  811.  
  812.   #--------------------------------------------------------------------------
  813.   # ● Maxgold
  814.   #--------------------------------------------------------------------------
  815.   alias gold_Challengue_Compensator gold
  816.   def gold
  817.     # Gets normal atribute
  818.     n = gold_Challengue_Compensator
  819.     # Sets total to a base 100%
  820.     total = 100
  821.     # Search in all effects
  822.     for effect in $game_system.difficulty_effects
  823.          # Effect type 1
  824.          if effect[:active] and effect[:type] == 1  and effect[:gold] != nil and  effect[:enemies_ids].include?(@enemy_id)
  825.            if effect[:variable] != nil
  826.              total+=effect[:gold]*$game_variables[effect[:variable]]/100
  827.            else
  828.              total+=effect[:gold]
  829.            end
  830.          end
  831.          # Effect type 2
  832.          if effect[:active] and effect[:type] == 2  and effect[:gold] != nil and  effect[:maps_ids].include?($game_map.map_id)
  833.            if effect[:variable] != nil
  834.              total+=effect[:gold]*$game_variables[effect[:variable]]/100
  835.            else
  836.              total+=effect[:gold]
  837.            end
  838.          end
  839.          # Effect type 3
  840.          if effect[:active] and effect[:type] == 3  and effect[:gold] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  841.            if effect[:variable] != nil            
  842.              total+=effect[:gold]*$game_variables[effect[:variable]].to_f/100
  843.            else
  844.              total+=effect[:gold]
  845.            end
  846.          end
  847.          # Effect type 4
  848.          if effect[:active] and effect[:type] == 4 and effect[:gold] != nil
  849.            if effect[:variable] != nil
  850.              total+=effect[:gold]*$game_variables[effect[:variable]]/100
  851.            else
  852.              total+=effect[:gold]
  853.            end
  854.          end
  855.     end
  856.     n = n * total / 100  
  857.     return n.to_i
  858.   end
  859.  
  860.   #--------------------------------------------------------------------------
  861.   # ● Maxdrop
  862.   #--------------------------------------------------------------------------
  863.   alias treasure_prob_Challengue_Compensator treasure_prob
  864.   def treasure_prob
  865.     # Gets normal atribute
  866.     n = treasure_prob_Challengue_Compensator
  867.     # Sets total to a base 100%
  868.     total = 100
  869.     # Search in all effects
  870.     for effect in $game_system.difficulty_effects
  871.          # Effect type 1
  872.          if effect[:active] and effect[:type] == 1  and effect[:drop] != nil and  effect[:enemies_ids].include?(@enemy_id)
  873.            if effect[:variable] != nil
  874.              total+=effect[:drop]*$game_variables[effect[:variable]]/100
  875.            else
  876.              total+=effect[:drop]
  877.            end
  878.          end
  879.          # Effect type 2
  880.          if effect[:active] and effect[:type] == 2  and effect[:drop] != nil and  effect[:maps_ids].include?($game_map.map_id)
  881.            if effect[:variable] != nil
  882.              total+=effect[:drop]*$game_variables[effect[:variable]]/100
  883.            else
  884.              total+=effect[:drop]
  885.            end
  886.          end
  887.          # Effect type 3
  888.          if effect[:active] and effect[:type] == 3  and effect[:drop] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  889.            if effect[:variable] != nil            
  890.              total+=effect[:drop]*$game_variables[effect[:variable]].to_f/100
  891.            else
  892.              total+=effect[:drop]
  893.            end
  894.          end
  895.          # Effect type 4
  896.          if effect[:active] and effect[:type] == 4 and effect[:drop] != nil
  897.            if effect[:variable] != nil
  898.              total+=effect[:drop]*$game_variables[effect[:variable]]/100
  899.            else
  900.              total+=effect[:drop]
  901.            end
  902.          end
  903.     end
  904.     n = n * total / 100  
  905.     return n.to_i
  906.   end
  907. end
  908.  
  909.  
Expand to see the code.
is this part of the AI thing me and you were talking about or no?
Plague180 wrote:
is this part of the AI thing me and you were talking about or no?


no, it just modifies the general challengue
i was gonna say i thought you were going way deeper then that
Can you make a demo?
ChanceEntertainment wrote:
Can you make a demo?


Why? Exist examples in the script and you only need to use two sript commands. Its very simpe system.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=73016