• Anmelden

lucien

Schaffender

  • »lucien« ist der Autor dieses Themas

Motto: California potato power! Ketchup rains all over the world.

  • Nachricht senden

1

Mittwoch, 30. August 2006, 14:38

Mit

@image = Sprite.new
@image.bitmap = RPG::Cache.picture("bild")

konnte ich während des Kampfes ein Bild anzeigen lassen.

Nun schaffe ich es aber nicht, das Bild wieder verschwinden zu lassen.

@image.dispose löst eine Fehlermeldung aus. Und zwar: undefined method "dispose" for nil:Nil:class

hab den Befehl im ce und auch im script probiert. Aber nichts klappt.
Hat jemdand einen Vorschlag?

2

Mittwoch, 30. August 2006, 16:00

NilClass...
Dann darfst du keine Lokalvariabel benutzen. Eine Variabel mit einem "@" ist von anderen Skripten aus nicht erreichbar (außer halt mit attr_reader). Am besten du schreibst noch mal genau, wann und wo du das Bild anzeigen lässt und wann du es wieder löschen willst.

Mfg Monsta

lucien

Schaffender

  • »lucien« ist der Autor dieses Themas

Motto: California potato power! Ketchup rains all over the world.

  • Nachricht senden

3

Mittwoch, 30. August 2006, 17:16

Ok. Ist im Cybersam KS. Hier der Ausschnitt des skripts. hab auch angegeben, wo das Bild gelöscht werden soll.

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
// 
 
 
#--------------------------------------------------------------------------
  # skill aktion...
  #--------------------------------------------------------------------------
  def make_skill_action_result
 
    @skill = $data_skills[@active_battler.current_action.skill_id]
    unless @active_battler.current_action.forcing
      unless @active_battler.skill_can_use?(@skill.id)
        $game_temp.forcing_battler = nil
        @phase4_step = 1
        return
      end
    end
    @active_battler.sp -= @skill.sp_cost
    @status_window.refresh
 
    @enemy_window.refresh
 
 
    @help_window.set_text(@skill.name, 1)
 
#===============================================================================
# SKILL SPRITES START
#===============================================================================
# this one is the same as the one for the weapons...
# for the one who have this for the first time
# look at the script i hope it is easy to understand...
# 
# the other one that have the earlier versions of this script they dont need explenation
# ... i think....
 
# the think that changed is the line where the animation ID is given to the sprite...
# the number after the "pose" is the animation ID... it goes for every other animation as well..
# if you have an animation for a skill that have more frames... 
# then just insert the number of frames after the first number...
# so it looks like this.... "pose(5, 8)" <-- 5 is the animation... 
# 8 is the max frame (that means your animation have 8 frames...) ^-^
 
      if @active_battler.is_a?(Game_Actor)
      if @skill.name == "Feuer" # <-- first skill name
        @spriteset.actor_sprites[@active_battler.index].pose(5) # <-- sprite number
        elsif @skill.name == "Himmelsfaust" # <-- third skill name
        @spriteset.actor_sprites[@active_battler.index].pose(8) # <-- sprite number
       [B] @image = Sprite.new
            @image.bitmap = RPG::Cache.picture("bild")[/B]
 
      end
    else
      if @skill.name == "Feuer" # <-- first skill name
        @spriteset.enemy_sprites[@active_battler.index].enemy_pose(5) # <-- sprite number
 
      end
 
    end
#===============================================================================
# SKILL SPRITES END
#===============================================================================
 
 
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    @common_event_id = @skill.common_event_id
 
[B]hier Bild löschen[/B]
 
    set_target_battlers(@skill.scope)
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
 
  end

4

Mittwoch, 30. August 2006, 18:34

Ich glaube das liegt nicht am Zugriff sondern an der Erstellung, das bild wird nur erstellt wenn 2 if-anweisungen erfüllt sind. Aber gelöscht wird es immer.

Einfach das so schreiben

Quellcode

1
2
3
4
5
if @image != nil and @image.is_a?(Sprite) and @image.bitmap.disposed? == false
  #Vielleicht kann man die Bedingung auch einfacher schreiben, aber es wäre eine Möglichkeit.
  @image.bitmap.dispose
  @image.dispose
end


Wobei sich jetzt die Frage stellt, dass Bild wird erstellt und gleich gelöscht, was brint dass?

Ave Abt
:information: YAams
:rainbow: Random Signatur
Bild





Weitere Informationen | Download
Mit Support für RGSS Project 1!
Bild

lucien

Schaffender

  • »lucien« ist der Autor dieses Themas

Motto: California potato power! Ketchup rains all over the world.

  • Nachricht senden

5

Mittwoch, 30. August 2006, 19:18

Ich versuch das mal so.
Habs schon mit andern bedingungen probiert, hat aber nicht geklappt. aber so könnts vielleicht klappen.
Vielleicht hab ich die falsche stelle angegeben. Hab heute soviel probiert...
es soll natürlich erst nach der animation gelöscht werden.
jedenfalls danke.

edit:

So, die Stelle mit dem verschwinden war wirklich falsch. es leuchtete nur kurz auf.
Hab die gewünschte Stelle aber gefunden und alles klappt wunderbar. Danke Abt!

6

Sonntag, 1. Oktober 2006, 17:41

Hallo^^
Ich hatte auch eine Frage,bezogen auf das Cybersam SkS.
Wollte deswegen nicht gleich ein Thema eröffnen^^
Folgendes:
Da ich mich nicht so gut in rgss auskenne,wollte ich fragen, wie man bei Cybersam die allgemeine Position der Animation der Enemies ändern kann (und auch der Helden)
Wollte meine nämlich etwas verschieben, dann müsste der Held ein wenig weiter zum Gegner laufen.Aber dann muss ich wahrscheinlich noch andere Sachen einstellen, oder?

Danke im Vorraus, falls mir jemand helfen kann.
Bitte, bitte antwortet mir, dass wäre sehr großartig von euch.

EDIT:Ok, hat sich erledigt.Bin dann doch noch selbst drauf gekommen^^
Bin zwar Anfänger im RpgXP und programmieren ein totaler anfänger,dennoch große Motivation, gebe nicht auf! Bild

Social Bookmarks