• Anmelden

1

Sonntag, 9. Januar 2011, 21:18

Animation Script (neu)?

Servus..

Also, direkt zur Sache.

Für mein AKS benutze ich solche Animationen:
Bild
Alternativ: http://imagesload.net/img/Dustin_Schlaganimation_a.png

Die Anzahl der frames variiert, ebenso die Größe der Grafiken (jeder frame ist dennoch gleich groß).


Ich brauch hierführ nun ein Script, das wie folgt funktioniert:

1.) Einfacher Aufruf mit folgenden parametern: Dateiname, Framezahl, id, Wartezeit zwischen Frames, offset_x, offset_y
2.) Held zu Animationsbeginn ausblenden und $no_ani auf TRUE setzen.
3.) Animation je nach heldenblickrichtung nehmen
4.) Animation auf der Position des Helden abspielen (korrigierbar durch offset_x/y), und mit dem Helden mitbewegen (WICHTIG!)
5.) Nach Animationsende den Held wieder anzeigen und $no_ani auf FALSE setzen.


Das ganze sollte möglichst Performanceschonend ablaufen.
Zudem MUSS die Animation auf Z Höhe des Spielers laufen.. d.h. auch von tiles verdeckt werden können.


Ich hoffe das mir da wer helfen kann :espér:
There was a Cave,
below a Silent's Grave.
Tunnels, extending far, running wide,
going deep into the World on the other Side.
Poor little Child, that was to brave,
died painfully deep down, in the Devil's Cave.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Chaosgod Espér« (18. Januar 2011, 13:36)


2

Sonntag, 16. Januar 2011, 14:24

traut sich da echt keiner ran?
There was a Cave,
below a Silent's Grave.
Tunnels, extending far, running wide,
going deep into the World on the other Side.
Poor little Child, that was to brave,
died painfully deep down, in the Devil's Cave.

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

3

Sonntag, 16. Januar 2011, 15:08

Spoiler

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# $game_player.esper_animate(filename, frames, wait, x, y)
 
class Game_Character
 
  attr_accessor :esper_animation
 
  alias_method :esper_alias_game_char_initialize_animation, :initialize
  def initialize
    @esper_animation = nil
    @esper_animation_wait = 0
    @esper_animation_memory = nil
    esper_alias_game_char_initialize_animation
  end
 
  alias_method :esper_alias_game_char_update_animation, :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 !$no_ani
      # If stop animation is ON when moving
      else
        # Update pattern
        @pattern = (@pattern + 1) % 4
      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
 
    if @esper_animation != nil
      update_esper_animation(*@esper_animation)
    end
  end
 
  def update_esper_animation(filename, frames, wait, x, y)
    @esper_animation_wait += 1
    if wait <= @esper_animation_wait
      @esper_animation_wait = 0
      @pattern += 1
      if @pattern >= frames
        @character_name = @esper_animation_memory[0]
        @walk_anime = @esper_animation_memory[1]
        @step_anime = @esper_animation_memory[2]
        @esper_animation = nil
        @esper_animation_memory = nil
        $no_ani = false
        @pattern = 0
      end
    end
  end
end
 
class Game_Player
  def esper_animate(filename, frames, wait, x, y)
    @esper_animation_memory = [@character_name, @walk_anime, @step_anime]
    @character_name = filename
    @walk_anime = @step_anime = false
    @esper_animation = [filename, frames, wait, x, y]
    $no_ani = true
  end
end
 
class Sprite_Character
  def update
    super
    esper_anirun = ($no_ani && @character == $game_player)
    # 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)
        @cw = bitmap.width / (esper_anirun ? @character.esper_animation[1] : 4)
        @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
    if esper_anirun
      self.x += @character.esper_animation[3]
      self.y += @character.esper_animation[4]
    end
    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
zum Lesen den Text mit der Maus markieren
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

4

Dienstag, 18. Januar 2011, 13:41

k.. soweit ganz gut..

Nur.. wenn der held sich paralell bewegt, wartet die animation erst bis die bewegung vorbei ist..
Es sollte aber paralell laufen ^^

Btw.. bräuchte ich das auch so, das es für Event funktioniert.. Also nicht nur für den spieler ^^

Meinst das geht?


Edit.. kleiner Bug..:
Wenn man zu oft startet.. bleibt die Grafik hängen.. und der Spieler hat ne Standpose mit dem Schwert xD
There was a Cave,
below a Silent's Grave.
Tunnels, extending far, running wide,
going deep into the World on the other Side.
Poor little Child, that was to brave,
died painfully deep down, in the Devil's Cave.

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

5

Dienstag, 18. Januar 2011, 15:16

Hast dus mal in einem leeren Projekt getestet?
Bei mir gehts nämlich :/

Für die Events sollte es reichen, wenn du

Ruby Quellcode

1
2
3
end
 
class Game_Player

