Advertisement
Guest User

Untitled

a guest
Nov 15th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #=======================================================================
  2. # ** Random Encounter Control
  3. # by Valentine
  4. # Credits: Jet , Valentine
  5. #-----------------------------------------------------------------------
  6. # Dieses Script regelt die Random Encounter
  7. # der Map und Regio-Einstellung.
  8. # Switch An: Keine zufälligen Gegner
  9. #=======================================================================
  10.  
  11. class Game_Player < Game_Character
  12.  
  13. def make_encounter_troop_id
  14. encounter_list = []
  15. weight_sum = 0
  16. $game_map.encounter_list.each do |encounter|
  17. next unless encounter_ok?(encounter)
  18. if $game_switches[27] == false # Switch ID Regio
  19. encounter_list.push(encounter)
  20. end
  21. weight_sum += encounter.weight
  22. end
  23. if weight_sum > 0
  24. value = rand(weight_sum)
  25. encounter_list.each do |encounter|
  26. value -= encounter.weight
  27. return encounter.troop_id if value < 0
  28. end
  29. end
  30. return 0
  31. end
  32. end
  33. #=======================================================================
  34. module AreaCondition
  35.  
  36. AREA_SWITCH = 27 # Switch ID Map
  37. end
  38.  
  39. class RPG::Map
  40.  
  41. alias val_encounter_list encounter_list unless $@
  42. def encounter_list(*args, &block)
  43. if $game_switches[AreaCondition::AREA_SWITCH]
  44. return []
  45. else
  46. val_encounter_list(*args, &block)
  47. end
  48. end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement