• Anmelden

Irrlicht

Leuchtendes Irgendwas

Motto: Keep shining!

  • Nachricht senden

21

Samstag, 22. Januar 2011, 20:50

Huhu,
das Script ist zunächst so eingestellt dass ab Spielstart alle in der Database eingestellten Actors auswählbar sind.

Um zu definieren dass nur Actor 5 auswählbar sein soll kannst du aber z.B.

Ruby Quellcode

1
$game_temp.selectable_actors = [5]

als Scriptbefehl verwenden.

22

Samstag, 22. Januar 2011, 21:23

Ich meine 5 Actors und ich hab ein Script gemacht dass ich 5 Actors auswählen kann und will machen dass ich während der Story weitere bekomme und will aber dass man bei Neustart nicht alle Actors auswählen kann sondern nur die die man schon bekommen hat wie muss ich das machen?

Irrlicht

Leuchtendes Irgendwas

Motto: Keep shining!

  • Nachricht senden

23

Sonntag, 23. Januar 2011, 12:24

Um die am Anfang bestehende Liste komplett zu leeren kannst du z.B.

Ruby Quellcode

1
$game_temp.selectable_actors.clear

verwenden. Anschließend brauchst du die Liste nur noch mit den ausgewählten Actors neu zu füllen:


Um einen Actor zu der Liste hinzuzufügen bräuchtest du nur den bereits von Playm geposteten Befehl zu verwenden:

Ruby Quellcode

1
2
sa = $game_temp.selectable_actors
sa += [5]

würde hier z.B. die Auswahl um den Actor 5 erweitern.


(Wobei ich allerdings im Moment etwas im Zweifel bin ob ich dich richtig verstanden habe...)

24

Sonntag, 23. Januar 2011, 13:10

Ich hab das gemacht aber wenn ich das Spiel neu starte kann ich wieder alle Actor auswählen. Ich möchte aber dass nicht mehr bei neustart alle Actors wieder auswählbar sind.

Irrlicht

Leuchtendes Irgendwas

Motto: Keep shining!

  • Nachricht senden

25

Sonntag, 23. Januar 2011, 13:23

Achso

Ohne es getestet zu haben da mein Maker gerade nicht funktioniert:
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#//////////////////////////////////////////Teamwechsel//////////////////////////////////////
#~~~~~~~~~~~~~~~~~~~~by Caesar~~~~~~~~~~~~~~~~~
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
class Scene_Party
  def main
    @left = $game_party.actors.collect { |actor| actor.id}
    @right = $game_system.selectable_actors - $game_party.actors.collect{|i| i.id}
    @window_actor = Window_ActorInfo.new
    @help_window = Window_Help.new
    @help_window.set_text(remove_actor_text, 1)
    @window_left = Window_Command.new(320, @left.collect{
        |i| $data_actors[i].name})
    @window_left.y = 64
    @window_left.height = 268
    @window_right = Window_Command.new(320, @right.collect{
        |i| $data_actors[i].name})
    @window_right.x = 320
    @window_right.y = 64
    @window_right.height = 268
    set_inactive(@window_right)
    @old_index = -1
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break unless $scene == self
    end
    Graphics.freeze
    @window_actor.dispose
    @help_window.dispose
    @window_left.dispose
    @window_right.dispose
  end
  #---------------
  def update
    @window_actor.update
    @help_window.update
    @window_left.update
    @window_right.update
    #::::::::::::::
    if Input.trigger?(Input::B)
      if @left.size <= 0
        $game_system.se_play($data_system.buzzer_se)
        @help_window.set_text(no_actors_text, 1)
      elsif @left.size > 4
        $game_system.se_play($data_system.buzzer_se)
        @help_window.set_text(too_many_actors_text, 1)
      else
        $game_party.actors.clear
        @left.each {|i| $game_party.add_actor(i)}
        $game_system.se_play($data_system.cancel_se)
        $scene = Scene_Map.new
      end
    end
    #:::::::::::::::::
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      if @window_left.active
        @right.push(@left.delete_at(@window_left.index))
        @old_index = -1
        if @left.size <= 0
          @help_window.set_text(remove_actor_text, 1)
          set_inactive(@window_left)
          set_active(@window_right)
        end
      else
        @left.push(@right.delete_at(@window_right.index))
        @old_index = -1
        if @right.size <= 0
          @help_window.set_text(add_actor_text, 1)
          set_inactive(@window_right)
          set_active(@window_left)
        end
      end
      @window_left.commands = @left.collect{|i| $data_actors[i].name}
      @window_right.commands = @right.collect{|i| $data_actors[i].name}
    end
    #::::::::::::::::::
    if Input.trigger?(Input::LEFT) and @window_right.active
      if @left.size > 0
        @old_index = -1
        @help_window.set_text(remove_actor_text, 1)
        $game_system.se_play($data_system.cursor_se)
        set_inactive(@window_right)
        set_active(@window_left)
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
    #:::::::::::::::::
    if Input.trigger?(Input::RIGHT) and @window_left.active
      if @right.size > 0
        @old_index = -1
        @help_window.set_text(add_actor_text, 1)
        $game_system.se_play($data_system.cursor_se)
        set_inactive(@window_left)
        set_active(@window_right)
      else
        $game_system.se_play($data_system.buzzer_se)
      end
    end
    #::::::::::::::::::
    if Input.repeat?(Input::L) and @window_left.active
      @left.swap_up!(@window_left.index)
      @window_left.swap_up
    end
    #::::::::::::::::::
    if Input.repeat?(Input::R) and @window_left.active
      @left.swap_down!(@window_left.index)
      @window_left.swap_down
    end
    #::::::::::::::::::
    index = @window_left.active ? @window_left.index : @window_right.index
    if index != @old_index
      @old_index = index
      update_actor_info
    end
  end
  #--------------------
  def update_actor_info
    if @window_left.active
      index = @window_left.index
      @window_actor.actor = $game_actors[@left[index]] if index != -1
    else
      index = @window_right.index
      @window_actor.actor = $game_actors[@right[index]] if index != -1
    end
  end
  #--------------------
  def set_active(window)
    window.active = true
    window.opacity = 255
    window.contents_opacity = 255
  end
  #--------------------
  def set_inactive(window)
    window.active = false
    window.opacity = 160
    window.contents_opacity = 160
  end
  #--------------------
  def add_actor_text
    "Helden dem Team hinzufügen"
  end
  #--------------------
  def remove_actor_text
    "Helden aus dem Team entfernen"
  end
  #--------------------
  def too_many_actors_text
    "Es sind zu viele Helden im Team!"
  end
  #--------------------
  def no_actors_text
    "Im Team muss sich mindestens ein Held befinden!"
  end
