RPG-Maker Quartier

Hier dreht sich alles um die RPG-Maker-Reihe von ASCII/Enterbrain. Der RPG-Maker ist ein Tool, mit dem du dir dein eigenes kleines Rollenspiel erstellen kannst. Du findest hier alles, was du dazu brauchst. Aber natürlich umfasst die Community noch mehr!
Aktuelle Zeit: So Sep 22, 2019 7:57

Alle Zeiten sind UTC + 1 Stunde



Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast



Ein neues Thema erstellen Auf das Thema antworten  [ 19 Beiträge ]  Gehe zu Seite 1, 2  Nächste
Autor Nachricht
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 435
BeitragVerfasst: Sa Aug 05, 2006 19:02 
Update!
Dank RAMart nun die V1.0!

Zuerst möchte ich klarstellen das nicht ich, sondern im Prinzip der Drake dieses Script gemacht hat. Ein paar Ideen und Veränderungen von KD, Phantom und mir sind ebenfalls mit drin und ich habe das Ganze als einzelnes Script zusammengetragen. RAMart hat zu entscheidenden Verbesserungen beigetragen.
Es gibt auch noch viele Fehler die im Zusammenhang mit Benutzung dieses Scripts auftauchen (Charas werden im Menü, bei Spielständen sowie im Editor nicht ordnungsgemäß angezeigt). Wer Lust hat diese Fehler auszubügeln, darf mich gerne kontaktieren.

Worum geht es eigentlich?
Normalerweise besteht ein XP Chara aus 4 Frames (2 Standposen, 2 Gehposen) sowie hier:
Bild
Durch das Script lässt ein Character auf mehr Frames erweitern, sowie dieser hier mit 8 Gehposen:
Bild
oder der hier mit 9 Gehposen:
Bild

Demo:
Als das Gerücht aufkam, das Charaktere mit mehr als 9 Frames nicht klappen würde, wollte ich es wissen und selbst ausprobieren. Nur sind Charaktere mit vielen Frames schwer zu finden, also habe ich mich an eine 3D Animation mit Tifa, bekannt aus FF7, gemacht. Herausgekommen sind 50 Laufframes + 1 Standframe. Achtung: Aufgrund der Größe des Charakters klappt die Demo möglicherweise bei einigen nicht. Testet selbst, Download hier.
Wer will kann auch mit der Frame Rate rumspielen (Event ganz unten links) und z.B. auf 10 oder 20 setzen, damit ihr seht wie flüssig die Bewegung ist.

Benutzung:
Die Anzahl der Gehposen ist variabel und wird im Dateinamen des Charakters bestimmt.
Einfach zum Dateinamen des Charakters ein f[x] einfügen. Wobei x für die Anzahl der Frames steht (inkl. Standpose).
Beispiele: Hero_f[8].png, Wachef[12]ani2.png, f[6]frau.png. Standard ist 4 und brauch nicht extra genannt zu werden (z.B. für RTP-Charas).

Um das Script zu verwenden: Script Editor öffnen, Rechtsklick auf Main, dann Insert wählen. Dort einen Namen eingeben (z.B. VCF) und im rechten Feld das Script einfach einfügen.

Code:
#============================================================================
# ** Variable Character Frames Script (v1.0)
#============================================================================
# Idee und Ausführung: Der Drake, KD, Phantom, Ascare, RAMart.
# Niemand verlangt ein extra Credit dafür, ihr könnt es einfach benutzen.
#
# Benutzung: Einfach zum Dateinamen des Charakters ein f[x] einfügen.
# Wobei x für die Anzahl der Frames steht (inkl. Standpose).
#
# Beispiele: Hero_f[8].png, Wachef[12]ani2.png, f[6]frau.png
# Standard ist 4 und brauch nicht extra genannt zu werden (z.B. für RTP-Charas).
#============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias_method :init, :initialize
  def initialize
    init
    getCharFrame
  end
  #--------------------------------------------------------------------------
  # * Get Character Frame
  #--------------------------------------------------------------------------
 def getCharFrame
  @CharFrame = 4
  self.character_name.sub(/f\[(\d+)\]/) { @CharFrame = $1.to_i }
  return @CharFrame
 end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Branch with jumping, moving, and stopping
    if jumping?
      update_jump
    elsif moving?
      update_move
    else
      update_stop
    end
    # If animation count exceeds maximum value
    # * Maximum value is move speed * 1 taken from basic value 18
    if @anime_count > 18 - @move_speed * 2
      # If stop animation is OFF when stopping
      if not @step_anime and @stop_count > 0
        # Return to original pattern
        @pattern = @original_pattern
        # If stop animation is ON when moving
      else
        # Update pattern
       if @CharFrame == 4
         @pattern = (@pattern + 1) % 4
        else
         @pattern = [((@pattern + 1) % @CharFrame), 1].max
       end
      end
      # Clear animation count
      @anime_count = 0
    end
    # If waiting
    if @wait_count > 0
      # Reduce wait count
      @wait_count -= 1
      return
    end
    # If move route is forced
    if @move_route_forcing
      # Custom move
      move_type_custom
      return
    end
    # When waiting for event execution or locked
    if @starting or lock?
      # Not moving by self
      return
    end
    # If stop count exceeds a certain value (computed from move frequency)
    if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
      # Branch by move type
      case @move_type
      when 1  # Random
        move_type_random
      when 2  # Approach
        move_type_toward_player
      when 3  # Custom
        move_type_custom
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update frame (move)
  #--------------------------------------------------------------------------
  def update_move
    # Convert map coordinates from map move speed into move distance
    distance = 2 ** @move_speed
    # If logical coordinates are further down than real coordinates
    if @y * 128 > @real_y
      # Move down
      @real_y = [@real_y + distance, @y * 128].min
    end
    # If logical coordinates are more to the left than real coordinates
    if @x * 128 < @real_x
      # Move left
      @real_x = [@real_x - distance, @x * 128].max
    end
    # If logical coordinates are more to the right than real coordinates
    if @x * 128 > @real_x
      # Move right
      @real_x = [@real_x + distance, @x * 128].min
    end
    # If logical coordinates are further up than real coordinates
    if @y * 128 < @real_y
      # Move up
      @real_y = [@real_y - distance, @y * 128].max
    end
    # If move animation is ON
    if @walk_anime
      # Increase animation count by 1.5
      @anime_count += 1.5*(@CharFrame/4)
    # If move animation is OFF, and stop animation is ON
    elsif @step_anime
      # Increase animation count by 1
      @anime_count += 1*(@CharFrame/4)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (stop)
  #--------------------------------------------------------------------------
  def update_stop
    # If stop animation is ON
    if @step_anime
      # Increase animation count by 1
      @anime_count += 1*(@CharFrame/4)
    # If stop animation is OFF, but current pattern is different from original
    elsif @pattern != @original_pattern
      # Increase animation count by 1.5
      @anime_count += 1.5*(@CharFrame/4)
    end
    # When waiting for event execution, or not locked
    # * If lock deals with event execution coming to a halt
    unless @starting or lock?
      # Increase stop count by 1
      @stop_count += 1
    end
  end
