Enemigos Aleatorios

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Enemigos Aleatorios as PDF for free.

More details

  • Words: 472
  • Pages: 2
this script allows you to set up monster groups composed of random enemies. when using this script, a monster group with three numbers between 1 and 8 as the first three characters of its name will be randomized (see image for example). a monster group whose name doesn't follow this pattern will appear exactly as shown. all three numbers must be between 1 and 8. the numbers' meanings are as follows: first number: the minimum number of monsters that will appear in the random monster group. second number: the maximum number of monsters that will appear in the random monster group. third number: the number of monsters in the group that will actually be used in the randomization (there must be at least as many monsters as the maximum number of monsters in the monster group, but monsters with ids above this number will be used only for position reference). to use this script, replace game_troop#setup, game_enemy#initialize, game_enemy#screen_x, and game_enemy.screen_y with the ones provided. image here: http://www.phylomortis.com/resource/script/img/s-img038.jpg class game_troop # --------------------------def setup(troop_id) @enemies = [] error1 = "error: minimum size for random groups " error2 = "must not exceed maxmimum size." error3 = error1 + error2 error4 = "error: there must be at least as many " error5 = "monsters in the monster group as " error6 = "the maximum number of monsters that can " error7 = "appear in the random monster group." error8 = error4 + error5 + error6 + error7 error9 = "error: number of monsters to use in " error10 = "random generation is greater than " error11 = "the size of the monster group." error12 = error9 + error10 + error11 troop = $data_troops[troop_id] first = troop.name[0] second = troop.name[1] third = troop.name[2] if first >= 49 && first <= 56 if second >= 49 && second <= 56 if third >= 49 && third <= 56 min = first - 48 max = second - 48 used = third - 48 difference = second - first if min > max print(error3) exit end if max > troop.members.size print(error8) exit end if used > troop.members.size print(error12)

exit end if difference != 0 troop_size = rand(difference + 1) + min else troop_size = min end for i in 0..troop_size - 1 enemy_number = rand(used) @enemies.push(game_enemy.new(troop_id, enemy_number, i)) end return end end end for i in 0...troop.members.size enemy = $data_enemies[troop.members[i].enemy_id] if enemy != nil @enemies.push(game_enemy.new(troop_id, i)) end end end code class game_enemy < game_battler # --------------------------def initialize(troop_id, member_index, random_index = -1) super() @troop_id = troop_id @member_index = member_index @random_index = member_index troop = $data_troops[@troop_id] @enemy_id = troop.members[@member_index].enemy_id enemy = $data_enemies[@enemy_id] @battler_name = enemy.battler_name @battler_hue = enemy.battler_hue @hp = maxhp @sp = maxsp @hidden = troop.members[@member_index].hidden @immortal = troop.members[@member_index].immortal if random_index >= 0 @random_index = random_index end end # --------------------------def screen_x return $data_troops[@troop_id].members[@random_index].x end # --------------------------def screen_y return $data_troops[@troop_id].members[@random_index].y end

Related Documents

Enemigos Aleatorios
November 2019 12
Numeros Aleatorios
November 2019 21
Vectores Aleatorios
August 2019 14
Enemigos Destruidos
November 2019 8
Clase 8 Factores Aleatorios
November 2019 12