Anmelden

Archiv verlassen und diese Seite im Standarddesign anzeigen : [XP] \\Ruby\\ Problem mit Script



Skorp
30.10.2006, 14:55
Ich habe mir jetzt eine HP- Anzeige (bzw. ein AKS) ins Spiel eingebaut, nur hab ich jetzt imme rdie HP- Anzeige im Spiel (auch im Intro, etc.). Soll heißen, das Script wird das ganze Spiel über verwendet. Wie kann ich das jetzt machen, dass ich diese Anzeige auf Kommando einschalten kann?
Ich habs mit dem Befehl "class_" versucht (z.B. class_Scene_Anzeige), aber ich denke der ist falsch^^ (hab auch ein end am ende gesetzt, aber bei beidem zeigt er einen Syntax- Error an). Kann mir wer helfen?

Und dann würde ich gerne noch wissen, wie ich die Waffen aufnehmen kann, ohne ein "Weapon" in die Aufrüstung aufzunehmen, also z.B. das ein Switch eingeschaltet wird, und dann die Waffe zum Schießen bereit ist. (Wie lautet der Befehl in Ruby um abzufragen, ob de rund der Switch angeschaltet ist?

Hier mal der Code:

#============================================================================
# * Mr.Mo's ABS
#============================================================================
# Mr.Mo "Muhammet Sivri"
# Version 1
# 09.16.06
# Thanks to Near Fantastica's methods;
# - In Range?, Get Range, In Direction?, enemy_dead?, treasure
# - RANGE_WEAPONS, RANGE_SKILLS
# - Class Game_Range(highly modified for convinience)
# - Scene_Skill(main, update_shk)
# Most were modified by me to my style and to increase performance and
# cleaner code.
#
# Give Credit to Near Fantastica as well, those methods saved me time and helped.
#
#============================================================================
# Intoduction
#============================================================================
# I wasnt happy with the current version of Near's ABS, and he wasn't going to
# update it anymore. So instead I made an ABS.
# Detailed Tutorial on the ABS and HUD modification tutorials added.
#============================================================================
# Explanation
#============================================================================
#--Skill Casting :
# If the skill is not ranged and its suppose to attack one enemy, it will attack
# the closest enemy.
# If the skill scope is more then 1 enemy, it can be ranged. It will just attack
# the enemies in that range.
# The skill animations can be assigned in the Constants section
# The default skill animation suffix is _cast. If you want a skill to have the
# default animation(_casT) just don't do anything for it :)
#--Enemy AI :
# 0 = Dummy - Will not attack but can be attacked
# 1 = See Range - Will attack only if it can see an enemy
# 2 = Hear Range - WIll attack only if it can hear an enemy
# 3 = Hear or See Range - Will attack if it can see or hear enemy
# 4 = Ally Under Attack - Will attack if its ally is under attack and if it can
# see or hear the enemy
#
#--Enemy Explanation :
# Hate Points - The enemy will randomly give out hate points to all of it's enemies.
# Later, it's enemies will be ordered from most to least hate points.
#
# Hate Groups - The enemy will attack hate groups, meaning other enemies.
# The hate group enemies aren't considered allies.
# The player's hate id is 0.
# Do not use the event ID, use the Monster ID, you can find it
# in the Database, Enemies Tab.
#
# Closest Enemy - The enemy will attack the closest enemy, if met the right AI
# conditions. Hate points are no longer needed, if this BOOLEAN
# is true.
#
#
#--Comment List :
# To add a comment, click on the event command list, in the first tab, you should
# see the [ Comment... ] button. It should look similar to this.
#
# V = value
#
# Comment: ABS - Required for recognizing enemies.
# Comment: ID V - Enemy ID from the database.
# Comment: Behavior V - Refer to Enemy AI.
# Comment: Sight V - See range the enemy can hear.
# Comment: Sound V - Sound range the enemy can hear.
# Comment: ClosestEnemy V - Refer to Enemy explantion
# Comment: HateGroup [V] - Refer to Enemy explantion
# Comment: Aggressiveness V - How fast will the enemy attack.
# Comment: Speed V - How fast will the enemy move when in battle
# Comment: Frequency V - What rate will the enemy move when in battle
# Comment: Trigger V - Refer to Triggers.
#
# Example:
#
# Comment: ABS
# Comment: ID 1
# Comment: Behavior 1
# Comment: Sight 5
# Comment: Sound 5
# Comment: ClosestEnemy true
# Comment: HateGroup [0]
# Comment: Aggressiveness 1
# Comment: Speed 4
# Comment: Frequency 4
# Comment: Trigger 0
#
#--Triggers :
# Trigger 0 - Will erase the event.
# Trigger 1 2 - Will turn on a switch with the ID of 2.
# Trigger 2 5 9 - Will change the Varaible's value with the ID of 5 to 9. If 9 is
# set to 0, the the Variable 5 will be added 1.
# Trigger 3 1 - Will change the local switch of the enemy to 1("A").
# 1 = A
# 2 = B
# 3 = C
# 4 = D
#
#--Startegy Usage :
# The ABS can be used to setup wars and make fights between NPCs. Imagination is
# the limit.
# The events do not need to attack the player. Just remove the 0 from the hate
# group list.
#
# You can make an event a dummy, it can still be attacked, but it won't retaliate.
# This is usefull for practices, or teacing the player how to fight. It can also
# be used for NPC's.
#
# Make allias for the player. Remove the 0 from the hate group list and add all
# the monsters(their enemy IDs, database) on the map. The allias won't follow the player or anything
# but they would attack other monsters giving the effect of allince.
#
# Monster Pit Fights can also be made.
#
#--Default Animations
# charactername_melee - melee attacks
# charactername_cast - skills
#============================================================================
#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
SDK.log("Mr.Mo's ABS", "Mr.Mo", 1, "09.16.06")
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.state("Mr.Mo's ABS") == true
#--------------------------------------------------------------------------
# * Constants - MAKE YOUR EDITS HERE
#--------------------------------------------------------------------------
CAN_DASH = true #Can the player Dash?
CAN_SNEAK = true #Can the player sneak?
#--------------------------------------------------------------------------
ATTACK_KEY = Input::Letters["S"]
#--------------------------------------------------------------------------
# Do not change the '=> 0', part.
# To Add more just make a new line; there are 10 examples :P
# Besides Numberkeys, you can use;
# Input::Letters["LETTER"] Make sure the letter is in CAPS.
# Input::Numberpad[number]
# Input::Fkeys[number]
# For more keys look in to the Input Script
SKILL_KEYS = {Input::Numberkeys[0] => 0,
Input::Numberkeys[1] => 0,
Input::Numberkeys[2] => 0,
Input::Numberkeys[3] => 0,
Input::Numberkeys[4] => 0,
Input::Numberkeys[5] => 0,
Input::Numberkeys[6] => 0,
Input::Numberkeys[7] => 0,
Input::Numberkeys[8] => 0,
Input::Numberkeys[9] => 0,
Input::Letters["A"] => 0,
}
#--------------------------------------------------------------------------
SNEAK_KEY = Input::Letters["Z"]
DASH_KEY = Input::Letters["X"]
#--------------------------------------------------------------------------
# You do not need to add the animation suffixes if you don't want the player
# to animate when attacking.
#--------------------------------------------------------------------------
#Ranged Weapons
RANGE_WEAPONS = {}
# RANGE_WEAPONS[Weapon_ID] = [Character Set Name, Move Speed, Animation, Ammo, Range, Animation Suffix]
RANGE_WEAPONS[17] = ["Arrow", 5, 4, 35, 10, "_bow"]
RANGE_WEAPONS[18] = ["Arrow", 5, 4, 35, 10]
RANGE_WEAPONS[33] = ["Ammo", 6, 4, 34, 10]
#--------------------------------------------------------------------------
#Ranged Skills
RANGE_SKILLS = {}
# RANGE_SKILLS[Skill_ID] = [Range, Move Speed, Character Set Name]
RANGE_SKILLS[7] = [10, 5, "Magic Balls"]
#--------------------------------------------------------------------------
#Ranged Explosives
RANGE_EXPLODE = {}
# RANGE_EXPLODE[Skill_ID] = [Range, Move Speed, Character Set Name, Explosive Range]
RANGE_EXPLODE[8] = [10, 6, "183-Rock02", 5]
#--------------------------------------------------------------------------
#Skill Animations - Can also be used for Range_Explode
#I use _cast as an example, but it is not needed because by default every skill
#uses _cast. So if you are not using _cast for a skill add it here.
SKILL_ANIMATION = {}
# SKILL_ANIMATION[Skill_ID] = Animation Suffix
SKILL_ANIMATION[7] = "_cast"
SKILL_ANIMATION[8] = "_cast"
#--------------------------------------------------------------------------
#Melee Animations - Don't touch here if the player is not going to animate when
# attacking.
#I use _melee as an example, but it is not needed because by default every attack
#uses _melee. So if you are not using _melee for an attack add it here.
MELEE_ANIMATION = {}
# MELEE_ANIMATION[Weapon_ID] = Animation Suffix
MELEE_ANIMATION[1] = "_melee"
#--------------------------------------------------------------------------
#Game over once the player is dead?
GAME_OVER_DEAD = true
#--------------------------------------------------------------------------
#Mash Time
#Determines the cool down period between attacks of the player, 10 = 1 sec.
MASH_TIME = 30
#--------------------------------------------------------------------------
#Should it display damage?
DISPLAY_DAMAGE = true
#--------------------------------------------------------------------------
#Hotkey should say
HOTKEY_SAY = "Skill Assigned to Hot Key"
#--------------------------------------------------------------------------
#Terrain Tag
PASS_TAG = 1
#--------------------------------------------------------------------------
ANIMATE_PLAYER = false
ANIMATE_ENEMY = false
#--------------------------------------------------------------------------
DASH_SPEED = 5
SNEAK_SPEED = 3
#--------------------------------------------------------------------------
#Max frames the player can run or sneak
DASH_MAX = 100
SNEAK_MAX = 100
#--------------------------------------------------------------------------
#Should the states be gone after a while?
STATES_UPDATE = true
#If true
STATES = {}
#STATES[STATE_ID] = [DURATION in FRAMES, 0]
#if Duration is 0 the state will stay there until healed(item, skill).
#10 frames = 1 sec
#Do not touch the second 0, thats for me.
STATES[1] = [0, 0] #Until Healed
STATES[3] = [100, 0] #10 seconds
#--------------------------------------------------------------------------
# * Class Mo ABS - DO NOT EDIT BELOW, if you don't know what you are doing :)
#--------------------------------------------------------------------------
class MrMo_ABS
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :abs_active #The ABS Active Boolean
attr_accessor :enemies #Enemy List
attr_accessor :can_dash #Player Dash Boolean
attr_accessor :can_sneak #Player Sneak Boolean
attr_accessor :attack_key #Attack Key
attr_accessor :skill_keys #Skill Keys
attr_accessor :range
attr_accessor :damage_display
attr_accessor :dash_max
attr_accessor :dash_min
attr_accessor :sneak_max
attr_accessor :sneak_min
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(con=true)
#ABS Active Boolean
@abs_active = con
#ABS Enemy Variables
@enemies = {}
#Dash
@can_dash = CAN_DASH
#Sneak
@can_sneak = CAN_SNEAK
#States
@can_update_states = STATES_UPDATE
#Attack Key
@attack_key = ATTACK_KEY
#Skill Keys
@skill_keys = SKILL_KEYS
#Button Mash
@button_mash = 0
#Ranged Skills and Weapons
@range = []
#Display Demage true:false
@damage_display = DISPLAY_DAMAGE
#Game Over?
@game_over = GAME_OVER_DEAD
#Player Animated?
@player_ani = ANIMATE_PLAYER
#Enemy Animated?
@enemy_ani = ANIMATE_ENEMY
#Get Hate
@get_hate = true
# Dashing
@dashing = false
@dash_max = DASH_MAX
@dash_min = @dash_max
@dash_speed = DASH_SPEED
# Sneaking
@sneaking = false
@sneak_max = SNEAK_MAX
@sneak_min = @sneak_max
@sneak_speed = SNEAK_SPEED
#PvP - N+ Only
@pvp_active = true
end
#--------------------------------------------------------------------------
# * Range Weapons
#--------------------------------------------------------------------------
def RANGE_WEAPONS
return RANGE_WEAPONS
end
#--------------------------------------------------------------------------
# * Range Skills
#--------------------------------------------------------------------------
def RANGE_SKILLS
return RANGE_SKILLS
end
#--------------------------------------------------------------------------
# * Range Explode
#--------------------------------------------------------------------------
def RANGE_EXPLODE
return RANGE_EXPLODE
end
#--------------------------------------------------------------------------
# * Hotkey
#--------------------------------------------------------------------------
def HOTKEY_SAY
return HOTKEY_SAY
end
#--------------------------------------------------------------------------
# * Pass Tag
#--------------------------------------------------------------------------
def PASS_TAG
return PASS_TAG
end
#--------------------------------------------------------------------------
# * ABS Refresh(Event, List, Characterset Name
#--------------------------------------------------------------------------
def refresh(event, list, character_name)
@get_hate = true
#Delete the event from the list
@enemies.delete(event.id)
#Skip the event if its invisible or doesn't contain a list
return if character_name == "" or list == nil
#Get the parameters
parameters = SDK.event_comment_input(event, 10, "ABS")
#Skip if the paramete is NIL
return if parameters.nil?
#Get Enemy ID
id = parameters[0].split
#Get Enemy
enemy = $data_enemies[id[1].to_i]
#Skip If Enemy is NIL
return if enemy == nil
@enemies[event.id] = ABS_Enemy.new(enemy.id)
#Set Event ID
@enemies[event.id].event_id = event.id
#Get Event
@enemies[event.id].event = event
#Set Behavior
behavior = parameters[1].split
@enemies[event.id].behavior = behavior[1].to_i
#Set See Range
see_range = parameters[2].split
@enemies[event.id].see_range = see_range[1].to_i
#Set Hear Range
hear_range = parameters[3].split
@enemies[event.id].hear_range = hear_range[1].to_i
#Set Closest Enemy Boolean
closest_enemy = parameters[4].split
@enemies[event.id].closest_enemy = eval(closest_enemy[1])
#Set Hate Group
hate_group = parameters[5].split
@enemies[event.id].hate_group = eval(hate_group[1])
#Set Aggresiveness
aggressiveness = parameters[6].split
@enemies[event.id].aggressiveness = aggressiveness[1].to_i
#Set Speed
speed = parameters[7].split
@enemies[event.id].temp_speed = speed[1].to_i
#Set Frequency
freq = parameters[8].split
@enemies[event.id].temp_frequency = freq[1].to_i
#Set Trigger
trigger = parameters[9].split
@enemies[event.id].trigger= [trigger[1].to_i, trigger[2].to_i, trigger[3].to_i]
end
#--------------------------------------------------------------------------
# * Make Hate Points(Enemy)
#--------------------------------------------------------------------------
def make_hate_points(e)
#Get all the enemies of the enemy
e.hate_points[$game_player.event_id] = rand(999)
for id in e.hate_group
#See if the ID in the Hate group is in the enemy ID
for enemy in @enemies.values
#Skip NIL values
next if enemy == nil
if enemy.enemy_id == id
#Insert in to the list if the enemy is in hate group
e.hate_points[enemy.event_id] = rand(999)
end
end
end
end
#--------------------------------------------------------------------------
# * Update(Frame)
#--------------------------------------------------------------------------
def update
return if !@abs_active
#Update Player
update_player
#Update Enemy AI
update_enemy if @enemies != {}
#Update Dash
update_dash if @can_dash
#Update Sneak
update_sneak if @can_sneak
#Update States
update_states if @can_update_states
#Update Ranged
for range in @range
next if range == nil
range.update
end
end
#--------------------------------------------------------------------------
# * Update States(Frame)
#--------------------------------------------------------------------------
def update_states
for id in $game_party.actors[0].states
next if !STATES.has_key?(id)
state = STATES[id]
next if state[0] == 0
state[1] += 1
$game_party.actors[0].remove_state(id) if state[1] >= state[0]
state[1] = 0 if state[1] >= state[0]
end
end
#--------------------------------------------------------------------------
# * Update Enemy AI(Frame)
#--------------------------------------------------------------------------
def update_enemy
#Get all the enemies on the list
for enemy in @enemies.values
#Skip NIL values
next if enemy == nil or enemy.dead?
#Skip if not on screen
next if !in_screen?(enemy.event)
#Make Hate Points
make_hate_points(enemy) if @get_hate
next if !enemy.in_battle and !update_enemy_ai(enemy)
update_enemy_battle(enemy) if enemy.in_battle and enemy.behavior != 0
end
@get_hate = false
end
#--------------------------------------------------------------------------
# * Update Enemy Battle(Enemy)
#--------------------------------------------------------------------------
def update_enemy_battle(enemy)
#If the enemy can't see it's enemy, skip the enemy
if (!in_range?(enemy.event, enemy.attacking.event, enemy.see_range) and
!in_range?(enemy.event, enemy.attacking.event, enemy.hear_range)) or
(enemy.attacking == nil or enemy.attacking.actor.dead? or !enemy.hate_group.include?(enemy.attacking.enemy_id))
#Restore movement
restore_movement(enemy)
#Take it out off battle
enemy.in_battle = false
enemy.attacking = nil
return
end
#Update the enemy attack or follow
update_enemy_attack(enemy,enemy.attacking) if Graphics.frame_count % (enemy.aggressiveness * 30) == 0
#Skip this if the attack killed the enemy
return if enemy == nil or enemy.attacking == nil or enemy.event.moving?
enemy.event.move_to(enemy.attacking.event) if !in_range?(enemy.event, enemy.attacking.event, 1)
enemy.event.turn_to(enemy.attacking.event) if !in_direction?(enemy.event, enemy.attacking.event) and in_range?(enemy.event, enemy.attacking.event, 1)
end
#--------------------------------------------------------------------------
# * Update Enemy AI(Enemy)
#--------------------------------------------------------------------------
def update_enemy_ai(enemy)
#Get the enemy behavior
b = enemy.behavior
return true if b == 0 # Dummy
#Next enemy if this enemy can't see the player
return true if b == 1 and !can_enemy_see(enemy)
#Next enemy if this enemy can't hear the player
return true if b == 2 and !can_enemy_hear(enemy)
#Next enemy if this enemy can't see or hear the player
return true if b == 3 and !can_enemy_see(enemy) and !can_enemy_hear(enemy)
#Next if its not
return true if b == 4 and !enemy_ally_in_battle?(enemy)
#Next enemy if this enemy can't see or hear the player
return true if b == 5 and !can_enemy_see(enemy) and !can_enemy_hear(enemy) and !enemy_ally_in_battle?(enemy)
#Return false
return false
end
#--------------------------------------------------------------------------
# * Update Enemy Attack(Enemy)
#--------------------------------------------------------------------------
def update_enemy_attack(e,actor)
#Return if the enemy can't attack
return if e.actions == nil or e.actions == [] or e == nil
#Get all actions
for action in e.actions
#Next if enemy can't attack
next if enemy_pre_attack(e, action)
#Get the current action kind
case action.kind
when 0 # Basic
#Get the action
case action.basic
when 0 #Attack
next if !in_range?(e.event, actor.event, 1) or !in_direction?(e.event, actor.event)
#Attack it's enemy
a = actor if actor.is_a?(ABS_Enemy)
a = $game_party.actors[0] if !actor.is_a?(ABS_Enemy)
a.attack_effect(e)
#Animate the player
animate(e.event, e.event.character_name+"_melee") if @enemy_ani
#Show Animation
hit_enemy(actor,e) if a.damage != "Miss" and a.damage != 0
#Check if enemy's enemy is dead
return if enemy_dead?(a,e)
#Make enemy
return if !a.is_a?(ABS_Enemy)
return if a.attacking == e and a.in_battle
#Set the new target for the enemy
a.attacking = e
#The enemy is now in battle
a.in_battle = true
#Setup movement
setup_movement(e)
return
when 1..3 #Nothing
return
end
when 1..2 #Skill
#Get the skill
skill = $data_skills[action.skill_id]
#Return if the skill is NIL
return if skill == nil
#Get the skill scope
case skill.scope
when 1 # One Enemy
return if Graphics.frame_count % (e.aggressiveness * 30) != 0
next if !in_direction?(e.event, actor.event)
next if !e.can_use_skill?(skill)
#Animate the enemy
animate(e.event, e.event.character_name+"_skill") if @enemy_ani
if RANGE_SKILLS.has_key?(skill.id)
@range.push(Game_Ranged_Skill.new(e.event, e, skill))
e.sp -= skill.sp_cost
return
end
#If the skill is not ranged
enemies = []
#Get all enemies
for enemy in @enemies.values
next if enemy == nil
next if !e.hate_group.include?(enemy.enemy_id)
enemies.push(enemy)
end
enemies.push($game_player) if e.hate_group.include?(0)
#Order them from closest to the farthest
enemies.sort! {|a,b|
get_range(e.event,a.event) - get_range(e.event,b.event)}
#Attack the closest one
enemies[0].actor.effect_skill(e, skill)
#Take off SP
e.sp -= skill.sp_cost
#Show Animetion on enemy
hit_enemy(enemies[0], e, skill.animation2_id) if enemies[0].actor.damage != "Miss" and enemies[0].actor.damage != 0
#Return if enemy is dead
return if enemy_dead?(enemies[0].actor,e)
return if enemies[0].is_a?(Game_Player)
return if enemies[0].attacking == e and enemies[0].in_battle
#If its alive, put it in battle
enemies[0].in_battle = true
#Make it attack the player
enemies[0].attacking = e
#Setup movement
setup_movement(e)
return
when 3..4, 7 # User
return if Graphics.frame_count % (e.aggressiveness * 100) != 0
next if e.hp > skill.power.abs
#Animate the player
animate(e.event, e.event.character_name+"_skill") if @enemy_ani
e.effect_skill(e, skill)
e.sp -= skill.sp_cost
e.event.animation_id = skill.animation2_id
return
end
return
end
end
end
#--------------------------------------------------------------------------
# * Update Player
#--------------------------------------------------------------------------
def update_player
#Keep the current party leader updated
@actor = $game_party.actors[0]
#Update click time
@button_mash -= 1 if @button_mash > 0
return if @button_mash > 0
#Check Ranged attack
if Input.trigger?(@attack_key)
@button_mash = MASH_TIME
return player_range if RANGE_WEAPONS.has_key?(@actor.weapon_id)
return player_melee
end
#Check for Skill attacks
for key in @skill_keys.keys
next if @skill_keys[key] == nil or @skill_keys[key] == 0
next if !Input.trigger?(key)
@button_mash = MASH_TIME
id = @skill_keys[key]
if RANGE_EXPLODE.has_key?(id)
return player_explode(id)
else
return player_skill(id)
end
end
return
end
#--------------------------------------------------------------------------
# * Player Ranged Attack
#--------------------------------------------------------------------------
def player_range
#Get the weapon
w = RANGE_WEAPONS[@actor.weapon_id]
#Return if the ammo isn't there
return if $game_party.item_number(w[3]) == 0
#Delete an ammo
$game_party.lose_item(w[3], 1)
#Make the attack
@range.push(Game_Ranged_Weapon.new($game_player, @actor, @actor.weapon_id))
#Animate
return if w[5] == nil
animate($game_player, $game_player.character_name+w[5].to_s) if @player_ani
return
end
#--------------------------------------------------------------------------
# * Player Melee Attack
#--------------------------------------------------------------------------
def player_melee
return if $data_weapons[@actor.weapon_id] == nil
#Get all enemies
for e in @enemies.values
#Skip NIL values or dead enemies
next if e == nil or e.dead?
#Skip the enemy if its not close by or not facing
next if !in_direction?($game_player, e.event) or !in_range?($game_player, e.event, 1)
#Attack the enemy
e.attack_effect(@actor)
#Get Animation
a = $data_weapons[@actor.weapon_id].animation2_id
#Hit enemy if the attack succeeds
hit_enemy(e, @actor, a) if e.damage != "Miss" and e.damage != 0
#Animate the player
if MELEE_ANIMATION[@actor.weapon_id] == nil
animate($game_player, $game_player.character_name+"_melee") if @player_ani
else
m = MELEE_ANIMATION[@actor.weapon_id]
animate($game_player, $game_player.character_name+m.to_s) if @player_ani
end
#Return if the enemy is dead
return if enemy_dead?(e,@actor)
return if !e.hate_group.include?(0)
#Set the new target for the enemy
e.attacking = $game_player
#The enemy is now in battle
e.in_battle = true
#Setup movement
setup_movement(e)
end
end
#--------------------------------------------------------------------------
# * Player Skill Attack
#--------------------------------------------------------------------------
def player_skill(id)
@actor = $game_party.actors[0]
#Get Skill
skill = $data_skills[id]
#Return if the skill doesn't exist
return if skill == nil
#Return if the actor doesn't have the skill
return if !@actor.skills.include?(skill.id)
#Return if the actor can't use the skill
return if !@actor.can_use_skill?(skill)
#Animate
if SKILL_ANIMATION.has_key?(id)
l = SKILL_ANIMATION[id]
animate($game_player, $game_player.character_name+l.to_s) if @player_ani
else
animate($game_player, $game_player.character_name+"_cast") if @player_ani
end
#Get the skill scope
case skill.scope
when 1 #Enemy
#If the skill is ranged
if RANGE_SKILLS.has_key?(skill.id)
#Add to range
@range.push(Game_Ranged_Skill.new($game_player, @actor, skill))
#Take off SP
@actor.sp -= skill.sp_cost
return
end
#If the skill is not ranged
enemies = []
#Get all enemies
for enemy in @enemies.values
next if enemy == nil
enemies.push(enemy)
end
e = $game_player
#Order them from closest to the farthest
enemies.sort! {|a,b|
get_range(e.event,a.event) - get_range(e.event,b.event) }
#Attack the closest one
enemies[0].effect_skill(@actor, skill)
#Take off SP
@actor.sp -= skill.sp_cost
#Show Animetion on enemy
hit_enemy(enemies[0], @actor, skill.animation2_id) if enemies[0].damage != "Miss" and enemies[0].damage != 0
#Return if enemy is dead
return if enemy_dead?(enemies[0],@actor)
return if !enemy.hate_group.include?(0)
#If its alive, put it in battle
enemies[0].in_battle = true
#Make it attack the player
enemies[0].attacking = $game_player
#Setup movement
setup_movement(enemies[0])
return
when 2 #All Emenies
#Play the animation on player
$game_player.animation_id = skill.animation2_id
#Take off SP
@actor.sp -= skill.sp_cost
#If the skill is ranged
if RANGE_SKILLS.has_key?(skill.id)
enemies = get_all_range(@actor.event, RANGE_SKILLS[skill.id][0])
else
enemies = @enemies
end
#Get all enemies
for e in enemies.values
#Skip NIL values
next if e== nil
#Attack enemy
e.effect_skill(@actor, skill)
#Show Animetion on enemy
hit_enemy(e, @actor, 0) if e.damage != "Miss" and e.damage != 0
#Skip this enemy if its dead
next if enemy_dead?(e,@actor)
next if !e.hate_group.include?(0)
#If its alive, put it in battle
e.in_battle = true
#Make it attack the player
e.attacking = $game_player
#Setup movement
setup_movement(e)
end
return
when 3..4, 7 #User
#Use the skill on the player
@actor.effect_skill(@actor, skill)
#Take off SP
@actor.sp -= skill.sp_cost
#Play animation
$game_player.animation_id = skill.animation2_id
return
end
end
#--------------------------------------------------------------------------
# * Player Explode Attack
#--------------------------------------------------------------------------
def player_explode(id)
#Get Skill
skill = $data_skills[id]
#Return if the skill doesn't exist
return if skill == nil
#Return if the actor doesn't have the skill
return if !@actor.skills.include?(skill.id)
#Return if the actor can't use the skill
return if !@actor.can_use_skill?(skill)
#Animate
if SKILL_ANIMATION.has_key?(id)
l = SKILL_ANIMATION[id]
animate($game_player, $game_player.character_name+l.to_s) if @player_ani
else
animate($game_player, $game_player.character_name+"_cast") if @player_ani
end
#Add to range
@range.push(Game_Ranged_Explode.new($game_player, @actor, skill))
#Take off SP
@actor.sp -= skill.sp_cost
return
end
#--------------------------------------------------------------------------
# * Enemy Dead?(Enemy) or (Player)
#--------------------------------------------------------------------------
def enemy_dead?(e,a)
#Return a new method if e is an actor
return player_dead?(e,a) if e.is_a?(Game_Actor)
#Return false if enemy dead
return false if !e.dead?
enemy = e
treasure(enemy) if a.is_a?(Game_Actor)
a.attacking = nil if !a.is_a?(Game_Actor)
a.in_battle = false if !a.is_a?(Game_Actor)
id = enemy.event_id
#Remove from list
@enemies.delete(id)
event = enemy.event
event.character_name = ""
case enemy.trigger[0]
when 0
event.erase
when 1
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
$game_switches[enemy.trigger[1]] = true
$game_map.need_refresh = true
when 2
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
if enemy.trigger[2] == 0
$game_variables[enemy.trigger[1]] += 1
$game_map.need_refresh = true
else
$game_variables[enemy.trigger[1]] = enemy.trigger[2]
$game_map.need_refresh = true
end
when 3
value = "A" if enemy.trigger[1] == 1
value = "B" if enemy.trigger[1] == 2
value = "C" if enemy.trigger[1] == 3
value = "D" if enemy.trigger[1] == 4
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if value == 0
key = [$game_map.map_id, event.id, value]
$game_self_switches[key] = true
$game_map.need_refresh = true
end
#Return true if the e is dead
return true
end
#--------------------------------------------------------------------------
# * Player Dead(Player,Enemy)
#--------------------------------------------------------------------------
def player_dead?(a,e)
#return if the player is not dead
return false if !a.dead?
#If the player is dead;
e.in_battle = false if e != nil and !e.is_a?(Game_Actor)
e.attacking = nil if e != nil and !e.is_a?(Game_Actor)
#Game Over?
$game_temp.gameover = true if @game_over
return true
end
#--------------------------------------------------------------------------
# * Treasure(Enemy)
#--------------------------------------------------------------------------
def treasure(enemy)
exp = 0
gold = 0
treasures = []
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
treasures = treasures[0..5]
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
actor.hp = actor.maxhp
actor.sp = actor.maxsp
end
end
end
$game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
end
#--------------------------------------------------------------------------
# * Hit Enemy(Enemy) or (Player)
#--------------------------------------------------------------------------
def hit_enemy(e,a,animation=nil)
e.event.jump(0, 0)
return if animation == 0
if animation == nil
e.event.animation_id = a.animation2_id
else
e.event.animation_id = animation
end
end
#--------------------------------------------------------------------------
# * Enemy Pre-Attack(Enemy,Actions) - Checks action conditions to see if the
# enemy can attack.
#--------------------------------------------------------------------------
def enemy_pre_attack(enemy, actions)
return true if enemy.hp * 100.0 / enemy.maxhp > actions.condition_hp
return true if $game_party.max_level < actions.condition_level
switch_id = actions.condition_switch_id
return true if actions.condition_switch_id > 0 and $game_switches[switch_id] == false
n = rand(11)
return true if actions.rating < n
return false
end
#--------------------------------------------------------------------------
# * Can Enemy See(Enemy)
#--------------------------------------------------------------------------
def can_enemy_see(e)
#Get all enemies of the enemy
enemies = []
enemies.push($game_player) if e.hate_group.include?(0) and in_range?(e.event, $game_player, e.see_range) or in_direction?(e.event, $game_player)
if e.hate_group.size > 1 or (e.hate_group.size == 1 and !e.hate_group.include?(0))
#Get the hate enemies
for enemy in @enemies.values
next if enemy == nil or enemy == e or !e.hate_group.include?(enemy.enemy_id) or
!in_range?(e.event, enemy.event, e.see_range) or !in_direction?(e.event, enemy.event)
#Insert in to the list if the enemy is in hate group
enemies.push(enemy)
end
end
#Return false if the list is nil or empty
return false if enemies == nil or enemies == []
#Order the enemies
if !e.closest_enemy
#Order from hate points
enemies.sort! {|a,b|
e.hate_points[b.event_id] - e.hate_points[a.event_id] }
else
enemies.sort! {|a,b|
get_range(e.event,a.event) - get_range(e.event,b.event) }
end
#Add to enemy attack list
e.attacking = enemies[0]
#Enemy is now in battle
e.in_battle = true
#Setup the movement
setup_movement(e)
#Return true
return true
end
#--------------------------------------------------------------------------
# * Setup the Movement Type to 0(Enemy)
#--------------------------------------------------------------------------
def setup_movement(e)
#Set Speed
e.event.move_speed = e.temp_speed
#Set Frequency
e.event.move_frequency = e.temp_frequency
#Set Move Type
e.temp_move_type = e.event.move_type
e.event.move_type = 0
end
#--------------------------------------------------------------------------
# * Restore the Movement Type(Enemy)
#--------------------------------------------------------------------------
def restore_movement(e)
#Restore Speed
e.temp_speed = e.event.move_speed
#Restore Frequency
e.temp_frequency = e.event.move_frequency
#Restore Move Type
e.event.move_type = e.temp_move_type
e.temp_move_type = 0
end
#--------------------------------------------------------------------------
# * Can Enemy Hear(Enemy)
#--------------------------------------------------------------------------
def can_enemy_hear(e)
enemies = []
#Get player
d = 0
d = DASH_SPEED if @dashing
enemies.push($game_player) if e.hate_group.include?(0) and !@sneaking and
in_range?(e.event, $game_player, e.hear_range+d)
if e.hate_group.size > 1 or (e.hate_group.size == 1 and !e.hate_group.include?(0))
#Get the hate enemies
for enemy in @enemies.values
next if enemy == nil or enemy == e or !e.hate_group.include?(enemy.enemy_id) or
!in_range?(e.event, enemy.event, e.hear_range+d)
#Insert in to the list if the enemy is in hate group
enemies.push(enemy)
end
end
#Return False
return false if enemies == nil or enemies == []
#Order the enemies
if !e.closest_enemy
#Order from hate points
enemies.sort! {|a,b|
e.hate_points[b.event_id] - e.hate_points[a.event_id] }
else
enemies.sort! {|a,b|
get_range(e.event,a.event) - get_range(e.event,b.event) }
end
#Add to enemy attack list
e.attacking = enemies[0]
#Enemy is now in battle
e.in_battle = true
#Setup the movement
setup_movement(e)
#Return true
return true
end
#--------------------------------------------------------------------------
# * Enemy Ally in_battle?(Enemy)
#--------------------------------------------------------------------------
def enemy_ally_in_battle?(enemy)
#Start list
allies = []
#Get all allies
for ally in @enemies.values
#Skip NIL Value or value is in hate group
next if ally == nil or enemy.hate_group.include?(ally.enemy_id)
#Skip if the ally is not in_battle or the enemy can't see ally
next if !ally.in_battle or !in_range?(enemy.event, ally.event, enemy.see_range)
#Skip if the enemy can't hear ally
next if !in_range?(enemy.event, ally.event, enemy.hear_range)
#Skip if is player and can't be player
next if ally.attacking == $game_player and !enemy.hate_group.include?(0)
#Add to enemy attack list
enemy.attacking = ally.attacking
#Enemy is now in battle
enemy.in_battle = true
#Setup the movement
setup_movement(enemy)
#Return True
return true
end
#Return False
return false
end
#--------------------------------------------------------------------------
# * Update Dash
#--------------------------------------------------------------------------
def update_dash
if Input.pressed?(DASH_KEY)
if $game_player.moving?
@dashing = true
$game_player.move_speed = DASH_SPEED
@dash_min -= 1
if @dash_min <= 0
@dashing = false
$game_player.move_speed = 4
end
end
else
@dashing = false
$game_player.move_speed = 4 if !@sneaking
@dash_min += 1 if @dash_min < @dash_max
end
end
#--------------------------------------------------------------------------
# * Update Sneak
#--------------------------------------------------------------------------
def update_sneak
if Input.pressed?(SNEAK_KEY)
if $game_player.moving?
@sneaking = true
$game_player.move_speed = SNEAK_SPEED
@sneak_min -= 1
if @sneak_min <= 0
@sneaking = false
$game_player.move_speed = 4
end
end
else
@sneaking = false
$game_player.move_speed = 4 if !@dashing
@sneak_min += 1 if @sneak_min < @sneak_max
end
end
#--------------------------------------------------------------------------
# * Get Range(Element, Object) - Near Fantastica
#--------------------------------------------------------------------------
def get_range(element, object)
x = (element.x - object.x) * (element.x - object.x)
y = (element.y - object.y) * (element.y - object.y)
r = x + y
#r = Math.sqrt(r)
return r.to_i
end
#--------------------------------------------------------------------------
# * Checks the object range
#--------------------------------------------------------------------------
def in_screen?(object)
screne_x = $game_map.display_x
screne_x -= 256
screne_y = $game_map.display_y
screne_y -= 256
screne_width = $game_map.display_x
screne_width += 2816
screne_height = $game_map.display_y
screne_height += 2176
return false if object.real_x <= screne_x
return false if object.real_x >= screne_width
return false if object.real_y <= screne_y
return false if object.real_y >= screne_height
return true
end
#--------------------------------------------------------------------------
# * In Range?(Element, Object, Range) - Near Fantastica
#--------------------------------------------------------------------------
def in_range?(element, object, range)
x = (element.x - object.x) * (element.x - object.x)
y = (element.y - object.y) * (element.y - object.y)
r = x + y
return true if r <= (range * range)
return false
end
#--------------------------------------------------------------------------
# * Get ALL Range(Element, Range)
#--------------------------------------------------------------------------
def get_all_range(element, range)
objects = []
for e in @enemies.values
objects.push(e) if in_range?(element, e.event, range)
end
return objects
end
#--------------------------------------------------------------------------
# * In Direction?(Element, Object) - Near Fantastica
#--------------------------------------------------------------------------
def in_direction?(element, object)
return true if element.direction == 2 and object.y >= element.y and object.x == element.x
return true if element.direction == 4 and object.x <= element.x and object.y == element.y
return true if element.direction == 6 and object.x >= element.x and object.y == element.y
return true if element.direction == 8 and object.y <= element.y and object.x == element.x
return false
end
#--------------------------------------------------------------------------
# * Animate(object, name)
#--------------------------------------------------------------------------
def animate(object, name)
object.set_animate(name)
end
#--------------------------------------------------------------------------
# * End of class
#--------------------------------------------------------------------------
end
#============================================================================
# * Range Base
#============================================================================
class Range_Base < Game_Character
attr_accessor :range
attr_accessor :draw
attr_accessor :stop
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parent, actor, attack)
@step = 0
@parent = parent
@actor = actor
@draw = true
@stop = false
@range = 0
@explosive = false
@showing_ani = false
super()
@move_direction = @parent.direction
@direction = @move_direction
moveto(@parent.x, @parent.y)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@character_name = @range_wepaon[0]
@move_speed = @range_wepaon[1]
@range = @range_wepaon[4]
end
#--------------------------------------------------------------------------
# * Force Movement
#--------------------------------------------------------------------------
def force_movement
m = @move_direction
@y += 1 if m == 2
@x -= 1 if m == 4
@x += 1 if m == 6
@y -= 1 if m == 8
end
#--------------------------------------------------------------------------
# * Update
#-------------------------------------------------------------------------
def update
super
return if @explosive
#Return if moving
return if moving?
#Check if something is still here
if @parent == nil or @actor == nil
@stop = true
end
# Get new coordinates
d = @move_direction
new_x = @x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = @y + (d == 2 ? 1 : d == 8 ? -1 : 0)
return force_movement if $game_map.terrain_tag(new_x, new_y) == $ABS.PASS_TAG and no_one?
m = @move_direction
move_down if m == 2
move_left if m == 4
move_right if m == 6
move_up if m == 8
#Stop if it came to range
return @stop = true if @step >= @range
#Increase step
@step += 1
end
#--------------------------------------------------------------------------
# * No One
#-------------------------------------------------------------------------
def no_one?
#Get All Events
objects = {}
for event in $game_map.events.values
next if event == nil
objects[event.id] = event
end
objects[0] = $game_player
# Get new coordinates
d = @move_direction
new_x = @x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = @y + (d == 2 ? 1 : d == 8 ? -1 : 0)
#Get all pos
for o in objects.values
next if o == nil
return false if o.x == new_x and o.y == new_y
end
#Return False if no one was found
return true
end
end
#============================================================================
# * Game Ranged Explode
#============================================================================
class Game_Ranged_Explode < Range_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parent, actor, skill)
super(parent,actor,skill)
@range_skill = $ABS.RANGE_EXPLODE[skill.id]
@range = @range_skill[0]
@opacity = 10 if @range == 1
@move_speed = @range_skill[1]
@character_name = @range_skill[2]
@skill = skill
@explosive = true
end
#--------------------------------------------------------------------------
# * Check Event Trigger Touch(x,y)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
#Return if moving
return if moving?
#Check if something is still here
if @parent == nil or @actor == nil
@stop = true
end
# Get new coordinates
d = @move_direction
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
return force_movement if $game_map.terrain_tag(new_x, new_y) == $ABS.PASS_TAG and no_one?
#Stop if can't move
return blow if !passable?(@x, @y, @move_direction)
m = @move_direction
move_down if m == 2
move_left if m == 4
move_right if m == 6
move_up if m == 8
#Stop if it came to range
return blow if @step >= @range
#Increase step
@step += 1
end
#--------------------------------------------------------------------------
# * In Range?(Element, Object, Range) - Near Fantastica
#--------------------------------------------------------------------------
def in_range?(element, object, range)
x = (element.x - object.x) * (element.x - object.x)
y = (element.y - object.y) * (element.y - object.y)
r = x + y
return true if r <= (range * range)
return false
end
#--------------------------------------------------------------------------
# * Get ALL Range(Element, Range)
#--------------------------------------------------------------------------
def get_all_range(element, range)
objects = []
for e in $ABS.enemies.values
objects.push(e) if in_range?(element, e.event, range)
end
objects.push($game_player) if in_range?(element, $game_player, range)
return objects
end
#--------------------------------------------------------------------------
# * Blow
#--------------------------------------------------------------------------
def blow
#Stop
@stop = true
#Play Animation
#Show animation on event
self.animation_id = @skill.animation2_id
@showing_ani = true
#Get Everyone in Range of the Explosive Skill
objects = get_all_range(self, @range_skill[3])
#Hit Everyone
hit_player if objects.include?($game_player)
#Hit Enemies
for e in objects
next if e == nil or e == $game_player
#Hit
hit_event(e.event_id)
end
end
#--------------------------------------------------------------------------
# * Hit Player
#--------------------------------------------------------------------------
def hit_player
@stop = true
#Get Actor
actor = $game_party.actors[0]
#Get Enemy
enemy = @actor
#Attack Actor
actor.effect_skill(enemy, @skill) if enemy != nil
#Check if enemy is dead
$ABS.enemy_dead?(actor, enemy)
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def hit_event(id)
@stop = true
#Get enemy
actor = $ABS.enemies[id]
#Return if actor has NIL value
return if actor == nil
#If the parent is player
if @parent.is_a?(Game_Player)
#Get enemy
enemy = $game_party.actors[0]
#Attack It's enemy
actor.effect_skill(enemy, @skill)
return if $ABS.enemy_dead?(actor, enemy)
return if !actor.hate_group.include?(0)
#Put enemy in battle
actor.in_battle = true
actor.attacking = $game_player
$ABS.setup_movement(actor)
return
end
#Get enemy
enemy = $ABS.enemies[@parent.id]
return if enemy == nil
#Attack It's enemy
actor.effect_skill(enemy, @skill)
#Show animation on event
actor.event.animation_id = @skill.animation2_id if actor.damage != "Miss" and actor.damage != 0
#return if enemy is dead
return if $ABS.enemy_dead?(actor, enemy)
return if !actor.hate_group.include?(enemy.enemy_id)
actor.in_battle = true
actor.attacking = enemy
$ABS.setup_movement(actor)
end
end
#============================================================================
# * Game Ranged Skill
#============================================================================
class Game_Ranged_Skill < Range_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parent, actor, skill)
super(parent,actor,skill)
@range_skill = $ABS.RANGE_SKILLS[skill.id]
@range = @range_skill[0]
@opacity = 10 if @range == 1
@move_speed = @range_skill[1]
@character_name = @range_skill[2]
@skill = skill
end
#--------------------------------------------------------------------------
# * Check Event Trigger Touch(x,y)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return if @stop
hit_player if x == $game_player.x and y == $game_player.y
for event in $game_map.events.values
if event.x == x and event.y == y
if event.character_name == ""
force_movement
else
hit_event(event.id)
end
end
end
end
#--------------------------------------------------------------------------
# * Hit Player
#--------------------------------------------------------------------------
def hit_player
@stop = true
#Get Actor
actor = $game_party.actors[0]
#Get Enemy
enemy = @actor
return if enemy == nil
#Attack Actor
actor.effect_skill(enemy, @skill)
#Show animation on player
$game_player.animation_id = @skill.animation2_id if actor.damage != "Miss" and actor.damage != 0
#Check if enemy is dead
$ABS.enemy_dead?(actor, enemy)
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def hit_event(id)
@stop = true
#Get enemy
actor = $ABS.enemies[id]
#Return if actor has NIL value
return if actor == nil
#If the parent is player
if @parent.is_a?(Game_Player)
#Get enemy
enemy = $game_party.actors[0]
#Attack It's enemy
actor.effect_skill(enemy, @skill)
#Show animation on event
actor.event.animation_id = @skill.animation2_id if actor.damage != "Miss" and actor.damage != 0
return if $ABS.enemy_dead?(actor, enemy)
return if !actor.hate_group.include?(0)
#Put enemy in battle
actor.in_battle = true
actor.attacking = $game_player
$ABS.setup_movement(actor)
return
end
#Get enemy
enemy = $ABS.enemies[@parent.id]
return if enemy == nil
#Attack It's enemy
actor.effect_skill(enemy, @skill)
#Show animation on event
actor.event.animation_id = @skill.animation2_id if actor.damage != "Miss" and actor.damage != 0
#return if enemy is dead
return if $ABS.enemy_dead?(actor, enemy)
return if !actor.hate_group.include?(enemy.enemy_id)
actor.in_battle = true
actor.attacking = enemy
$ABS.setup_movement(actor)
end
end
#============================================================================
# * Game Ranged Weapons
#============================================================================
class Game_Ranged_Weapon < Range_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parent, actor, attack)
super(parent,actor,attack)
@range_wepaon = $ABS.RANGE_WEAPONS[attack]
@character_name = @range_wepaon[0]
@move_speed = @range_wepaon[1]
@range = @range_wepaon[4]
end
#--------------------------------------------------------------------------
# * Check Event Trigger Touch(x,y)
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
return if @stop
hit_player if x == $game_player.x and y == $game_player.y
for event in $game_map.events.values
next if event.x != x or event.y != y
if event.character_name == ""
force_movement
else
hit_event(event.id)
end
end
end
#--------------------------------------------------------------------------
# * Hit Player
#--------------------------------------------------------------------------
def hit_player
@stop = true
#Get Actor
actor = $game_party.actors[0]
#Get Enemy
enemy = @actor
#Attack Actor
actor.attack_effect(enemy)
#Show animation on player
$game_player.animation_id = @range_wepaon[2] if actor.damage != "Miss" and actor.damage != 0
#Check if enemy is dead
$ABS.enemy_dead?(actor, enemy)
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def hit_event(id)
@stop = true
#Get enemy
actor = $ABS.enemies[id]
#Return if actor has NIL value
return if actor == nil
#If the parent is player
if @parent.is_a?(Game_Player)
#Get enemy
enemy = $game_party.actors[0]
#Attack It's enemy
actor.attack_effect(enemy)
#Show animation on event
actor.event.animation_id = @range_wepaon[2] if actor.damage != "Miss" and actor.damage != 0
return if $ABS.enemy_dead?(actor, enemy)
return if !actor.hate_group.include?(0)
#Put enemy in battle
actor.in_battle = true
actor.attacking = $game_player
$ABS.setup_movement(actor)
return
end
#Get enemy
enemy = $ABS.enemies[@parent.id]
#Attack It's enemy
actor.attack_effect(enemy)
#Show animation on event
actor.event.animation_id = @skill.animation2_id if actor.damage != "Miss" and actor.damage != 0
#return if enemy is dead
return if $ABS.enemy_dead?(actor, enemy)
return if !actor.hate_group.include?(enemy.enemy_id)
actor.in_battle = true
actor.attacking = enemy
$ABS.setup_movement(actor)
end
end
#============================================================================
# * Game Event - Near Fantastica
#============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Alias
#--------------------------------------------------------------------------
alias mrmo_abs_game_event_refresh_set_page refresh_set_page
#--------------------------------------------------------------------------
# * Event Name
#--------------------------------------------------------------------------
def name
return @event.name
end
#--------------------------------------------------------------------------
# * Event ID
#--------------------------------------------------------------------------
def id
return @id
end
#--------------------------------------------------------------------------
# * Refreshes Page
#--------------------------------------------------------------------------
def refresh_set_page
mrmo_abs_game_event_refresh_set_page
$ABS.refresh(self, @list, @character_name)
end
end
#============================================================================
# * Scene Load
#============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
alias mrmo_abs_scene_load_read_data read_data
#--------------------------------------------------------------------------
def read_data(file)
mrmo_abs_scene_load_read_data(file)
$ABS = Marshal.load(file)
end
end
#============================================================================
# * Scene Save
#============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
alias mrmo_abs_scene_save_write_data write_data
#--------------------------------------------------------------------------
def write_data(file)
mrmo_abs_scene_save_write_data(file)
Marshal.dump($ABS, file)
end
end
#============================================================================
# * Scene Title
#============================================================================
class Scene_Title
#--------------------------------------------------------------------------
alias mrmo_abs_scene_title_cng command_new_game
#--------------------------------------------------------------------------
def command_new_game
$ABS = MrMo_ABS.new
mrmo_abs_scene_title_cng
end
end
#============================================================================
# * Scene Map
#============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias mrmo_abs_scene_map_update update
alias mrmo_abs_scene_map_transfer_player transfer_player
#--------------------------------------------------------------------------
def update
$ABS.update
mrmo_abs_scene_map_update
end
#--------------------------------------------------------------------------
# * Player Place Move
#--------------------------------------------------------------------------
def transfer_player
$ABS.enemies = {} if $game_map.map_id != $game_temp.player_new_map_id
mrmo_abs_scene_map_transfer_player
end
end
#============================================================================
# * Scene Map
#============================================================================
class Game_Player
#--------------------------------------------------------------------------
alias mrmo_abs_game_player_initialize initialize
#--------------------------------------------------------------------------
attr_accessor :event_id
attr_accessor :event
attr_accessor :actor
attr_accessor :enemy_id
attr_accessor :in_battle
def initialize
super
@event_id = 0
@event = self
@enemy_id = 0
@actor = $game_party.actors[0]
@in_battle = false
mrmo_abs_game_player_initialize
end
end
#============================================================================
# * RPG::Sprite
#============================================================================
module RPG
class Sprite < ::Sprite
def initialize(viewport = nil)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage_duration = 0
@_animation_duration = 0
@_blink = false
@stop_animation = true
end
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
for timing in @_animation.timings
if timing.frame == frame_index
animation_process_timing(timing, @_animation_hit)
end
end
else
@stop_animation = true
dispose_animation
end
end
def animation(animation, hit)
@stop_animation = false
dispose_animation
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
def stop_animation?
return @stop_animation
end
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
alias mrmo_spriteset_map_init_characters init_characters
alias mrmo_spriteset_map_update_character_sprites update_character_sprites
alias mrmo_spriteset_map_dispose dispose
#--------------------------------------------------------------------------
# * Character Sprite Initialization
#--------------------------------------------------------------------------
def init_characters
mrmo_spriteset_map_init_characters
# Make character sprites
@ranged_sprites = []
for range in $ABS.range
#Skip NIL Values
next if range == nil and !range.draw
sprite = Sprite_Character.new(@viewport1, range)
@ranged_sprites.push(sprite)
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Update ranged sprites
for range in @ranged_sprites
#Skip NIL Values
next if range == nil
range.dispose
end
mrmo_spriteset_map_dispose
end
#--------------------------------------------------------------------------
# * Update Character Sprites
#--------------------------------------------------------------------------
def update_character_sprites
mrmo_spriteset_map_update_character_sprites
# Update ranged sprites
for range in @ranged_sprites
#Skip NIL Values
next if range == nil
range.update
#If its stop
if range.character.stop and range.stop_animation?
@ranged_sprites.delete(range)
range.dispose
$ABS.range.delete(range.character)
elsif range.character.stop
range.character.character_name = ""
end
end
# Draw Sprite
for range in $ABS.range
#Skip NIL Values
next if range == nil and !range.draw
#If its draw
sprite = Sprite_Character.new(@viewport1, range)
@ranged_sprites.push(sprite)
range.draw = false
end
# Damage Display
#Get all enemies and player
for sprite in @character_sprites
#Skip NIL Value or No damage display
next if sprite == nil or !$ABS.damage_display
#Skip Events
id = sprite.character.id
next if $ABS.enemies[id] == nil and !sprite.character.is_a?(Game_Player)
#Skip if no demage or dead;
if !sprite.character.is_a?(Game_Player)
#Skip no demage or dead
next if $ABS.enemies[id].dead? or $ABS.enemies[id].damage == nil
#Display damage
sprite.damage($ABS.enemies[id].damage, $ABS.enemies[id].critical)
#Make Damage nil
$ABS.enemies[id].damage = nil
else
a = $game_party.actors[0]
#Next if player is dead or demage is NIL
next if a.dead? or a.damage == nil
#Display damage
sprite.damage(a.damage, a.critical)
#Make Damage nil
a.damage = nil
end
end
end
end
#==============================================================================
# ** Game_Battler (part 3)
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Determine Usable Skills
# skill_id : skill ID
#--------------------------------------------------------------------------
def can_use_skill?(skill)
# If there's not enough SP, the skill cannot be used.
return false if skill.sp_cost > self.sp
# Unusable if incapacitated
return false if dead?
# If silent, only physical skills can be used
return false if skill.atk_f == 0 and self.restriction == 1
# Get usable time
occasion = skill.occasion
case occasion
when 0..1
return true
when 2..3
return false
end
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
def effect_skill(user, skill)
# Clear critical flag
self.critical = false
# If skill scope is for ally with 1 or more HP, and your own HP = 0,
# or skill scope is for ally with 0, and your own HP = 1 or more
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.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 |= skill.common_event_id > 0
# First hit detection
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# Set effective flag if skill is uncertain
effective |= hit < 100
# If hit occurs
if hit_result == true
# Calculate power
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# Calculate rate
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# Calculate basic damage
self.damage = power * rate / 20
# Element correction
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# If damage value is strictly positive
if self.damage > 0
# Guard correction
if self.guarding?
self.damage /= 2
end
end
# Dispersion
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# Second hit detection
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# Set effective flag if skill is uncertain
effective |= hit < 100
end
# If hit occurs
if hit_result == true
# If physical attack has power other than 0
if skill.power != 0 and skill.atk_f > 0
# State Removed by Shock
remove_states_shock
# Set to effective flag
effective = true
end
# Substract damage from HP
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
# State change
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# If power is 0
if skill.power == 0
# Set damage to an empty string
self.damage = ""
# If state is unchanged
unless @state_changed
# Set damage to "Miss"
self.damage = "Miss"
end
end
# If miss occurs
else
# Set damage to "Miss"
self.damage = "Miss"
end
# End Method
return effective
end
end
#==============================================================================
# ** Game_Character (part 1)
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
attr_accessor :move_type
attr_accessor :move_speed
attr_accessor :move_frequency
attr_accessor :character_name
attr_accessor :animating
attr_accessor :frame
#--------------------------------------------------------------------------
# * Set Animation
#--------------------------------------------------------------------------
def set_animate(name)
return if @animating
@frame = 4
@old_char = @character_name
@character_name = name
@animating = true
@anim_wait = 40
@pattern = 0
@direction_fix = true
end
#--------------------------------------------------------------------------
alias mrmo_abs_game_character_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
return animate_pose if @animating
mrmo_abs_game_character_update
end
#--------------------------------------------------------------------------
# * Frame Update Pose
#--------------------------------------------------------------------------
def animate_pose
if @anim_wait >= 8
@pattern = (@pattern + 1) % 4
@frame -= 1
@anim_wait = 0
end
@anim_wait += 1 if @anim_wait < 18 - @move_speed * 2
if @frame == 0
@animating = false
@character_name = @old_char
@direction_fix = false
return
end
update_jump if jumping?
end
#--------------------------------------------------------------------------
# * Move toward B
#--------------------------------------------------------------------------
def move_to(b)
# Get difference in player coordinates
sx = @x - b.x
sy = @y - b.y
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# Get absolute value of difference
abs_sx = sx.abs
abs_sy = sy.abs
# If horizontal and vertical distances are equal
if abs_sx == abs_sy
# Increase one of them randomly by 1
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# If horizontal distance is longer
if abs_sx > abs_sy
# Move towards player, prioritize left and right directions
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# If vertical distance is longer
else
# Move towards player, prioritize up and down directions
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
turn_to(b)
end
#--------------------------------------------------------------------------
# * Turn Towards B
#--------------------------------------------------------------------------
def turn_to(b)
# Get difference in player coordinates
sx = @x - b.x
sy = @y - b.y
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# If horizontal distance is longer
if sx.abs > sy.abs
# Turn to the right or left towards player
sx > 0 ? turn_left : turn_right
# If vertical distance is longer
else
# Turn up or down towards player
sy > 0 ? turn_up : turn_down
end
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
alias mrmo_abs_game_party_setup_starting_members setup_starting_members
#--------------------------------------------------------------------------
# * Initial Party Setup
#--------------------------------------------------------------------------
def setup_starting_members
mrmo_abs_game_party_setup_starting_members
$game_player.actor = $game_party.actors[0]
end
end
#============================================================================
# * ABS Enemy
#============================================================================
class ABS_Enemy < Game_Battler
#--------------------------------------------------------------------------
attr_accessor :event_id
attr_accessor :enemy_id
attr_accessor :behavior
attr_accessor :see_range
attr_accessor :hear_range
attr_accessor :aggressiveness
attr_accessor :trigger
attr_accessor :hate_points
attr_accessor :hate_group
attr_accessor :closest_enemy
attr_accessor :in_battle
attr_accessor :ranged
attr_accessor :event
attr_accessor :attacking
attr_accessor :temp_move_type
attr_accessor :temp_speed
attr_accessor :temp_frequency
attr_accessor :actor
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(enemy_id)
super()
@event_id= 0
@see_range = 0
@hear_range = 0
@aggressiveness = 1
@trigger = []
@enemy_id = enemy_id
@in_battle = false
@hp = maxhp
@sp = maxsp
@closest_enemy = false
@hate_points = []
@ranged = nil
@hate_group = []
@event = nil
@attacking = nil
@temp_move_type = 0
@temp_speed = 0
@temp_frequency = 0
@actor = self
end
#--------------------------------------------------------------------------
# * Get Enemy ID
#--------------------------------------------------------------------------
def id
return @enemy_id
end
#--------------------------------------------------------------------------
# * Get Index
#--------------------------------------------------------------------------
def index
return @member_index
end
#--------------------------------------------------------------------------
# * Get Name
#--------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#--------------------------------------------------------------------------
# * Get Basic Maximum HP
#--------------------------------------------------------------------------
def base_maxhp
return $data_enemies[@enemy_id].maxhp
end
#--------------------------------------------------------------------------
# * Get Basic Maximum SP
#--------------------------------------------------------------------------
def base_maxsp
return $data_enemies[@enemy_id].maxsp
end
#--------------------------------------------------------------------------
# * Get Basic Strength
#--------------------------------------------------------------------------
def base_str
return $data_enemies[@enemy_id].str
end
#--------------------------------------------------------------------------
# * Get Basic Dexterity
#--------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#--------------------------------------------------------------------------
# * Get Basic Agility
#--------------------------------------------------------------------------
def base_agi
return $data_enemies[@enemy_id].agi
end
#--------------------------------------------------------------------------
# * Get Basic Intelligence
#--------------------------------------------------------------------------
def base_int
return $data_enemies[@enemy_id].int
end
#--------------------------------------------------------------------------
# * Get Basic Attack Power
#--------------------------------------------------------------------------
def base_atk
return $data_enemies[@enemy_id].atk
end
#--------------------------------------------------------------------------
# * Get Basic Physical Defense
#--------------------------------------------------------------------------
def base_pdef
return $data_enemies[@enemy_id].pdef
end
#--------------------------------------------------------------------------
# * Get Basic Magic Defense
#--------------------------------------------------------------------------
def base_mdef
return $data_enemies[@enemy_id].mdef
end
#--------------------------------------------------------------------------
# * Get Basic Evasion
#--------------------------------------------------------------------------
def base_eva
return $data_enemies[@enemy_id].eva
end
#--------------------------------------------------------------------------
# * Get Offensive Animation ID for Normal Attack
#--------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#--------------------------------------------------------------------------
# * Get Target Animation ID for Normal Attack
#--------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#--------------------------------------------------------------------------
# * Get Element Revision Value
# element_id : Element ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# Get a numerical value corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
# If protected by state, this element is reduced by half
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# End Method
return result
end
#--------------------------------------------------------------------------
# * Get State Effectiveness
#--------------------------------------------------------------------------
def state_ranks
return $data_enemies[@enemy_id].state_ranks
end
#--------------------------------------------------------------------------
# * Determine State Guard
# state_id : state ID
#--------------------------------------------------------------------------
def state_guard?(state_id)
return false
end
#--------------------------------------------------------------------------
# * Get Normal Attack Element
#--------------------------------------------------------------------------
def element_set
return []
end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (+)
#--------------------------------------------------------------------------
def plus_state_set
return []
end
#--------------------------------------------------------------------------
# * Get Normal Attack State Change (-)
#--------------------------------------------------------------------------
def minus_state_set
return []
end
#--------------------------------------------------------------------------
# * Aquire Actions
#--------------------------------------------------------------------------
def actions
return $data_enemies[@enemy_id].actions
end
#--------------------------------------------------------------------------
# * Get EXP
#--------------------------------------------------------------------------
def exp
return $data_enemies[@enemy_id].exp
end
#--------------------------------------------------------------------------
# * Get Gold
#--------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end
#--------------------------------------------------------------------------
# * Get Item ID
#--------------------------------------------------------------------------
def item_id
return $data_enemies[@enemy_id].item_id
end
#--------------------------------------------------------------------------
# * Get Weapon ID
#--------------------------------------------------------------------------
def weapon_id
return $data_enemies[@enemy_id].weapon_id
end
#--------------------------------------------------------------------------
# * Get Armor ID
#--------------------------------------------------------------------------
def armor_id
return $data_enemies[@enemy_id].armor_id
end
#--------------------------------------------------------------------------
# * Get Treasure Appearance Probability
#--------------------------------------------------------------------------
def treasure_prob
return $data_enemies[@enemy_id].treasure_prob
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
alias mrmo_moabs_scene_skill_main main
alias mrmo_moabs_scene_skill_update update
alias mrmo_moabs_scene_skill_update_skill update_skill
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@shk_window = Window_Command.new(250, [$ABS.HOTKEY_SAY.to_s])
@shk_window.visible = false
@shk_window.active = false
@shk_window.x = 200
@shk_window.y = 250
@shk_window.z = 1500
mrmo_moabs_scene_skill_main
@shk_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@shk_window.update if @shk_window.active
mrmo_moabs_scene_skill_update
return update_shk if @shk_window.active
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
mrmo_moabs_scene_skill_update_skill
#Get all the keys
for key in $ABS.skill_keys.keys
#Check is the the key is pressed
next if !Input.trigger?(key)
#Play decision
$game_system.se_play($data_system.decision_se)
#Record Skill
$ABS.skill_keys[key] = @skill_window.skill.id
@skill_window.active = false
@shk_window.active = @shk_window.visible = true
end
end
#--------------------------------------------------------------------------
# * Frame Update Skill Hot Key
#--------------------------------------------------------------------------
def update_shk
#Return if Enter isn't pressed
return if !Input.trigger?(Input::C)
#Play decision
$game_system.se_play($data_system.decision_se)
@shk_window.active = @shk_window.visible = false
@skill_window.active = true
$scene = Scene_Skill.new(@actor_index)
end
end
#--------------------------------------------------------------------------
# * SDK End
#--------------------------------------------------------------------------
end