end
  
class Sprite_Character < RPG::Sprite
  
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If tile ID, file name, or hue are different from current ones
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_hue != @character.character_hue
      # Remember tile ID, file name, and hue
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_hue = @character.character_hue
      # If tile ID value is valid
      if @tile_id >= 384
        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
          @tile_id, @character.character_hue)
        self.src_rect.set(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      # If tile ID value is invalid
      else
        self.bitmap = RPG::Cache.character(@character.character_name,
          @character.character_hue)
        @CharFrame = @character.getCharFrame
        @cw = bitmap.width / @CharFrame
        @ch = bitmap.height / 4
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
    # Set visible situation
    self.visible = (not @character.transparent)
    # If graphic is character
    if @tile_id == 0
      # Set rectangular transfer
      sx = @character.pattern * @cw
      sy = (@character.direction - 2) / 2 * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
    # Set sprite coordinates
    self.x = @character.screen_x
    self.y = @character.screen_y
    self.z = @character.screen_z(@ch)
    # Set opacity level, blend method, and bush depth
    self.opacity = @character.opacity
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    # Animation
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
  end
end


Funktionsweise:
[img]http://mitglied.lycos.de/midgar/dump/held_f[9].png[/img]
Der grüne Bereich wird nur angezeigt wenn der Charakter stehen bleibt. Sobald er sich bewegt wird der rote Bereiche durchlaufen. In diesem Fall fängt er bei dem zweiten Frame an und läuft bis zum achten Frame, danach springt er wieder zurück auf den zweiten usw...

Nun, ich hoffe ihr könnt es so gut gebrauchen wie ich. :)

_________________
Bild Bild Bild Bild Bild


Zuletzt geändert von Ascare am So Sep 09, 2007 12:51, insgesamt 2-mal geändert.

Nach oben
 Profil  
Mit Zitat antworten  
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 449
Alter: 28
Wohnort: Deutschland
 Betreff des Beitrags:
BeitragVerfasst: So Aug 13, 2006 1:32 
hab noch ne frage, ich verstehe noch nicht ganz vie ich das in mein spiel einbauen soll?? ich habe den code in ein rgss feld eingefügt und das hero_f[9].png runtergeldaden und importiert. so und jetzt? was muss ich nun machen?

_________________
Bild


Nach oben
 Profil  
Mit Zitat antworten  
Offline
Official Oldschool
Official Oldschool
Benutzeravatar
Beiträge: 8917
Alter: 30
Wohnort: BRD, Thüringen
 Betreff des Beitrags:
BeitragVerfasst: So Aug 13, 2006 3:05 
Nix weiter. Wenn du ein Event mit dieser Grafik erstellst, so hat das Event eben eine Bewegungsanimation aus 9 statt 4 Frames.

_________________


Nach oben
 Profil ICQ  
Mit Zitat antworten  
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 449
Alter: 28
Wohnort: Deutschland
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 20:50 
ich weiß nicht, bei mir gehts nicht, ich kopiere den code in den script editor. und jezz hab ich eine charaset mit 7 frames und benenne es um in hero_f[7].png und importiere es. wähle das charset als hero aus, und es geht nicht, der held wird dann nciht richtig angezeigt, kp warum
please help

mfg
Sven

_________________
Bild


Nach oben
 Profil  
Mit Zitat antworten  
Offline
Official Oldschool
Official Oldschool
Benutzeravatar
Beiträge: 8917
Alter: 30
Wohnort: BRD, Thüringen
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 21:17 
Poste mal dein Charset.

_________________


Nach oben
 Profil ICQ  
Mit Zitat antworten  
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 449
Alter: 28
Wohnort: Deutschland
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 21:23 
http://img237.imageshack.us/img237/460/linkf7uk1.png


hier bitteschön :)


mfg
Sven

_________________
Bild


Nach oben
 Profil  
Mit Zitat antworten  
Offline
Schweizer Reiter
Schweizer Reiter
Benutzeravatar
Beiträge: 321
Alter: 28
Wohnort: Stadt mit Fernsehturm
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 21:31 
benenn die datei in  "linkf7uk1_f[7].png" um
in der db wirds zwa komisch angezeigt aba im spiel funzt des dann

_________________
Bild

So siehts in mein Kopf aus xD
Code:
<>Branch if Var [0001:Grundwissen] is 0
  <>Switch Operation: [0001:Denken] OFF
  <>Message: Geh und les dir erstmal diverse
  :        FAQs und Guides duch!
  <>Game Over
  <>
: Else Handler
  <>Branch if Var [0002:Denken] is 1
    <>Switch Operation: [0002:Posten] ON
    <>
  : Else Handler
    <>Switch Operation: [0002:Posten] OFF
    <>
:End
<>


Nach oben
 Profil  
Mit Zitat antworten  
Offline
Official Oldschool
Official Oldschool
Benutzeravatar
Beiträge: 8917
Alter: 30
Wohnort: BRD, Thüringen
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 21:49 
Bei mir klappt es. Der Name des Charsets muss f[7] enthalten. Wie der Char ansonsten heißt, ist egal.

_________________


Nach oben
 Profil ICQ  
Mit Zitat antworten  
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 449
Alter: 28
Wohnort: Deutschland
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 21:59 
ja das charset heißt bei mir ja link_f[7].png

aber es wir halt nicht richtig dargestellt.

ich erläutere ma was ich mache. also ich erstelle ein neues spiel, gehe in den script editor und füge den code in eine neie zeile ein. dann importiere ich das charset(link_f[7]) und erstelle es als held1..


mfg
Sven

_________________
Bild


Nach oben
 Profil  
Mit Zitat antworten  
Offline
Official Oldschool
Official Oldschool
Benutzeravatar
Beiträge: 8917
Alter: 30
Wohnort: BRD, Thüringen
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 22:09 
Der Code sollte am besten in einer neuen Scriptzeile direkt über Main eingefügt werden, bzw. sie MUSS unter die Scriptzeile "Sprite_Character"!

_________________


Nach oben
 Profil ICQ  
Mit Zitat antworten  
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 449
Alter: 28
Wohnort: Deutschland
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 22:14 
also jezz hats funktioniert.. ich weiß auch nicht warum. hab nochmal nen neues porjekt gemacht und so weiter, jez geht es. aber noch mal ne frage:
kann ich dieses script auch mit dem pxielmovement script verbinden?
ich habe beide scripts eingefügt und wenn ich das spiel starte und pfeil nach unten drücke läuft der chara ungebremst diagonal rechts runter, sogar aus der map raus^^
hier mal der pxielsmovement code:
TEIL1
Code:

#############################################################
#
#                                     Pixelmovement Script v1.1 by f0tz!baerchen (29.06.2006)        
#
#                                     Credits:
#                                       arevulopapo (turn toward/away player methods)
#                                       Caesar (fill_circle method)
#
#############################################################
#
# History:
#
# + Features:
#     - Pixelmovement
#     - Pixel-Walls / Collision Maps (according to the map or either to the Tileset/Autotiles)
#     - variable Event-Size
#     - individual Move-Commands
#     - 8-Directions
#     - all features work with events, too!
# + New things in v0.9 beta:
#     - 8 walking animations MAY be used (so you will still be able to use only 4)
#     - more frames (how many you can choose yourself)
#     - possibility to add/subtract the double distance in x-direction like in an isometric script
#     - Bugfix: while starting to walk the characters "slided" a bit
#     - possibility to make "bridges"
#     - Bugfix: game crashed when going on the coordinate 0:0
#     - Bugfix: events were able to walk into a wall with some luck..
# + New things in v0.9:
#     - Caterpillar System (uses Pathfinding)
#     - better Priority Handling (at fences)
#     - Bugfix: the coordinates werent used correctly in the general event commands
#     - Possibility of a standing animation has been added
#     - completely new Event-Size handling (including passability and event activation)
#     - some Bugfixes..
#     - three new commands for the Game_Character class:
#       "turn_toward_event(id)", "turn_away_from_event(id)"
#        and looks_at?(id) (returns true if looks into the direction of event[id])
# + New things in v1.0:
#     - compatibility with encrypted Projects
#     - possibility to change the Collision-Map folder
#     - New Method: "load_bitmap(bitmap)" (returns the loaded bitmap or nil if it doesnt exist)
#     - Rectangle Size for events
#     - Sprint Script
#     - Bugfix: turn_toward_hero, didn't work well
#     - Bugfix: hero freezed sometimes while a collision with an event
#     - better direction handling at walls
#     - Bugfix: Bushflag/TerrainID, etc. didn't work
#     - Bugfix: some glitches with the isometric feature
#     - fully working Pathfinding
#     - New passable? method for the  Game_Character class(faster!)
#     - Anti Lag Script
#     - better Sliding
#     - New passable? method for the  Game_Map class(faster!)
#     - some changings with the event sizes
#     - New options for the sprint script: you can only sprint for a special time and after this you have to
#       wait some time
#     - Better handling of the event sizes
#     - Improvement of the Caterpillar Script
# + New things in v1.1:
#     - possibility to change the size of the player
#     - Minimap
#     - Bugfix: Bridge Feature -> Things with a high priority are also handled like bridges
#     - Looping Maps
#     - Collision Minimap
#     - Colors for Collision Minimap
#     - Improvement of the sliding
#     - Events on the minimap are moving now, too
#     - Bugfix: Border wasnt disposed while a battle
#     - Caterpillar Script: option to set overlap on/off
#     - Bugfix: Events didnt change their graphic on the Minimap
#     - Bugfix: didnt Slide at the map border
#     - For frame/direction handling of events: can also be set by an array (see below)
#     - Pixel Teleport (moveto(x,y,true) lets you teleport to the exact coords x:y)
#     - "reached_target?"-method for the Game_Character Class, returns true if the Char has reached
#        its target after pathfining (only once and directly after Pathfinding!)
#     - the Map name includes "[Loop-Map]" the map is looped
#     - Option to switch Sliding on/off
# + What is not implemented yet?
#     - Priority Maps -> Well.. help me here, otherwise I possibly wont be able to make this feature..
#     - compatibility with SDK -> seems to be impossible, cause both scripts change too many things, so
#       there is no way to combine them.. maybe the guys who made the SDK can do that.. I dont now..
#     - compatibility with Nears ABS
#     - Fog of War
#     - Jump Part
#     - Ice floor (including two different forms: moving automatically in the faced direction or in the
#        direction of an arrow, etc.. on the ground)
#
#############################################################
#
# Options/Intructions:
#
#
# change this to change the folder were the Collision Maps are saved
$collision_folder = "Graphics/ZPassability/"
# Uses Collision Map for a Tileset or for a Map? - Is Chosen automatically!
$frame_number = 4 # Number of frames
$frame_array = [] # change this Array, if you would like to have a special order for the frames
                          # e.g.: [0,1,2,3] (the length has to be equal to $frame_number!)
$stand_frame = 0 # set to the number of frame which should be used for the standing animation AND
$stand_array = [] # change this Array, if you would like to have a special order for the stand frames
                          # e.g.: [0,1,2,3] (the length has to be equal to $stand_frame!)
# if these frames should not be used for movement.
# 0 means the first frame in the sprite is used both as a stand frame and for the walking animation
# 1 means the first frame is only used as single stand frame, the other frames are used for the walking
# animation
# 2 or more tells the script how many frames it should take for the standing animation (always takes
# the first frames of the sprite), the other frames are used for the walking
# (Note: if you use general RTP-Chars set this option to 0, because the first frame is used both as a
# stand frame and for the walking animation)
#
$isometric = false # set to true for double speed in x-axis (like in an isometric script
#
$direction_number = 4 # 4 = Sprites for 4 directions; 8 = Sprites for 8 directions
# Important: Make your Character Graphics like this: (for 8dir-Sprites)
# 1. Left-Down
# 2. Down
# 3. Right-Down
# 4. Left
# 5. Right
# 6. Left-Up
# 7. Up
# 8. Right-Up
# (= same as the direction-numbers inside the maker)
$direction_array = [] #if you want another order for the directions change this array
                                        # e.g.: [0,1,2,3] (the length has to be equal to $direction_number!)
                                        # (means 0=Down, 1=Left, 2=Right, 3=Up)
#
# Pathfinding:
# $game_player.find_path(x=0,y=0,walk=true,fast=false) -> player walks to position (x,y)
# $game_player.find_event(id=0,walk=true,fast=false) -> player walks to event with id as its event-id
# $game_map.events[id].find_path(x=0,y=0,walk=true,fast=false)
#  -> event with id = id walks to position (x,y)
# $game_map.events[id].find_event(id_find=0,walk=true,fast=false)
#  -> event with id = id walks to the event with id_find as its event-id
# all methods return the route, set walk to false if you dont want the event to walk the route,
# otherwise it will be automatically set to true
# set fast tu true if you would like to use the much faster Pathfinding method
# (Caution! This one only works for simple ways)
#
# Caterpillar:
$cater_activate = true # set to false if you would like to deactivate the caterpillar script..
$cater_distance = 32 # distance between the actors in Pixel
$cater_overlap = true # set to true to let the chars overlap
#
# Event Sizes:
# to define an individual event size for an event just add a comment like this at the beginning of the
# first event page:
# Event_Size:
# XSIZE,YSIZE
# (if there's only one value its taken for both sizes)
# always keep in mind that the sizes dont change if the event turns around
# if you dont add such a comment, the size will be calculated automatically like this:
# y_size = sprite.height/direction_number/6
# x_size = sprite.width/frame_number/6
# (sprite = the whole graphic)
# AND then he takes the bigger value for both sides, so that the event can turn, too..
$player_size = nil #set to a value >0 if you would like to change the player size, yourself, otherwise
#                          the size will be calculated like shown above
#
# Sprint Script:
$sprint_speed = 1 #set higher for a higher Sprint speed, negative values work like a sneak feature,
                           #set to 0 for no change