end
#==================
class Window_ActorInfo < Window_Base
  attr_reader :actor
  #----------------
  def initialize(actor=nil)
    super(0, 332, 640, 148)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #-----------------
  def refresh
    self.contents.clear
    return if @actor.nil?
    x = 140
    draw_actor_graphic(@actor, x - 40, 80)
    draw_actor_name(@actor, x, 0)
    draw_actor_class(@actor, x + 144, 0)
    draw_actor_level(@actor, x, 32)
    draw_actor_state(@actor, x + 90, 32)
    draw_actor_exp(@actor, x, 64)
    draw_actor_hp(@actor, x + 236, 32)
    draw_actor_sp(@actor, x + 236, 64)
  end
  #-----------------
  def actor=(actor)
    @actor = actor
    refresh
  end
end
#=========================
class Window_Command < Window_Selectable
  attr_reader :commands
  #--------------
  def commands=(commands)
    if commands.size != @commands.size
      @item_max = commands.size
      self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
      @index -= 1 if @index >= @item_max
      @index = 0 if @item_max == 1
    end
    @commands = commands
    refresh
  end
  #---------------
  def swap_up
    $game_system.se_play($data_system.cursor_se)
    @commands = @commands.swap_up(@index)
    if @index > 0
      @index -= 1
      refresh
    end
  end
  #-----------------
  def swap_down
    $game_system.se_play($data_system.cursor_se)
    @commands = @commands.swap_down(@index)
    if @index < @commands.size-1
      @index += 1
      refresh
    end
  end
end
#========================
class Array
  def swap_up(index)
    arr = dup
    return arr unless index > 0
    arr[index] = self[index-1]
    arr[index-1] = self[index]
    return arr
  end
  #------------------
  def swap_down(index)
    arr = dup
    return arr unless index < size-1
    arr[index] = self[index+1]
    arr[index+1] = self[index]
    return arr
  end
  #----------------
  def swap_up!(index)
    return unless index > 0
    temp = self[index]
    self[index] = self[index-1]
    self[index-1] = temp
  end
  #----------------
  def swap_down!(index)
    return unless index < size-1
    temp = self[index]
    self[index] = self[index+1]
    self[index+1] = temp
  end
end
#========================
class Game_System
  attr_accessor :selectable_actors
  #--------------
  alias actors_init initialize
  def initialize
    actors_init
    @selectable_actors = (1...$data_actors.size).to_a
  end
end
zum Lesen den Text mit der Maus markieren

In dieser Fassung müsstest du allerdings auch im Call-Script immer anstatt
$game_temp.selectable_actors
$game_system.selectable_actors

verwenden.

26

Sonntag, 23. Januar 2011, 14:55

Ich hab das versucht aber die Actors sind trotz $game_system.selectable_actors alle noch auswählbar. Also es ist wie wenn nichts passiert bei diesem Script

Yuber

Seher

Motto: Die Welt zu beherrschen.

  • Nachricht senden

27

Sonntag, 23. Januar 2011, 15:09

Pack die Scripts doch mal in ein neues Projekt und lad es hoch. Dann kann man besser und schneller gucken wo der Fehler liegt =)
Nur noch selten hier.

'Til now, I always let people walk all over me!
From now on, if anyone makes fun of me, I'll kill 'em! Just like that!

Ähnliche Themen

Social Bookmarks