underdark
30.10.2006, 15:27
Was die HP-Leiste angeht:
Wo hast du deine Leiste hinprogrammiert? Hast du eine eigene Scene erstellt? Wenn ja musst du diese in der Map Scene aufrufen. Dort kannst du auch hinprogrammieren, dass ein Key gedrueckt werden muss.

Skorp
31.10.2006, 00:18
Äh wie was? Bitte noch mal für denen auf den billigen Plätzen... Bitte =((

underdark
31.10.2006, 15:21
Ich habe mir jetzt eine HP- Anzeige (bzw. ein AKS) ins Spiel eingebaut, nur hab ich jetzt imme rdie HP- Anzeige im Spiel (auch im Intro, etc.). Soll heißen, das Script wird das ganze Spiel über verwendet. Wie kann ich das jetzt machen, dass ich diese Anzeige auf Kommando einschalten kann?
Ich habs mit dem Befehl "class_" versucht (z.B. class_Scene_Anzeige), aber ich denke der ist falsch^^ (hab auch ein end am ende gesetzt, aber bei beidem zeigt er einen Syntax- Error an). Kann mir wer helfen?


1. Wie hast du die HP-Anzeige eingebaut? Parallel-Event oder Ruby? Wenn Parallel-Event, dann bist du mit class_Scene_Anzeige tatsaechlich total falsch. Wenn Ruby, dann ist es nicht total falsch.

2. Hast du den Code fuer die Anzeige selbstgeschrieben (ich glaub ja nicht), oder einfach nur copiert? Wenn copiert: Wohin?

Skorp
04.11.2006, 20:43
Selbstverständlich ist es in Ruby geschrieben. Ich hab jetzt aber ne Theorie wie ich die HP Anzeige abstellen könnte. Hier erstmal der Code:

#==============================================================================
# ** HUD
#------------------------------------------------------------------------------
# Mr.Mo "Muhammet Sivri"
# Version 1
# 10.01.06
# Credit Prexus for the Hud back ground.
#==============================================================================
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
if SDK.state("Mr.Mo's ABS")
#--------------------------------------------------------------------------
# * Constants - MAKE YOUR EDITS HERE
#--------------------------------------------------------------------------
HP_X = 77 # X POS of the HP Bar
HP_Y = 3 # Y POS of the HP Bar
HP_WIDTH = 55 # WIDTH of the HP Bar
HP_HEIGHT = 40 # Height of the HP Bar
#--------------------------------------------------------------------------
SP_X = 54 # X POS of the SP Bar
SP_Y = 22 # Y POS of the SP Bar
SP_WIDTH = 55 # WIDTH of the SP Bar
SP_HEIGHT = 5 # Height of the SP Bar
#--------------------------------------------------------------------------
EXP_X = 55 # X POS of the EXP Bar
EXP_Y = 42 # Y POS of the EXP Bar
EXP_WIDTH = 60 # WIDTH of the EXP Bar
EXP_HEIGHT = 5 # Height of the EXP Bar
#--------------------------------------------------------------------------
STATES_SHOW = true # Show states?
STATES_X = 170 # States X display
STATES_Y = 430 # States Y display
#--------------------------------------------------------------------------
SHOW_DASH = true # Show dash bar?
DASH_X = 490 # X POS of the DASH Bar
DASH_Y = 430 # Y POS of the DASH Bar
DASH_WIDTH = 120 # WIDTH of the DASH Bar
DASH_HEIGHT = 10 # Height of the DASH Bar
DASH_BAR = "018-Simple03" # The file used for gradient
#--------------------------------------------------------------------------
SHOW_SNEAK = true # Show SNEAK bar?
SNEAK_X = 490 # X POS of the SNEAK Bar
SNEAK_Y = 455 # Y POS of the SNEAK Bar
SNEAK_WIDTH = 120 # WIDTH of the SNEAK Bar
SNEAK_HEIGHT = 10 # Height of the SNEAK Bar
SNEAK_BAR = "019-Simple04" # The file used for gradient
#--------------------------------------------------------------------------
LOW_HP = 150 # What HP should the low HP icon be shown?
#--------------------------------------------------------------------------
HP_ITEMID = 1 # POTION ITEM ID
SP_ITEMID = 4 # SP Increase Item ID
#--------------------------------------------------------------------------
CAN_TOGGLE = true
TOGGLE_KEY = Input::Letters["E"]
#--------------------------------------------------------------------------
class Window_MrMo_HUD < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(-16, -16, 700, 700)
#Record Old Data
@actor = $game_party.actors[0]
@old_hp = @actor.hp
@old_sp = @actor.sp
@old_exp = @actor.exp
@level = @actor.level
@hp_n = $game_party.item_number(HP_ITEMID)
@sp_n = $game_party.item_number(SP_ITEMID)
@gold_n = $game_party.gold
@states = @actor.states.to_s
@dash = $ABS.dash_min
@sneak = $ABS.sneak_min
#Create Bitmap
self.contents = Bitmap.new(width - 32, height - 32)
#Hide Window
self.opacity = 0
#Refresh
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.color = normal_color
self.contents.font.size = 12
#Record new data
@actor = $game_party.actors[0]
@old_hp = @actor.hp
@old_sp = @actor.sp
@old_exp = @actor.exp
@level = @actor.level
@hp_n = $game_party.item_number(HP_ITEMID)
@sp_n = $game_party.item_number(SP_ITEMID)
@gold_n = $game_party.gold
@states = @actor.states.to_s
@dash = $ABS.dash_min
@sneak = $ABS.sneak_min
#Show the Pictures
bitmap = RPG::Cache.picture("HUD Graphic")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 175, 175))
bitmap = RPG::Cache.picture("HUD Display")
self.contents.blt(15, 380, bitmap, Rect.new(0, 0, 175, 175))
#Show the HP Symbol
bitmap = RPG::Cache.icon("HP Symbol")
self.contents.blt(0, -2, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(35, -9, 640, 32, "HP")
#Draw the HP BAR
draw_gradient_bar(HP_X, HP_Y, @actor.hp, @actor.maxhp, HP_BAR, HP_WIDTH, HP_HEIGHT)
#Show the SP Symbol
bitmap = RPG::Cache.icon("SP Symbol")
self.contents.blt(0, 18, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(35, 11, 640, 32, "SP")
#Draw the SP Bar
draw_gradient_bar(SP_X, SP_Y, @actor.sp, @actor.maxsp, SP_BAR, SP_WIDTH, SP_HEIGHT)
#Show the EXP Symbol
bitmap = RPG::Cache.icon("EXP Symbol")
self.contents.blt(0, 37, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(35, 30, 640, 32, "EXP")
#Draw the EXP Bar
min = @actor.level == 99 ? 1 : @actor.now_exp
max = @actor.level == 99 ? 1 : @actor.next_exp
draw_gradient_bar(EXP_X, EXP_Y, min, max, EXP_BAR, EXP_WIDTH, EXP_HEIGHT)
#Show Hero Icon
bitmap = RPG::Cache.icon("Hero")
self.contents.blt(2, 59, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(35, 49, 640, 32, "Hero:")
self.contents.draw_text(30, 59, 640, 32, @actor.name.to_s)
#Show Level Icon
bitmap = RPG::Cache.icon("Level")
self.contents.blt(2, 81, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(33, 72, 640, 32, "Level:")
self.contents.draw_text(43, 82, 640, 32, @actor.level.to_s)
#Show Gold Icon
bitmap = RPG::Cache.icon("Gold")
self.contents.blt(35, 390, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(30, 400, 640, 32, $game_party.gold.to_s)
self.contents.draw_text(85, 430, 400, 32, $ats.clock.to_s) if SDK.state("ATS")
#If the HP is too low
if @actor.hp.to_i <= LOW_HP
bitmap = RPG::Cache.icon("Skull")
self.contents.blt(130, 0, bitmap, Rect.new(0, 0, 24, 24))
end
#If the SP Item is more then 0
if $game_party.item_number(SP_ITEMID) > 0
bitmap = RPG::Cache.icon("SP Potion")
self.contents.blt(110, 20, bitmap, Rect.new(0, 0, 24, 24))
end
#if the HP Item is more then 0
if $game_party.item_number(HP_ITEMID) > 0
bitmap = RPG::Cache.icon("HP Potion")
self.contents.blt(110, 0, bitmap, Rect.new(0, 0, 24, 24))
end
return if !STATES_SHOW
#Draw States
n = 0
for id in @actor.states
state = $data_states[id]
next if state == nil
bitmap = RPG::Cache.icon(state.name+"_Icon")
x = (n*32) + STATES_X
self.contents.blt(x, STATES_Y, bitmap, Rect.new(0, 0, 24, 24))
n += 1
end
#Change font size
self.contents.font.size = 20
#Dash Bar
self.contents.draw_text(DASH_X - 40, DASH_Y-10, 40, 32, "Dash: ") if SHOW_DASH
draw_gradient_bar(DASH_X, DASH_Y, $ABS.dash_min, $ABS.dash_max, DASH_BAR, DASH_WIDTH, DASH_HEIGHT) if SHOW_DASH
#SNEAK Bar
self.contents.draw_text(SNEAK_X - 40, SNEAK_Y-10, 40, 32, "Sneak: ") if SHOW_SNEAK
draw_gradient_bar(SNEAK_X, SNEAK_Y, $ABS.sneak_min, $ABS.sneak_max, SNEAK_BAR, SNEAK_WIDTH, SNEAK_HEIGHT) if SHOW_SNEAK
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
refresh if something_changed?
end
#--------------------------------------------------------------------------
# * Something Changed?
#--------------------------------------------------------------------------
def something_changed?
return false if Graphics.frame_count % 30 != 0
return true if @actor != $game_party.actors[0]
return true if @old_hp != @actor.hp or @old_sp != @actor.sp or @old_exp != @actor.exp
return true if @level != @actor.level
return true if @hp_n != $game_party.item_number(HP_ITEMID) or @sp_n != $game_party.item_number(SP_ITEMID)
return true if @gold_n != $game_party.gold
return true if @states.to_s != @actor.states.to_s
return true if @dash != $ABS.dash_min or @sneak != $ABS.sneak_min
return false
end
#--------------------------------------------------------------------------
# * TOGGLE KEY
#--------------------------------------------------------------------------
def TOGGLE_KEY
return TOGGLE_KEY
end
#--------------------------------------------------------------------------
# * CAN TOGGLE
#--------------------------------------------------------------------------
def CAN_TOGGLE
return CAN_TOGGLE
end
end
#==============================================================================
# * Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias mrmo_hud_main_draw main_draw
alias mrmo_hud_main_dispose main_dispose
alias mrmo_hud_update_graphics update_graphics
#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main_draw
@mrmo_hud = Window_MrMo_HUD.new
mrmo_hud_main_draw
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
@mrmo_hud.dispose
mrmo_hud_main_dispose
end
#--------------------------------------------------------------------------
# * Update Graphics
#--------------------------------------------------------------------------
def update_graphics
mrmo_hud_update_graphics
@mrmo_hud.update
end
end
#--------------------------------------------------------------------------
# * Load Gradient from RPG::Cache
#--------------------------------------------------------------------------
module RPG
module Cache
def self.gradient(filename, hue = 0)
self.load_bitmap("Graphics/Gradients/", filename, hue)
end
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# * Constants Bar Types and Hues for parameters and parameter names
#--------------------------------------------------------------------------
HP_BAR = "014-Reds01"
SP_BAR = "013-Blues01"
EXP_BAR = "015-Greens01"
ATK_BAR = "020-Metallic01"
PDEF_BAR = "020-Metallic01"
MDEF_BAR = "020-Metallic01"
STR_BAR = "020-Metallic01"
DEX_BAR = "020-Metallic01"
AGI_BAR = "020-Metallic01"
INT_BAR = "020-Metallic01"
HUES = [150,180,60,30,270,350,320]
STATS = ["atk","pdef","mdef","str","dex","agi","int"]
# leave this alone if you don't know what you are doing
OUTLINE = 1
BORDER = 1
#--------------------------------------------------------------------------
# * Draw Gradient Bar
#--------------------------------------------------------------------------
def draw_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
bar = RPG::Cache.gradient(file, hue)
back = RPG::Cache.gradient(back)
back2 = RPG::Cache.gradient(back2)
cx = BORDER
cy = BORDER
dx = OUTLINE
dy = OUTLINE
zoom_x = width != nil ? width : back.width
zoom_y = height != nil ? height : back.height
percent = min / max.to_f if max != 0
percent = 0 if max == 0
back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
bar_dest_rect = Rect.new(x+cx,y+cy,zoom_x * percent-cx*2,zoom_y-cy*2)
back_source_rect = Rect.new(0,0,back.width,back.height)
back2_source_rect = Rect.new(0,0,back2.width,back2.height)
bar_source_rect = Rect.new(0,0,bar.width* percent,bar.height)
self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end

def draw_vertical_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
bar = RPG::Cache.gradient(file, hue)
back = RPG::Cache.gradient(back)
back2 = RPG::Cache.gradient(back2)
cx = BORDER
cy = BORDER
dx = OUTLINE
dy = OUTLINE
zoom_x = width != nil ? width : back.width
zoom_y = height != nil ? height : back.height
percent = min / max.to_f if max != 0
percent = 0 if max == 0
bar_y = (zoom_y - zoom_y * percent).ceil
source_y = bar.height - bar.height * percent
back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
bar_dest_rect = Rect.new(x+cx,y+bar_y+cy,zoom_x-cx*2,(zoom_y * percent).to_i-cy*2)
back_source_rect = Rect.new(0,0,back.width,back.height)
back2_source_rect = Rect.new(0,0,back2.width,back2.height)
bar_source_rect = Rect.new(0,source_y,bar.width,bar.height * percent)
self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end
#--------------------------------------------------------------------------
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias trick_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
width = hp_x - x
width += $game_temp.in_battle ? 50 : 100
# Draw HP
draw_gradient_bar(x, y + 16, actor.hp, actor.maxhp, HP_BAR, width, 8)
trick_draw_actor_hp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw SP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
alias trick_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
width = sp_x - x
width += $game_temp.in_battle ? 50 : 100
# Draw SP
draw_gradient_bar(x, y + 16, actor.sp, actor.maxsp, SP_BAR, width, 8)
trick_draw_actor_sp(actor, x, y, width)
end
#--------------------------------------------------------------------------
# * Draw Exp
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
alias trick_bars_base_exp draw_actor_exp
def draw_actor_exp(actor, x, y)
min = actor.level == 99 ? 1 : actor.now_exp
max = actor.level == 99 ? 1 : actor.next_exp
draw_gradient_bar(x, y + 16, min, max, EXP_BAR, 192, 8)
trick_bars_base_exp(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw Parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : draw which parameter
#--------------------------------------------------------------------------
alias trick_bars_base_parameter draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
hue = HUES[type]
stat = eval("actor.#{STATS[type]}")
bar_type = eval("#{STATS[type].upcase}_BAR")
draw_gradient_bar(x, y + 18, stat, 999, bar_type, 190, 8, hue)
trick_bars_base_parameter(actor, x, y, type)
end
end

class Game_Actor
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
exp = @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
return exp
end
end
#==============================================================================
# * Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
alias mrmo_keyhud_update update
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
mrmo_keyhud_update
if @mrmo_hud.CAN_TOGGLE and Input.trigger?(@mrmo_hud.TOGGLE_KEY)
return @mrmo_hud.visible = true if !@mrmo_hud.visible
return @mrmo_hud.visible = false if @mrmo_hud.visible
end
end
end
#--------------------------------------------------------------------------
# * SDK End
#--------------------------------------------------------------------------
end

Hier kann man die Leiste mit der Taste "E" an und ausschalten. Wie mache ich das aber nun, dass ich das mit nem Switch oder sowas an- und ausschalten kann?

Und noch ne Frage:
Ich hab ein Monsterbuch- Script gefunden (um Statuswerte der bisher getroffenen und besiegten Monster anzuzeigen). Ist toll, nur geht das dummerweise ausschließlich mit dem Standard KS. Und was mache ich nun, damit ich das auch mit meinem Action Kampfsystem hab?
(Der Code:)


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

# Advanced Monster Database

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

# Created By SephirothSpawn (11.18.05)

# Last Updated 11.19.05

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


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

# Class Scene Title

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

class Scene_Title

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

# Alias' New Game Method

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

alias new_game command_new_game

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

# Adds Beastairy Game Variables

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

def command_new_game

# Sets Up Smithery List

$game_beastairy = Game_Beastairy.new

new_game

end

end


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

# Game_Temp

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

class Game_Temp

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

# Public Instance Variables

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

attr_accessor beastairy_return

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

# Alias Initialization

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

alias beastairy_initialize initialize

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

# Object Initialization

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

def initialize

beastairy_initialize

@beastairy_return = false

end

end


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

# Class Game Beastairy

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

class Game_Beastairy

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

# Public Instance Variables

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

attr_accessor monster_groups

#------------------------------------------------------------------#==============================================================================

# Advanced Monster Database

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

# Created By SephirothSpawn (11.18.05)

# Last Updated 11.19.05

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


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

# Class Scene Title

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

class Scene_Title

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

# Alias' New Game Method

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

alias new_game command_new_game

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

# Adds Beastairy Game Variables

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

def command_new_game

# Sets Up Smithery List

$game_beastairy = Game_Beastairy.new

new_game

end

end


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

# Game_Temp

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

class Game_Temp

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

# Public Instance Variables

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

attr_accessor beastairy_return

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

# Alias Initialization

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

alias beastairy_initialize initialize

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

# Object Initialization

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

def initialize

beastairy_initialize

@beastairy_return = false

end

end


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

# Class Game Beastairy

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

class Game_Beastairy

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

# Public Instance Variables

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

attr_accessor monster_groups

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

# Object Initialization

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

def initialize

@monster_groups = []

for i in 1...$data_enemies.size

$data_enemies[i].beastairy_setup

unless @monster_groups.include($data_enemies[i].group)

@monster_groups.push($data_enemies[i].group)

end

end

end

end


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

# Module RPG

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

module RPG

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

# Class Enemy

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

class Enemy

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

# Public Instance Variables

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

# Detectors

attr_accessor seen, defeated, group

# Counters

attr_accessor seen_times, defeated_times

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

# Setup Beastairy

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

def beastairy_setup

@seen_times, @defeated_times = 0, 0

@seen, @defeated = false, false

if @name.include('(')

a, b = @name.index('('), @name.index(')')

@group = @name.slice!(a..b)

@group.delete!('(')

@group.delete!(')')

else

@group = Unclassified

end

end

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

# See Enemy

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

def see

@seen = true

@seen_times += 1

end

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

# Defeat Enemy

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

def defeat

@defeated = true

@defeated_times += 1

end

end

end


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

# Scene_Save

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

class Scene_Save Scene_File

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

# Alias Save Data

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

alias new_save write_save_data

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

# Write Save Data

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

def write_save_data(file)

new_save(file)

Marshal.dump($game_beastairy, file)

end

end


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

# Scene_Load

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

class Scene_Load Scene_File

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

# Alias Read Save Data

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

alias new_load read_save_data

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

# Read Save Data

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

def read_save_data(file)

new_load(file)

$game_beastairy = Marshal.load(file)

end

end


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

# Class Window Base

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

class Window_Base Window

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

# Draw Enemy Sprite

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

def draw_enemy_sprite(x, y, enemy_name, enemy_hue, pose, frame)

bitmap = RPGCache.character(enemy_name, enemy_hue)

cw = bitmap.width 4

ch = bitmap.height 4

# Facing Direction

case pose

when 0 ;a = 0 # Down

when 1 ;a = ch # Left

when 2 ;a = ch 3 # Up

when 3 ;a = ch 2 # Right

end

# Current Animation Slide

case frame

when 0 ;b = 0

when 1 ;b = cw

when 2 ;b = cw 2

when 3 ;b = cw 3

end

# Bitmap Rectange

src_rect = Rect.new(b, a, cw, ch)

# Draws Bitmap

self.contents.blt(x - cw 2, y - ch, bitmap, src_rect)

end

end


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

# Window Monster Group Info

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

class Window_Monster_Group_Info Window_Base

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

# Object Initialization

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

def initialize

super(200, 0, 440, 480)

self.contents = Bitmap.new(width - 32, height - 32)

refresh(0, 0, 0)

end

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

# Refresh

# index Index of Group From Game_Beastairy.Groups

# pose Enemy Character Pose

# frame Frame of Pose

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

def refresh(index, pose, frame)

# Clears Window

contents.clear

# Sets Up Group Name

group_name = $game_beastairy.monster_groups[index]

# Sets Up Enemies In Group

enemies = []

for i in 1...$data_enemies.size

if $data_enemies[i].group == group_name

enemies.push($data_enemies[i])

end

end

group_name = Exit if index == $game_beastairy.monster_groups.size

# Draws Enemy Group Name

contents.font.color = system_color

contents.draw_text(0, 0, self.width - 32, 32, group_name, 1)

unless index == $game_beastairy.monster_groups.size

# Offsets Graphics X Position

graphics_offset = contents.width (enemies.size + 1)

# Draws Enemies Graphics

for i in 0...enemies.size

draw_enemy_sprite(graphics_offset (i + 1), 124, enemies[i].battler_name , enemies[i].battler_hue , pose, frame)

end

# HP, SP, and Gold Word

hp_word = $data_system.words.hp

sp_word = $data_system.words.sp

gold_word = $data_system.words.gold

# Draws Table Headings

contents.draw_text(4, 128, width, 24, Name)

contents.draw_text(0, 128, 200, 24, Max #{hp_word}, 2)

contents.draw_text(0, 128, 300, 24, Max #{sp_word}, 2)

contents.draw_text(-4, 128, contents.width, 24, #{gold_word} Award, 2)

# Draws Enemies Stats

contents.font.color = normal_color

for i in 0...enemies.size

# Sets Enemy Stats

name, hp, sp, gold = , , ,

name, hp, sp = enemies[i].name, enemies[i].maxhp, enemies[i].maxsp if enemies[i].seen

gold = enemies[i].gold if enemies[i].defeated

# Draws Stats

contents.draw_text(4, 152 + (i 24), width, 24, name)

contents.draw_text(0, 152 + (i 24), 200, 24, #{hp}, 2)

contents.draw_text(0, 152 + (i 24), 300, 24, #{sp}, 2)

contents.draw_text(-4, 152 + (i 24), contents.width, 24, #{gold}, 2)

end

end

end

end


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

# Window Monster Info

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

class Window_Monster_Info Window_Base

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

# Object Initialization

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

def initialize

super(200, 0, 440, 480)

self.contents = Bitmap.new(width - 32, height - 32)

end

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

# Refresh

# index Index of enemy From $data_enemies

# pose Enemy Character Pose

# frame Frame of Pose

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

def refresh(index, pose, frame)

# Clears Window

contents.clear

# Enemy

enemy = $data_enemies[index]

# Graphic Image

draw_enemy_sprite(52, 100, enemy.battler_name , enemy.battler_hue, pose, frame)

# Default Stats Set

name =

maxhp = maxsp = str = dex = agi = int = atk = pdef = mdef = eva =

exp = gold = item_id = weapon_id = armor_id = treasure_prob =

item_icon = weapon_icon = armor_icon = 049-Skill06

armor_type = 2

# If the Enemy has been seen

if enemy.seen

name = enemy.name

maxhp = enemy.maxhp.to_s

maxsp = enemy.maxsp.to_s

str = enemy.str.to_s

dex = enemy.dex.to_s

agi = enemy.agi.to_s

int = enemy.int.to_s

atk = enemy.atk.to_s

pdef = enemy.pdef.to_s

mdef = enemy.mdef.to_s

eva = enemy.eva.to_s

end

# If the Enemy has been Defeated

if enemy.defeated

exp = enemy.exp.to_s

gold = enemy.gold.to_s

if enemy.item_id == 0

item_id = Nothing

item_icon = 032-Item01

else

item_id = $data_items[enemy.item_id].name

item_icon = $data_items[enemy.item_id].icon_name

end

if enemy.weapon_id == 0

weapon_id = Nothing

weapon_icon = 032-Item01

else

weapon_id = $data_weapons[enemy.weapon_id].name

weapon_icon = $data_weapons[enemy.weapon_id].icon_name

end

if enemy.armor_id == 0

armor_id = Nothing

armor_icon = 032-Item01

else

armor_id = $data_armors[enemy.armor_id].name

armor_icon = $data_armors[enemy.armor_id].icon_name

armor_type = $data_armors[enemy.armor_id].type

end

treasure_prob = enemy.treasure_prob.to_s

end

# System Words

g_word = $data_system.words.gold

hp_word = $data_system.words.hp

sp_word = $data_system.words.sp

str_word = $data_system.words.str

dex_word = $data_system.words.dex

agi_word = $data_system.words.agi

int_word = $data_system.words.int

atk_word = $data_system.words.atk

pdef_word = $data_system.words.pdef

mdef_word = $data_system.words.mdef

weapon_word = $data_system.words.weapon

case armor_type

when 0 ;armor_type = $data_system.words.armor1

when 1 ;armor_type = $data_system.words.armor2

when 2 ;armor_type = $data_system.words.armor3

when 3 ;armor_type = $data_system.words.armor4

end

item_word = $data_system.words.item

# Draws Name

contents.font.color = normal_color

contents.draw_text(116, 0, contents.width - 116, 32, name)

# Draws Times Seen & Defeated

contents.font.color = system_color

contents.draw_text(116, 32, contents.width - 116, 32, Times Seen)

contents.draw_text(116, 64, contents.width - 116, 32, Times Defeated)

contents.font.color = normal_color

contents.draw_text(0, 32, contents.width, 32, #{enemy.seen_times}, 2)

contents.draw_text(0, 64, contents.width, 32, #{enemy.defeated_times}, 2)

# Organizes Stats

colomn_a_left = [Max #{hp_word}, Max #{sp_word}, str_word, dex_word,

agi_word, int_word, atk_word, pdef_word, mdef_word, Evasion]

colomn_a_right = [maxhp, maxsp, str,dex , agi, int, atk, pdef, mdef, eva]

# Organized Victory Settings

column_b_left = [Experience Given, #{g_word} Dropped, #{item_word} Dropped, ,

#{weapon_word} Dropped, , #{armor_type} Dropped, , Drop Pobabilty]

column_b_right = [exp, gold, , item_id, , weapon_id, , armor_id, treasure_prob]

# Draws Stats

for i in 0...colomn_a_left.size

contents.font.color = system_color

contents.draw_text(4, 160 + i 32, 160, 32, colomn_a_left[i])

contents.font.color = normal_color

contents.draw_text(-4, 160 + i 32, 160, 32, colomn_a_right[i], 2)

end

# Draws Victory Settings

for i in 0...column_b_left.size

contents.font.color = system_color

contents.draw_text(168, 160 + i 32, contents.width, 32, column_b_left[i])

x = -4

x = -30 if i == 3 or i == 5 or i == 7

contents.font.color = normal_color

contents.draw_text(x, 160 + i 32, contents.width, 32, column_b_right[i], 2)

end

# Draws Item Icons

bitmap = RPGCache.icon(item_icon)

self.contents.blt(contents.width - 24, 260, bitmap, Rect.new(0, 0, 24, 24))

bitmap = RPGCache.icon(weapon_icon)

self.contents.blt(contents.width - 24, 324, bitmap, Rect.new(0, 0, 24, 24))

bitmap = RPGCache.icon(armor_icon)

self.contents.blt(contents.width - 24, 388, bitmap, Rect.new(0, 0, 24, 24))

end

end


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

# Window Beastairy Controls

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

class Window_Beastairy_Controls Window_Base

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

# Object Initialization

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

def initialize

super(0, 288, 200, 192)

self.contents = Bitmap.new(width - 32, height - 32)

self.z = 999

refresh(0)

end

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

# Refresh

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

def refresh(phase)

# Clears Window

contents.clear

disabled_system_color = Color.new(192, 224, 255, 128)

contents.font.color = normal_color

contents.draw_text(0, 0, contents.width, 24, L R Change Pose)

# Main Phase Controls

contents.font.color = phase == 0 system_color disabled_system_color

contents.draw_text(4, 24, contents.width, 24, Main)

contents.font.color = phase == 0 normal_color disabled_color

contents.draw_text(8, 48, contents.width, 24, B Return to Map)

contents.draw_text(8, 72, contents.width, 24, C Select Group)

# Enemy Select Controls

contents.font.color = phase == 1 system_color disabled_system_color

contents.draw_text(4, 96, contents.width, 24, Enemy Select)

contents.font.color = phase == 1 normal_color disabled_color

contents.draw_text(8, 120, contents.width, 24, B Return to Main)

contents.draw_text(8, 140, contents.width, 24, C Test Battle)

end

end


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

# Class Scene Beastairy

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

class Scene_Beastairy

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

# Main Processing

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

def main

# Sets Main Phase

@phase = 0

# Enemies Graphic Animation

@pose, @frame, @counting_frame= 0, 0, 0

# Current Phase Window

@phase_window = Window_Base.new(0, 0, width = 200, height = 64)

@phase_window.contents = contents = Bitmap.new(width - 32, height - 32)

@phase_window.contents.draw_text(0, 0, 168, 32, Main Phase, 1)

# Main Window (Enemy Groups)

commands = $game_beastairy.monster_groups.dup

commands.push(Exit)

@enemy_groups = Window_Command.new(200, commands)

@enemy_groups.y = 64

@enemy_groups.height = 224

# Controls Window

@controls = Window_Beastairy_Controls.new

# Monster Group Information Window

@monster_window = Window_Monster_Group_Info.new

@monster_window.refresh(0, 0, 0)

# Enemy Information Window

@enemy_window = Window_Monster_Info.new

@enemy_window.visible = false

# Scene Objects

@objects = [@phase_window, @enemy_groups, @controls, @monster_window, @enemy_window]

# Execute transition

Graphics.transition

# Main loop

loop do

# Update game screen

Graphics.update

# Update input information

Input.update

# Update Objects Information

@objects.each {x x.update}

# Frame update

update

# Abort loop if screen is changed

break if $scene != self

end

# Prepare for transition

Graphics.freeze

# Dispose of Objects

@objects.each {x x.dispose unless x.disposed}

end

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

# Frame Update

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

def update

# Visiblity Changes Between Methods

case @phase

# Main Phase

when 0

[@enemy_window].each {x x.visible = false if x.visible}

[@enemy_groups, @monster_window].each {x x.visible = true unless x.visible}

@enemy_groups.active = true

when 1

[@enemy_window].each {x x.visible = true unless x.visible}

[@enemy_groups, @monster_window].each {x x.visible = false if x.visible}

@enemy_groups.active = false

end

# Updates Enemy Animation

@counting_frame += 1

if @counting_frame == 8

@counting_frame = 0

@frame += 1

@frame = 0 if @frame == 4

if @phase == 0

@monster_window.refresh(@enemy_groups.index, @pose, @frame)

else

enemy_id = @enemies[@groups_enemies.index].id

@enemy_window.refresh(enemy_id, @pose, @frame)

end

end

# Current Phase Update

case @phase

when 0; main_update

when 1; enemy_select

end

end

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

# Main Frame Update

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

def main_update

# Exit Scene

if Input.trigger(InputB)

$game_system.se_play($data_system.cancel_se)

$game_temp.beastairy_return = false

$scene = Scene_Map.new

# Enemy Select

elsif Input.trigger(InputC)

$game_system.se_play($data_system.decision_se)

if @enemy_groups.index == $game_beastairy.monster_groups.size

$game_temp.beastairy_return = false

$scene = Scene_Map.new

else

commands, @enemies = [], []

group = $game_beastairy.monster_groups[@enemy_groups.index]

for i in 1...$data_enemies.size

if $data_enemies[i].group == group

commands.push($data_enemies[i].seen $data_enemies[i].name )

@enemies.push($data_enemies[i])

end

end

@groups_enemies = Window_Command.new(200, commands)

@groups_enemies.y = 64

@groups_enemies.height = 224

# Phase Window Update

@phase_window.contents.clear

@phase_window.contents.draw_text(0, 0, 168, 32, Enemy Select, 1)

# Adds Object (For Updating)

@objects.push(@groups_enemies)

# Updates Controls Window

@controls.refresh(1)

enemy_id = @enemies[@groups_enemies.index].id

@enemy_window.refresh(enemy_id, @pose, @frame)

# Changes Phase

@phase = 1

end

# Changes Pose

elsif Input.trigger(InputLEFT)

$game_system.se_play($data_system.cursor_se)

@pose == 0 @pose = 3 @pose -= 1

elsif Input.trigger(InputRIGHT)

$game_system.se_play($data_system.cursor_se)

@pose == 3 @pose = 0 @pose += 1

end

end

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

# Enemy Frame Update

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

def enemy_select

# Exit Phase

if Input.trigger(InputB)

$game_system.se_play($data_system.cancel_se)

@groups_enemies.dispose

@objects.delete(@groups_enemies)

# Phase Window Update

@phase_window.contents.clear

@phase_window.contents.draw_text(0, 0, 168, 32, Main Phase, 1)

# Updates Controls Window

@controls.refresh(0)

# Changes Phase

@phase = 0

# Enemy Select

elsif Input.trigger(InputC)

enemy = @enemies[@groups_enemies.index]

if enemy.seen

$game_system.se_play($data_system.decision_se)

enemy_name = enemy.name

for i in 1...$data_troops.size

if $data_troops[i].name == enemy_name

$game_temp.beastairy_return = true

$game_temp.battle_troop_id = i

$game_temp.battle_can_escape = true

$game_temp.battle_can_lose = false

$game_temp.battle_proc = nil

# Memorize map BGM and stop BGM

$game_temp.map_bgm = $game_system.playing_bgm

$game_system.bgm_stop

# Play battle start SE

$game_system.se_play($data_system.battle_start_se)

# Play battle BGM

$game_system.bgm_play($game_system.battle_bgm)

# Straighten player position

$game_player.straighten

# Switch to battle screen

$scene = Scene_Battle.new

end

end

else

$game_system.se_play($data_system.buzzer_se)

end

elsif Input.trigger(InputLEFT)

$game_system.se_play($data_system.cursor_se)

@pose == 0 @pose = 3 @pose -= 1

elsif Input.trigger(InputRIGHT)

$game_system.se_play($data_system.cursor_se)

@pose == 3 @pose = 0 @pose += 1

end

end

end


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

# Scene_Battle

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

class Scene_Battle

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

# Alias Main Processing

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

alias beastairy_main main

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

# Main Processing

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

def main

unless $game_temp.beastairy_return

@beastairy_troop = []

troop = $data_troops[$game_temp.battle_troop_id]

for i in 0...troop.members.size

enemy = $data_enemies[troop.members[i].enemy_id]

@beastairy_troop.push(enemy)

enemy.see

end

else

@beastairy_troop = []

end

beastairy_main

end

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

# Battle Ends

# result results (0win 1lose 2escape)

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

def battle_end(result)

# Clear in battle flag

$game_temp.in_battle = false

# Clear entire party actions flag

$game_party.clear_actions

# Remove battle states

for actor in $game_party.actors

actor.remove_states_battle

end

# Clear enemies

$game_troop.enemies.clear

# Call battle callback

if $game_temp.battle_proc != nil

$game_temp.battle_proc.call(result)

$game_temp.battle_proc = nil

end

if $game_temp.beastairy_return

$scene = Scene_Beastairy.new

else

if result == 0

for enemy in @beastairy_troop

enemy.defeat

end

end

$scene = Scene_Map.new

end

end

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

# Frame Update

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

def update

# If battle event is running

if $game_system.battle_interpreter.running

# Update interpreter

$game_system.battle_interpreter.update

# If a battler which is forcing actions doesn't exist

if $game_temp.forcing_battler == nil

# If battle event has finished running

unless $game_system.battle_interpreter.running

# Rerun battle event set up if battle continues

unless judge

setup_battle_event

end

end

# If not after battle phase

if @phase != 5

# Refresh status window

@status_window.refresh

end

end

end

# Update system (timer) and screen

$game_system.update

$game_screen.update

# If timer has reached 0

if $game_system.timer_working and $game_system.timer == 0

# Abort battle

$game_temp.battle_abort = true

end

# Update windows

@help_window.update

@party_command_window.update

@actor_command_window.update

@status_window.update

@message_window.update

# Update sprite set

@spriteset.update

# If transition is processing

if $game_temp.transition_processing

# Clear transition processing flag

$game_temp.transition_processing = false

# Execute transition

if $game_temp.transition_name ==

Graphics.transition(20)

else

Graphics.transition(40, GraphicsTransitions +

$game_temp.transition_name)

end

end

# If message window is showing

if $game_temp.message_window_showing

return

end

# If effect is showing

if @spriteset.effect

return

end

# If game over

if $game_temp.gameover

# Switch to game over screen

if $game_temp.beastairy_return

$scene = Scene_Beastairy.new

else

$scene = Scene_Gameover.new

end

end

# If returning to title screen

if $game_temp.to_title

# Switch to title screen

$scene = Scene_Title.new

return

end

# If battle is aborted

if $game_temp.battle_abort

# Return to BGM used before battle started

$game_system.bgm_play($game_temp.map_bgm)

# Battle ends

battle_end(1)

return

end

# If waiting

if @wait_count 0

# Decrease wait count

@wait_count -= 1

return

end

# If battler forcing an action doesn't exist,

# and battle event is running

if $game_temp.forcing_battler == nil and

$game_system.battle_interpreter.running

return

end

# Branch according to phase

case @phase

when 1 # pre-battle phase

update_phase1

when 2 # party command phase

update_phase2

when 3 # actor command phase

update_phase3

when 4 # main phase

update_phase4

when 5 # after battle phase

update_phase5

end

end

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

# Start After Battle Phase

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

def start_phase5

# Shift to phase 5

@phase = 5

# Play battle end ME

$game_system.me_play($game_system.battle_end_me)

# Return to BGM before battle started

$game_system.bgm_play($game_temp.map_bgm)

# Initialize EXP, amount of gold, and treasure

exp = 0

gold = 0

treasures = []

# Loop

for enemy in $game_troop.enemies

# If enemy is not hidden

unless enemy.hidden

unless $game_temp.beastairy_return

# Add EXP and amount of gold obtained

exp += enemy.exp

gold += enemy.gold

# Determine if treasure appears

if rand(100) enemy.treasure_prob

if enemy.item_id 0

treasures.push($data_items[enemy.item_id])

end

if enemy.weapon_id 0

treasures.push($data_weapons[enemy.weapon_id])

end

if enemy.armor_id 0

treasures.push($data_armors[enemy.armor_id])

end

end

end

end

end

# Treasure is limited to a maximum of 6 items

treasures = treasures[0..5]

# Obtaining EXP

for i in 0...$game_party.actors.size

actor = $game_party.actors[i]

if actor.cant_get_exp == false

last_level = actor.level

actor.exp += exp

if actor.level last_level

@status_window.level_up(i)

end

end

end

# Obtaining gold

$game_party.gain_gold(gold)

# Obtaining treasure

for item in treasures

case item

when RPGItem

$game_party.gain_item(item.id, 1)

when RPGWeapon

$game_party.gain_weapon(item.id, 1)

when RPGArmor

$game_party.gain_armor(item.id, 1)

end

end

# Make battle result window

@result_window = Window_BattleResult.new(exp, gold, treasures)

# Set wait count

@phase5_wait_count = 100

end

end

Bitte Leute, helft mir :(

Macros
05.11.2006, 12:33
Ich hab das Script jetzt nicht zum laufen gebracht, aber wenn du abfragen willst ob ein switch an ist, benutze folgendes:

if $game_switches[1]

--hier mit Aktion ersetzen--

end

Die 1 ist die Zahl des Switches.
Ich glaube du müsstest das nach der class setzen und vor dem letzten end.
Allerdings muss ich zugeben, nicht wirkich Ahnung von RGSS zu haben.

Ansonsten findest du hier (http://www.rmxp.org/forums/showthread.php?t=1868) ein Paar RGSS-Tutorials.

MagicMagor
05.11.2006, 13:57
Für das An- und Ausschalten per Switch suche folgenden Code:


#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main_draw
@mrmo_hud = Window_MrMo_HUD.new
mrmo_hud_main_draw
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
@mrmo_hud.dispose
mrmo_hud_main_dispose
end
#--------------------------------------------------------------------------
# * Update Graphics
#--------------------------------------------------------------------------
def update_graphics
mrmo_hud_update_graphics
@mrmo_hud.update
end

Und ersetze ihn durch folgenden:


#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main_draw
if $game_switches[1]
@mrmo_hud = Window_MrMo_HUD.new
else
if @mrmo_hud != nil
@mrmo_hud.dispose
end
end
mrmo_hud_main_draw
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
if @mrmo_hud != nil
@mrmo_hud.dispose
end
mrmo_hud_main_dispose
end
#--------------------------------------------------------------------------
# * Update Graphics
#--------------------------------------------------------------------------
def update_graphics
mrmo_hud_update_graphics
if @mrmo_hud != nil
@mrmo_hud.update
end
end

Die 1 bei $game_switches[1] ersetzt du dann mit der Nummer deines Switches. Ist zwar alles andere als sauber, aber das ist der restliche Code auch nicht..

Skorp
05.11.2006, 16:31
"???????????? ´Mr Mo´s HUD´? 424 ??? Syntaxerror ??????????"

Das zeigt er an :(

Kelven
05.11.2006, 17:42
Am besten du postest mal Zeile 424 aus dem entsprechenden Code. Entweder war da schon ein Syntaxfehler drinnen, oder du hast einen eingebaut.

Skorp
05.11.2006, 18:10
"???????????? ´Mr Mo´s HUD´? 424 ??? Syntaxerror ??????????"

Das zeigt er an :(

EDIT: Ist die letzte Zeile im Code, also ein end

MagicMagor
05.11.2006, 19:57
Dann hast du irgendwo ein end gelöscht. Vermutlich hast du beim Kopieren meines Codes ein weiteres end mit überschrieben, was du aber da lassen solltest.

Vergleiche also nochmal den Ursprungscode, den du hier gepostet hast, und deinen aktuellen Code bzw. genau das was du überschreiben solltest.