löscht.
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

6

Dienstag, 18. Januar 2011, 16:33

ja.. selbes spiel.. er läuft.. und dann erst die animation (auch wennd er eventcode andersrum ist)..
Und halt das prob mit der stehenden animation wenns zu oft startet..
There was a Cave,
below a Silent's Grave.
Tunnels, extending far, running wide,
going deep into the World on the other Side.
Poor little Child, that was to brave,
died painfully deep down, in the Devil's Cave.

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

7

Dienstag, 18. Januar 2011, 16:47

Entweder verstehe ich dich falsch oder ich hab keins von beidem hier :/
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

8

Dienstag, 18. Januar 2011, 19:10

Ok.. das prob mit der standgrafik war mein fehler.. vergessen den schalter abzufragen..

Das prob mit der bewegung:
Bild

Das mein testevent.. Ich hab auch schonmal Call Script und Move_Route vertauscht.. beides das selbe ergebnis..
Animation steht still, solange der Spieler sich bewegt..


Was des mit Events angeht.. Wie soll ich des umscripten, sodass es für Event und Spieler gleichermaßen geht( er brauch ja ID oder?)
There was a Cave,
below a Silent's Grave.
Tunnels, extending far, running wide,
going deep into the World on the other Side.
Poor little Child, that was to brave,
died painfully deep down, in the Devil's Cave.

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

9

Dienstag, 18. Januar 2011, 23:49

Spoiler

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# esper_animate(eventid (-1 = player), filename, frames, wait, x, y)
# $game_player.esper_animate(filename, frames, wait, x, y)
# $game_events[eventid].esper_animate(filename, frames, wait, x, y)
 
class Interpreter
  def esper_animate(id, *args)
    (id == -1 ? $game_player : $game_map.events[id]).esper_animate(*args)
  end
end
 
class Game_Character
 
  attr_accessor :esper_animation
 
  alias_method :esper_alias_game_char_initialize_animation, :initialize
  def initialize
    @esper_animation = nil
    @esper_animation_wait = 0
    @esper_animation_memory = nil
    esper_alias_game_char_initialize_animation
  end
 
  alias_method :esper_alias_game_char_update_animation, :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 !$no_ani
      # If stop animation is ON when moving
      else
        # Update pattern
        @pattern = (@pattern + 1) % 4
      end
      # Clear animation count
      @anime_count = 0
    end
 
    if @esper_animation != nil
      update_esper_animation(*@esper_animation)
    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
 
  def update_esper_animation(filename, frames, wait, x, y)
    @esper_animation_wait += 1
    if wait <= @esper_animation_wait
      @esper_animation_wait = 0
      @pattern += 1
      if @pattern >= frames
        @character_name = @esper_animation_memory[0]
        @walk_anime = @esper_animation_memory[1]
        @step_anime = @esper_animation_memory[2]
        @esper_animation = nil
        @esper_animation_memory = nil
        $no_ani = false
        @pattern = 0
      end
    end
  end
 
  def esper_animate(filename, frames, wait, x, y)
    @esper_animation_memory = [@character_name, @walk_anime, @step_anime]
    @character_name = filename
    @walk_anime = @step_anime = false
    @esper_animation = [filename, frames, wait, x, y]
    $no_ani = true
  end
end
 
class Sprite_Character
  def update
    super
    esper_anirun = !@character.esper_animation.nil?
    # 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)
        @cw = bitmap.width / (esper_anirun ? @character.esper_animation[1] : 4)
        @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
    if esper_anirun
      self.x += @character.esper_animation[3]
      self.y += @character.esper_animation[4]
    end
    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
zum Lesen den Text mit der Maus markieren
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

10

Mittwoch, 19. Januar 2011, 16:20

Super.. funzt ^^

THX NEO!!!!

(darf ich mich bei dir melden falls es was gibt?)
There was a Cave,
below a Silent's Grave.
Tunnels, extending far, running wide,
going deep into the World on the other Side.
Poor little Child, that was to brave,
died painfully deep down, in the Devil's Cave.

Neo-Bahamut

Himmelsgleicher

Motto: Wer anderen eine Bratwurst brät, der hat ein Bratwurstbratgerät.

  • Nachricht senden

11

Mittwoch, 19. Januar 2011, 19:59

Zitat

(darf ich mich bei dir melden falls es was gibt?)

Wenn es um dieses Skript geht, darfst du dich hier melden ;)
Wenn ich dann nicht antworte, erteile ich dir ausnahmsweise die Erlaubnis, mit einer Supportanfrage-PN zu schicken :0
(omg, that never happened in the history of history)
Spoiler: Wurstinator
zum Lesen den Text mit der Maus markieren

Spoiler: Lazer-Wurst
zum Lesen den Text mit der Maus markieren

Spoiler: Hallowurst
zum Lesen den Text mit der Maus markieren

Social Bookmarks