$sprint_key = Input::A # Key which has to be pressed for sprinting
                                  #(Input::A: Shift, Input::C: Enter, Input::Down: Down Key, Input::B: Esc)
$sprint_time = 50 #time you can sprint in frames
$sprint_wait =  100 #time you have to wait until you can sprint again (set to 0, for no wait time)
#
$minimap = true #set to true to show a minimap
$minimap_pos = 1 #1 = upper left corner, 2 = upper right, 3 = lower left, 4 = lower right
$minimap_width = 160 #width of the minimap
$minimap_height = 120 #height of the minimap
$minimap_scale = 4 #scale of the minimap (8 means 8 times smaller)
$minimap_opacity = 200 # opacity of the minimap
$minimap_collision = false #turn this on if you would like to have a collision minimap instead of a general minimap
$minimap_c_cursor = Color.new(255,0,0) # Color of the cursor on the collision minimap
$minimap_c_pass = Color.new (255,255,255) # Color of passable things on the collision minimap
$minimap_c_n_pass = Color.new(0,0,0) # Color or non-passable things on the collision minimap

#
$loop_maps = [6] #put the ID of the maps you would like to loop in this array, e.g.: $loop_maps = [1,2]
#
$sliding = true #change this to false if you dont want the Hero to slide (at walls/corners)
#
# REMEMBER:
# the general event-commands of the RPG Maker, still work like before, so they give back the old
# coordinates, too and you have to input the general coords (e.g. 19:14 for the lower right corner
# on a 20x15 Map)
#############################################################
  
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
  
  #benötigt für die Autotiles.. (ein Auszug aus:
  #Class Tilemap.
  # By: Fanha Giang
  # ver 1.0def )
  INDEX  =
  [
    26, 27, 32, 33,    4 , 27, 32, 33,    26,   5, 32, 33,      4,   5, 32, 33,    
    26, 27, 32, 11,    4 , 27, 32, 11,    26,   5, 32, 11,      4,   5, 32, 11,    
    26, 27, 10, 33,     4 , 27, 10, 33,    26,   5, 10, 33,    4,   5, 10, 33,
    26, 27, 10, 11,    4 , 27, 10, 11,    26,   5, 10, 11,      4,   5, 10, 11,  
    24, 25, 30, 31,    24,  5, 30, 31,    24, 25, 30, 11,     24,  5, 30, 11,  
    14, 15, 20, 21,     14, 15, 20, 11,   14, 15, 10, 21,     14, 15, 10, 11,
    28, 29, 34, 35,    28, 29, 10, 35,    4, 29, 34, 35,     4, 29, 10, 35,
    38, 39, 44, 45,     4, 39, 44, 45,     38, 5, 44, 45,      4, 5, 44, 45,
    24, 29, 30, 35,    14, 15, 44, 45,    12, 13, 18 ,19,    12, 13, 18, 11,
    16, 17, 22, 23,     16, 17, 10, 23,   40, 41, 46, 47,    4, 41, 46, 47,
    36, 37, 42, 43,     36,  5, 42, 43,    12, 17, 18, 23,    12, 13, 42, 43,
    36, 41, 42, 47,     16, 17, 46, 47,   12, 17, 42, 47,    0, 1, 6, 7
  ]
  X = [0, 1, 0, 1]
  Y = [0, 0, 1, 1]
      
  attr_accessor :pass_pic #Bitmap, in der die Passability-Karte temporär gespeichert wird
  attr_accessor :char_wechsel
  attr_accessor :tileset_name
  attr_accessor :autotile_names

  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @map_id = 0
    @display_x = 0
    @display_y = 0
    @char_wechsel = []
  end
  
  #--------------------------------------------------------------------------
  # * Setup
  #     map_id : map ID
  #--------------------------------------------------------------------------    
  def setup(map_id)
 
    # Put map ID in @map_id memory
    @map_id = map_id
    # Load map from file and set @map
    @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
    # set tile set information in opening instance variables
    tileset = $data_tilesets[@map.tileset_id]
    @tileset_name = tileset.tileset_name
    @autotile_names = tileset.autotile_names
    @panorama_name = tileset.panorama_name
    @panorama_hue = tileset.panorama_hue
    @fog_name = tileset.fog_name
    @fog_hue = tileset.fog_hue
    @fog_opacity = tileset.fog_opacity
    @fog_blend_type = tileset.fog_blend_type
    @fog_zoom = tileset.fog_zoom
    @fog_sx = tileset.fog_sx
    @fog_sy = tileset.fog_sy
    @battleback_name = tileset.battleback_name
    @passages = tileset.passages
    @priorities = tileset.priorities
    @terrain_tags = tileset.terrain_tags
    # Initialize displayed coordinates
    @display_x = 0
    @display_y = 0
    # Clear refresh request flag
    @need_refresh = false
    # Set map event data
    @events = {}
    for i in @map.events.keys
      @events[i] = Game_Event.new(@map_id, @map.events[i])
    end
    # Set common event data
    @common_events = {}
    for i in 1...$data_common_events.size
      @common_events[i] = Game_CommonEvent.new(i)
    end
    # Initialize all fog information
    @fog_ox = 0
    @fog_oy = 0
    @fog_tone = Tone.new(0, 0, 0, 0)
    @fog_tone_target = Tone.new(0, 0, 0, 0)
    @fog_tone_duration = 0
    @fog_opacity_duration = 0
    @fog_opacity_target = 0
    # Initialize scroll information
    @scroll_direction = 2
    @scroll_rest = 0
    @scroll_speed = 4
    
    if ((load_data("Data/MapInfos.rxdata"))[@map_id].name).include?("[Loop-Map]") and
      not $loop_maps.include?(@map_id)
      $loop_maps += [@map_id]
    end
    
    #s.u.
    self.pass_init
      
    #s.u.
    self.event_groessen
      
  end    
  
  def pass_init
  #liest die Passabiltiy-Map in @pass_pic ein (oder alternativ die von Tileset/den Autotiles, bzw. gar nichts)
    @pass_pic= nil
    @pass_pic = load_bitmap($collision_folder + map_id.to_s)
    @pass_type = "Map"
    if @pass_pic == nil
      @pass_pic = []
      @pass_pic[0] = load_bitmap($collision_folder  + @tileset_name)    
      @pass_type = "Tileset"
      if @pass_pic[0] == nil
        @pass_pic == nil
        @pass_type = nil
      else
        @autotile_names.each do |name|
          bitmap = load_bitmap($collision_folder + name)
          if bitmap != nil
            gen_autotiles(@pass_pic.length, bitmap)
          else
            @pass_pic[@pass_pic.length] =  Bitmap.new(32*8, 32*6)
          end
        end
      end
    end
  end
    
  #speichert die Event-Auftrittsflächen ab..
  def event_groessen
    @char_bits = []
    @char_names = []
    
    #Hero
    if $game_party.actors != [] and $game_party.actors[0].character_name != ""
      if $player_size != nil
        $game_player.size["x_size"] = $player_size
        $game_player.size["y_size"] = $player_size
      else
        @char_bits[0] = Bitmap.new(name="Graphics/Characters/"+$game_party.actors[0].character_name)
        bla = [@char_bits[0].width/$frame_number/6, @char_bits[0].height/$direction_number/6].max
        $game_player.size["x_size"] = bla
        $game_player.size["y_size"] = bla
      end
    end
    @char_names[0] = $game_party.actors[0].character_name
    
    #Events
    if @events.keys.length > 0
      @events.keys.each do |id|
        if @events[id].character_name != ""
          @char_bits[id] = Bitmap.new(name="Graphics/Characters/"+@events[id].character_name)
          if @events[id].event.pages[0].list[0].code == 108 and @events[id].event.pages[0].list[0].parameters[0].downcase == "event_size:"
            bla = @events[id].event.pages[0].list[1].parameters[0]
            if not bla.include?(",")
              @events[id].size["x_size"] = bla.to_i/2
              @events[id].size["y_size"] = bla.to_i/2
            else
              bla = bla.split(/,/)
              @events[id].size["x_size"] = bla[0].to_i/2
              @events[id].size["y_size"] = bla[1].to_i/2
            end
          elsif @events[id].event.pages[0].list[1] != nil and (@events[id].event.pages[0].list[1].code == 108 or @events[id].event.pages[0].list[1].code == 408) and @events[id].event.pages[0].list[1].parameters[0].downcase == "event_size:"
            bla = @events[id].event.pages[0].list[2].parameters[0]
            if not bla.include?(",")
              @events[id].size["x_size"] = bla.to_i/2
              @events[id].size["y_size"] = bla.to_i/2
            else
              bla = bla.split(/,/)
              @events[id].size["x_size"] = bla[0].to_i/2
              @events[id].size["y_size"] = bla[1].to_i/2
            end
          elsif @events[id].event.pages[0].list[2] != nil and (@events[id].event.pages[0].list[2].code == 108 or @events[id].event.pages[0].list[2].code == 408) and @events[id].event.pages[0].list[2].parameters[0].downcase == "event_size:"
            bla = @events[id].event.pages[0].list[3].parameters[0]
            if not bla.include?(",")
              @events[id].size["x_size"] = bla.to_i/2
              @events[id].size["y_size"] = bla.to_i/2
            else
              bla = bla.split(/,/)
              @events[id].size["x_size"] = bla[0].to_i/2
              @events[id].size["y_size"] = bla[1].to_i/2
            end
          else
            bla = [@char_bits[id].width/$frame_number/6, @char_bits[id].height/$direction_number/6].max
            @events[id].size["x_size"] = bla
            @events[id].size["y_size"] = bla
          end
        end
        @char_names[id] = @events[id].character_name
      end
    end
    
    @char_bits = []
  end
  
  #generiert die Autotiles.. (ein Auszug aus:
  #Class Tilemap.
  # By: Fanha Giang
  # ver 1.0def )
  def gen_autotiles(id,bitmap)
    scroll = []
    frame = []
    autotile = bitmap
    scroll[id] = 0
    frame[id] = autotile.width / 96
    width = 8 * 32 * frame[id]
    height = 6 * 32
    @pass_pic[id] = Bitmap.new(width, height)  
    for f in 0...frame[id]
      for pos in 0...48
        for corner in [0,1,2,3]
          h = 4 * pos + corner
          yy = INDEX[h] / 6
          xx = INDEX[h] % 6 + f * 6
          y = pos / 8
          x = pos % 8 + f * 8
          src_rect = Rect.new(xx * 16 , yy * 16 , 16, 16 )
          @pass_pic[id].blt(x * 32 + X[corner] * 16, y * 32  + Y[corner] * 16 ,  autotile, src_rect)
        end  # end for corner    
      end      
    end    
  end
      
  #--------------------------------------------------------------------------
  # * Get Width
  #--------------------------------------------------------------------------
  def width
    return @map.width*16
  end
  
  #--------------------------------------------------------------------------
  # * Get Height
  #--------------------------------------------------------------------------
  def height
    return @map.height*16
  end
  
  #--------------------------------------------------------------------------
  # * Get Encounter Steps
  #--------------------------------------------------------------------------
  def encounter_step
    return @map.encounter_step*16
  end
  
  #--------------------------------------------------------------------------
  # * Scroll Down
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  def scroll_down(distance)
    if $loop_maps.include?(@map_id)
      @display_y = @display_y + distance
    else
      @display_y = [@display_y + distance, (self.height/16 - 15) * 128].min
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #     distance : ?????????
  #--------------------------------------------------------------------------
  def scroll_left(distance)
    if $loop_maps.include?(@map_id)
      @display_x = @display_x - distance
    else
      @display_x = [@display_x - distance, 0].max
    end
  end
  #--------------------------------------------------------------------------
  # * Scroll Right
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  def scroll_right(distance)
    if $loop_maps.include?(@map_id)
      @display_x = @display_x + distance
    else
      @display_x = [@display_x + distance, (self.width/16 - 20) * 128].min
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #     distance : ?????????
  #--------------------------------------------------------------------------
  def scroll_up(distance)
    if $loop_maps.include?(@map_id)
      @display_y = @display_y - distance
    else
      @display_y = [@display_y - distance, 0].max
    end
  end
  #--------------------------------------------------------------------------
  # * Determine Valid Coordinates
  #     x          : x-coordinate
  #     y          : y-coordinate
  #--------------------------------------------------------------------------
  def valid?(x, y)
    return ((x >= 0 and x < width-12 and y >= 0 and y < height-14) or $loop_maps.include?(@map_id))
  end
  
  #--------------------------------------------------------------------------
  # * Determine if Passable
  #     x          : x-coordinate
  #     y          : y-coordinate
  #     d          : direction (0,2,4,6,8,10)
  #                  *  0,10 = determine if all directions are impassable
  #     self_event : Self (If event is determined passable)
  #--------------------------------------------------------------------------
  def passable?(x, y, d, self_event = nil)
    # If coordinates given are outside of the map
    unless valid?(x, y)
      # impassable
      return false
    end
 
    # Loop in all events
    for event in events.values
    # If tiles other than self are consistent with coordinates
      if (event != self_event and
        event.x >= x-event.size["x_size"]/2-self_event.size["x_size"]/2-3 and
        event.x <= x+event.size["x_size"]/2+self_event.size["x_size"]/2+3 and  
        event.y >= y-self_event.size["y_size"]/2 and
        event.y <= y+event.size["y_size"]-5) and
        not event.through and (not event.character_name == "" or event.tile_id != 0)
        return false
      end
    end

    #prüft, ob begehbar (+ initialisiert Pixel, die zu prüfen sind)
    if @pass_type == "Map" or @pass_type == "Tileset"
      return pixel_wahl(x,y,d,self_event,@pass_type)
    else
      return true
    end
    
  end
  
  ##wählt Pixel aus
  def pixel_wahl(x,y,d,event,type)
    x_size = event.size["x_size"]
    y_size = event.size["y_size"]
    x = (x+8)*2
    y = (y-2)*2+32
    rand_links =  0
    rand_rechts = 0
    rand_oben = 0
    rand_unten = 0
    
    mal = 0
    
    #setzt die Pixel, die zu prüfen sind, je nach Blickrichtung
    if d==2
      for i in (x-x_size)..(x+x_size-1)
        if i % 2 == 0 and
          ((type == "Map" and self.pass_map(i,y)) or ( type == "Tileset" and self.pass_tileset(i,y)))
          mal += 1
        end    
      end
      if mal > ((x+x_size-1)-(x-x_size))/2
        return true
      end
    end
    if d==4
      for i in (y-y_size/2)..(y)
        if i % 2 == 0 and
          ((type == "Map" and self.pass_map(x-x_size,i)) or ( type == "Tileset" and self.pass_tileset(x-x_size,i)))
          mal += 1
        end    
      end
      if mal > ((y)-(y-y_size/2))/2
        return true
      end
    end
    if d==6
      for i in (y-y_size/2)..(y)
        if i % 2 == 0 and
          ((type == "Map" and self.pass_map(x+x_size-1,i)) or ( type == "Tileset" and self.pass_tileset(x+x_size-1,i)))
          mal += 1
        end    
      end
      if mal > ((y)-(y-y_size/2))/2
        return true
      end
    end
    if d==8
      for i in (x-x_size)..(x+x_size-1)
        if i % 2 == 0 and
          ((type == "Map" and self.pass_map(i,y-y_size/2)) or ( type == "Tileset" and self.pass_tileset(i,y-y_size/2)))
          mal += 1
        end    
      end
      if mal > ((x+x_size-1)-(x-x_size))/2
        return true
      end
    end
    
  end
  
  ##Überprüfung bei Tileset-Passability
  def pass_tileset(x,y)
    if $loop_maps.include?($game_map.map_id)
      if x >= $game_map.width*2
        x -= $game_map.width*2
      elsif x < 0
        x += $game_map.width*2
      end
      if y >= $game_map.height*2
        y -= $game_map.height*2
      elsif y < 0
        y += $game_map.height*2
      end
    end
    layer=0
    passed = []
    empty = 0
    type=0
    x_s = x
    y_s = y
    while layer <= 2
      pruefe = true
      x=x_s
      y=y_s
      pos = self.data[x/32,y/32,layer]
      if pos == nil
        pos = 0
      end
      if pos >= 384  
        pos  -= 384          
        sy = (pos / 8)*32          
        sx = (pos % 8)*32
        x = sx + x%32
        y = sy + y%32
        type=0
      elsif pos >= 48
        type = pos / 48
        pos = pos % 48
        sy = (pos / 8)*32
        sx = (pos % 8)*32
        x = sx + x%32
        y = sy + y%32
      else
        passed[layer] = 1
        empty += 1
        pruefe = false
      end
      
      if pruefe
        pixel = @pass_pic[type].get_pixel(x, y)
        if pixel != Color.new(0, 0, 0)
          passed[layer] = 1
        else
          passed[layer] = 0
        end
      end
      layer+=1
    end
    
    #Alles frei oder Brücke
    if (passed[0] == 1 and passed[1] == 1 and passed[2] == 1) or (passed[0] == 0 and passed[1] == 1 and passed[2] == 1 and ((data[x_s/32, y_s/32, 1] != 0 and @priorities[data[x_s/32, y_s/32, 1]] == 0) or (data[x_s/32, y_s/32, 2] != 0 and @priorities[data[x_s/32, y_s/32, 2]] == 0)) and empty < 2)
      return true
    else
      return false
    end
    
  end
  
  ##Überprüfung bei Map-Passability
  def pass_map(x,y)
    if $loop_maps.include?($game_map.map_id)
      if x >= $game_map.width*2
        x -= $game_map.width*2
      elsif x < 0
        x += $game_map.width*2
      end
      if y >= $game_map.height*2
        y -= $game_map.height*2
      elsif y < 0
        y += $game_map.height*2
      end
    end
    pixel = @pass_pic.get_pixel(x, y)
    if pixel == Color.new(0, 0, 0)
      return false
    else
      return true
    end
  end
  
  #--------------------------------------------------------------------------
  # ? ????
  #     x          : X ??
  #     y          : Y ??
  #--------------------------------------------------------------------------
  def bush?(x, y)
    x = (x+8)/16
    y = (y-4)/16+1
    if @map_id != 0
      for i in [2, 1, 0]
        tile_id = data[x, y, i]
        if tile_id == nil
          return false
        elsif @passages[tile_id] & 0x40 == 0x40
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #     x          : X ??
  #     y          : Y ??
  #--------------------------------------------------------------------------
  def counter?(x, y)
    x = (x+8)/16
    y = (y-4)/16+1
    if @map_id != 0
      for i in [2, 1, 0]
        tile_id = data[x, y, i]
        if tile_id == nil
          return false
        elsif @passages[tile_id] & 0x80 == 0x80
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #     x          : X ??
  #     y          : Y ??
  #--------------------------------------------------------------------------
  def terrain_tag(x, y)
    x = (x+8)/16
    y = (y-4)/16+1
    if @map_id != 0
      for i in [2, 1, 0]
        tile_id = data[x, y, i]
        if tile_id == nil
          return 0
        elsif @terrain_tags[tile_id] > 0
          return @terrain_tags[tile_id]
        end
      end
    end
    return 0
  end
  #--------------------------------------------------------------------------
  # ? ????????? ID ??
  #     x          : X ??
  #     y          : Y ??
  #--------------------------------------------------------------------------
  def check_event(x, y)
    x = (x+8)/16
    y = (y-4)/16+1
    for event in $game_map.events.values
      if event.x == x and event.y == y
        return event.id
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update    
      
    #falls beim speichern das Pass_Pic gelöscht wurde
    if @pass_pic == nil
      self.pass_init
    end
    
    #falls die Grafik eines Events geändert wurde, wird die Größe neubestimmt
    if @char_wechsel != []
      if $scene.is_a?(Scene_Map) and $scene.spriteset != nil and $scene.spriteset.minimap != nil
        $scene.spriteset.minimap.set_chars($scene.spriteset)
      end
      do_it = 0
      @events.keys.each do |id|
        if @char_wechsel.include?(id) and
          ($game_player.x <= @events[id].x-$game_player.size["x_size"] or
          $game_player.x >= @events[id].x+$game_player.size["x_size"] or
          $game_player.y <= @events[id].y-$game_player.size["y_size"] or
          $game_player.y >= @events[id].y+$game_player.size["y_size"])
          do_it +=1
        end
      end
      if do_it == @char_wechsel.length
        self.event_groessen
        @char_wechsel= []
      end
    else
      @events.keys.each do |id|
        if @events[id].character_name  != @char_names[id]
          @char_wechsel+= [id]
        end
      end
    end
    
    # Refresh map if necessary
    if $game_map.need_refresh
      refresh
    end    
    # If scrolling
    if @scroll_rest > 0
      # Change from scroll speed to distance in map coordinates
      distance = 2 ** @scroll_speed
      # Execute scrolling
      case @scroll_direction
      when 2  # Down
        scroll_down(distance)
      when 4  # Left
        scroll_left(distance)
      when 6  # Right
        scroll_right(distance)
      when 8  # Up
        scroll_up(distance)
      end
      # Subtract distance scrolled
      @scroll_rest -= distance
    end
    # Update map event
    for event in @events.values
      event.update
    end
    # Update common event
    for common_event in @common_events.values
      common_event.update
    end
    # Manage fog scrolling
    @fog_ox -= @fog_sx / 8.0
    @fog_oy -= @fog_sy / 8.0
    # Manage change in fog color tone
    if @fog_tone_duration >= 1
      d = @fog_tone_duration
      target = @fog_tone_target
      @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
      @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
      @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
      @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
      @fog_tone_duration -= 1
    end
    # Manage change in fog opacity level
    if @fog_opacity_duration >= 1
      d = @fog_opacity_duration
      @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
      @fog_opacity_duration -= 1
    end
  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   :x                        # map x-coordinate (logical)
  attr_accessor   :y                        # map y-coordinate (logical)
  attr_accessor   :stop_count
  attr_accessor   :direction
  attr_accessor   :trigger_on
  attr_accessor   :event
  attr_accessor   :sprint
  attr_accessor   :move_speed
  attr_accessor   :opacity
  attr_accessor   :walk_anime
  attr_accessor   :size
  attr_accessor   :step_anime
      
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @id = 0
    @x = 0
    @y = 0
    @real_x = 0
    @real_y = 0
    @tile_id = 0
    @character_name = ""
    @character_hue = 0
    @opacity = 255
    @blend_type = 0
    @direction = 2
    @pattern = 0
    @move_route_forcing = false
    @through = false
    @animation_id = 0
    @transparent = false
    @original_direction = 2
    @original_pattern = 0
    @move_type = 0
    @move_speed = 4
    @move_frequency = 6
    @move_route = nil
    @move_route_index = 0
    @original_move_route = nil
    @original_move_route_index = 0
    @walk_anime = true
    @step_anime = false
    @direction_fix = false
    @always_on_top = false
    @anime_count = 0
    @stop_count = 0
    @jump_count = 0
    @jump_peak = 0
    @wait_count = 0
    @locked = false
    @prelock_direction = 0
    
    #Neues:
    @schritte_gemacht = 0
    @schritte_zaehl=0
    @old_speed = @move_speed
    @walk = false
    @go_path = 0
    @trigger_on = 0
    @sprint = false
    @sprint_time = 0
    @size = {
      "x_size" => 16,
      "y_size" => 16
      }
    @no_slide = 0
    @weg = nil
  end
  
  #--------------------------------------------------------------------------
  # * Determine if Moving
  #--------------------------------------------------------------------------
  def moving?
    return (@real_x != @x*8 or @real_y != @y*8)
  end
 
  #--------------------------------------------------------------------------
  # * Determine if Passable
  #     x : x-coordinate
  #     y : y-coordinate
  #     d : direction (0,2,4,6,8)
  #         * 0 = Determines if all directions are impassable (for jumping)
  #--------------------------------------------------------------------------
  def passable?(x, y, d,steps=32)
    # Get new coordinates
    if $isometric
      steps_x = steps
    else
      steps_x = steps/2
    end
    steps_y = steps/2
    new_x = x + (d == 1 ? -steps_x : d == 3 ? steps_x : d == 7 ? -steps_x : d == 9 ? steps_x : d == 6 ? steps_x : d == 4 ? -steps_x : 0)
    new_y = y + (d == 1 ? steps_y : d == 3 ? steps_y : d == 7 ? -steps_y : d == 9 ? -steps_y : d == 2 ? steps_y : d == 8 ? -steps_y : 0)
    # If coordinates are outside of map
    unless $game_map.valid?(new_x, new_y)
      # impassable
      return false
    end
    # If through is ON
    if @through
      # passable
      return true
    end
    #prüft den Weg zur neuen Position auf Begehbarkeit
    help_x = new_x
    help_y = new_y
    zahl = 0
    if d== 1
      y+=1
      x-=1
      while (help_y >= y) and (help_x <= x) and ($game_map.passable?(help_x,help_y,2,self)) and ($game_map.passable?(help_x,help_y,4,self))
        zahl += 8
        help_y -= 8
        help_x += 8
      end
      if zahl < new_y-y+1 and zahl < x-new_x+1
        return false
      end
    elsif d==2
      y+=1
      while (help_y >= y) and ($game_map.passable?(help_x,help_y,d,self))
        zahl += 8
        help_y -= 8
      end
      if zahl < new_y-y+1
        return false
      end
    elsif d== 3
      y+=1
      x+=1
      while (help_y >= y) and (help_x >= x) and ($game_map.passable?(help_x,help_y,2,self)) and ($game_map.passable?(help_x,help_y,6,self))
        zahl += 8
        help_y -= 8
        help_x -= 8
      end
      if zahl < new_y-y+1 and zahl < new_x-x+1
        return false
      end
    elsif d==4
      x-=1
      while (help_x <= x) and ($game_map.passable?(help_x,help_y,d,self))
        zahl += 8
        help_x += 8
      end
      if zahl < x-new_x+1
        return false
      end
    elsif d==6
      x+=1
      while (help_x >= x) and ($game_map.passable?(help_x,help_y,d,self))
        zahl += 8
        help_x -= 8
      end
      if zahl < new_x-x+1
        return false
      end
    elsif d== 7
      y-=1
      x-=1
      while (help_y <= y) and (help_x <= x) and ($game_map.passable?(help_x,help_y,8,self)) and ($game_map.passable?(help_x,help_y,4,self))
        zahl += 8
        help_y += 8
        help_x += 8
      end
      if zahl < y-new_y+1 and zahl < x-new_x+1
        return false
      end
    elsif d==8
      y-=1
      while (help_y <= y) and ($game_map.passable?(help_x,help_y,d,self))
        zahl += 8
        help_y += 8
      end
      if zahl < y-new_y+1
        return false
      end
    elsif d== 9
      y-=1
      x+=1
      while (help_y <= y) and (help_x >= x) and ($game_map.passable?(help_x,help_y,8,self)) and ($game_map.passable?(help_x,help_y,6,self))
        zahl += 8
        help_y += 8
        help_x -= 8
      end
      if zahl < y-new_y+1 and zahl < new_x-x+1
        return false
      end
    end
    # Loop all events
    for event in $game_map.events.values
      # If event coordinates are consistent with move destination
      if event.x >= new_x-event.size["x_size"]/2-self.size["x_size"]/2-3 and
        event.x <= new_x+event.size["x_size"]/2+self.size["x_size"]/2+3 and  
        event.y >= new_y-self.size["y_size"]/2 and
        event.y <= new_y+event.size["y_size"]-5 and
        event != self and event.character_name != ""
        # If through is OFF
        unless event.through
          # If self is event
          if self != $game_player
            # impassable
            return false
          end
          # With self as the player and partner graphic as character
          if event.character_name != ""
            # impassable
            return false
          end
        end
      end
    end
    # If player coordinates are consistent with move destination
    if self != $game_player and not self.is_a?(Game_Party_Actor)
      $game_player.x >= new_x-$game_player.size["x_size"]/2-$game_map.events[@id].size["x_size"]/2-3 and
      $game_player.x <= new_x+$game_player.size["x_size"]/2+$game_map.events[@id].size["x_size"]/2+3 and  
      $game_player.y >= new_y-$game_map.events[@id].size["y_size"]+5 and
      $game_player.y <= new_y+$game_player.size["y_size"]-5 and
      # If through is OFF
      unless $game_player.through
        # If your own graphic is the character
        if @character_name != ""
          # impassable
          return false
        end
      end
    end
    # passable
    return true
  end
  
  #--------------------------------------------------------------------------
  # * Move to Designated Position
  #     x : x-coordinate
  #     y : y-coordinate
  #--------------------------------------------------------------------------
  def moveto(x, y, px=false)
    if not px
      @x = x % $game_map.width * 16
      @y = y % $game_map.height * 16
    else
      @x = x/2 % $game_map.width
      @y = y/2 % $game_map.height
    end
    @real_x = @x * 8
    @real_y = @y * 8
    @prelock_direction = 0
  end
end




# ** Game_Character (part 2)
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    
    if $loop_maps.include?($game_map.map_id)
      if not self.is_a?(Game_Party_Actor)
        if self == $game_player and $scene.is_a?(Scene_Map) and $scene.spriteset != nil and $scene.spriteset.game_party_actors != nil
          $scene.spriteset.game_party_actors.each do |actor|
            if $game_player.x > $game_map.width
              actor.x -= $game_map.width
              actor.real_x = (actor.x)*8
            elsif $game_player.x < 0
              actor.x += $game_map.width
              actor.real_x = (actor.x)*8
            end
            if $game_player.y > $game_map.height
              actor.y -= $game_map.height
              actor.real_y = (actor.y)*8
            elsif $game_player.y < 0
              actor.y += $game_map.height
              actor.real_y = (actor.y)*8
            end
          end
        end
        if @x > $game_map.width
          @x -= $game_map.width
          @real_x = (@x)*8
        elsif @x < 0
          @x += $game_map.width
          @real_x = (@x)*8
        end
        if @y > $game_map.height
          @y -= $game_map.height
          @real_y = (@y)*8
        elsif @y < 0
          @y += $game_map.height
          @real_y = (@y)*8
        end
      end
    else
      if @x < 0
        @x = 0
      end
      if @y < 0
        @y = 0
      end
    end
    
    if not @through and self.moving?
      self.check_event_trigger_touch(@x, @y)
    end
    
    #läuft, falls Pathfinding eine Route ausgegeben hat
    if @go_path > 0
      if not self.moving?
        if @weg.path.length > 0
          if @move_speed>=4
            ((@go_path**(@move_speed-2))/@go_path).times do
              if @weg.path[0] != nil
                @direction = @weg.path[0]
                @weg.path.delete_at(0)
                self.move_forward(@go_path)
              end
            end
          else
            @direction = @weg.path[0]
            @weg.path.delete_at(0)
            self.move_forward(@go_path)
          end
        else
          @weg = nil
          @go_path = 0
        end
      end
    end
    
    # ????????????????
    if jumping?
      update_jump
    elsif moving?
      update_move
    else
      update_stop
    end
    
    # ?????????????????
    # ????????? 18 ?????? * 1 ?????
    if @anime_count > (


_________________
Bild


Zuletzt geändert von Sveniboy am Sa Aug 19, 2006 22:30, insgesamt 3-mal geändert.

Nach oben
 Profil  
Mit Zitat antworten  
Offline
Official Oldschool
Official Oldschool
Benutzeravatar
Beiträge: 8917
Alter: 30
Wohnort: BRD, Thüringen
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 22:26 
Da fehlt die Hälfte. Musst Doppelposts machen. So große Posts sind in dem Forum nich möglich.

_________________


Nach oben
 Profil ICQ  
Mit Zitat antworten  
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 449
Alter: 28
Wohnort: Deutschland
 Betreff des Beitrags:
BeitragVerfasst: Sa Aug 19, 2006 22:34 
ohh das ist so viel da bracu ich 4 fach post ode rmehr, ichg lade mal die txt datei hoch, momen...


EDIT:

http://rapidshare.de/files/30029428/Pix ... t.txt.html


mfg
Sven

_________________
Bild


Nach oben
 Profil  
Mit Zitat antworten  
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 435
 Betreff des Beitrags:
BeitragVerfasst: Mi Aug 23, 2006 17:41 
Ich will nicht behaupten es wäre unmöglich, aber um diese beiden Scripte zusammenzuschmelzen bräuchte man eine gute Portion Rubykenntnisse und viel Motivation. Ich habe beides nicht. :D

_________________
Bild Bild Bild Bild Bild


Nach oben
 Profil  
Mit Zitat antworten  
Offline
Gnu-Hirte
Gnu-Hirte
Benutzeravatar
Beiträge: 484
Alter: 13
 Betreff des Beitrags:
BeitragVerfasst: Fr Aug 25, 2006 12:26 
Zitat:
Sveniboy  
Beitrag Verfasst am: Sa Aug 19, 2006 22:34    Titel:
ohh das ist so viel da bracu ich 4 fach post ode rmehr, ichg lade mal die txt datei hoch, momen...


EDIT:

http://rapidshare.de/files/30029428/Pix ... t.txt.html


mfg
Sven



Bei mir rennt der mit dem Script durchs Wasser wie stellt man des ab? O.o

_________________
http://edenproject.de

Edens gona Mad!


Nach oben
 Profil YIM  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 19 Beiträge ]  Gehe zu Seite 1, 2  Nächste

Alle Zeiten sind UTC + 1 Stunde


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de