Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Problem ze skryptem
Autor Wiadomość
Lord Voldemort 




Preferowany:
RPG Maker XP

Dołączył: 03 Sty 2011
Posty: 32
Skąd: Polska
Wysłany: Nie 27 Mar, 2011 21:39
Problem ze skryptem
http://www.ultimateam.pl/viewtopic.php?t=2764 - W tym temacie podany jest taki oto skrypt:

Spoiler:

Kod:
#============================================================================
#                            Syn's Ammo Requirements 
#----------------------------------------------------------------------------
# Written by Synthesize
# Version 1.00
# August 15, 2007
# Tested with SDK 2.1
#============================================================================
#----------------------------------------------------------------------------
# Customization Section
#----------------------------------------------------------------------------
module Ammo
  # Format = {weapon_id => Ammo_cost}
  Range_weapons_id = {17 => 1}
  # Format = {weapon_id => Item_id
  Range_ammo_id = {17 => 33}
  # Format = {skill_id => Ammo_cost}
  Skill_ammo = {73 => 3}
  # Note on Skills: When using Skills the Current Ammo for the equipped
  # weapon will be used. So if Skill 73 is used and Weapon 17 is equipped
  # then Ammo #33 will be used.
end
#----------------------------------------------------------------------------
# Begin Scene_Battle
#----------------------------------------------------------------------------
class Scene_Battle
  # Alias Methods
  alias syn_scene_battle_range make_basic_action_result
  alias syn_scene_battle_skill make_skill_action_result
  #----------------------------------------------------
  # Alias the Attacking method
  #----------------------------------------------------
  def make_basic_action_result
    # Gather the current Ammo Cost
    gather_ammo_cost = Ammo::Range_weapons_id[@active_battler.weapon_id]
    # Gather the Current Ammo
    gather_ammo = Ammo::Range_ammo_id[@active_battler.weapon_id]
    # Check if the Active Battler is attacking and if they are using a ranged weapon
    if @active_battler.current_action.basic == 0 and Ammo::Range_weapons_id.has_key?(@active_battler.weapon_id)
      # Check the Ammo Count
      if $game_party.item_number(gather_ammo) >= gather_ammo_cost
        # Sufficient Ammo, remove item
        $game_party.lose_item(gather_ammo,gather_ammo_cost)
        syn_scene_battle_range
      else
        # Insufficient Ammo
        @help_window.set_text("#{@active_battler.name} cannot attack due to insufficient Ammo", 1)
      end
      # Call Default Code
    else
      syn_scene_battle_range
    end
  end
  #----------------------------------------------------
  # Alias the Skill method
  #----------------------------------------------------
  def make_skill_action_result
    # Gather the current Ammo Cost
    gather_ammo_cost = Ammo::Skill_ammo[@active_battler.current_action.skill_id]
    # Gather Ammo
    gather_ammo = Ammo::Range_ammo_id[@active_battler.weapon_id]
    # Check if the Actor is using a defiend skill
    if Ammo::Skill_ammo.has_key?(@active_battler.current_action.skill_id)
      # Check if Ammo is present
      if $game_party.item_number(gather_ammo) >= gather_ammo_cost
        # Sufficient Ammo, remove item
        $game_party.lose_item(gather_ammo,gather_ammo_cost)
        # Call Default Code
        syn_scene_battle_skill
      else
        # Set Window; Do Nothing
        @help_window.set_text("#{@active_battler.name} cannot attack due to insufficient Ammo", 1)
      end
      # Otherwise SKip the check and call default code
    else
      syn_scene_battle_skill
    end
  end
end
#============================================================================
# Written by Synthesize
# Special Thanks: ~Emo~ for the request
#----------------------------------------------------------------------------
#                            Ammo Requirements
#============================================================================



ze strony http://rmxp.pl/index.php?...d9&topic=2095.0. Ayene dała nawet demko, ale mam problem, a mianowicie, gdy chcę dodać broń robię tak:

Kod:
  # Format = {weapon_id => Ammo_cost}
  Range_weapons_id = {17 => 1}, {18 => 1}
  # Format = {weapon_id => Item_id
  Range_ammo_id = {17 => 33}, {18 => 33}


I wyskakuje błąd:

Kod:
Script 'Amunicja' line 39: NoMethodError occurred.
unindefinied method 'weapon_id' for nil:NilClass


39 linia to:

Kod:
if @active_battler.current_action.basic == 0 and Ammo::Range_weapons_id.has_key?(@actler.weapon_id)


Co robić? Ayene, mogłabyś zrobić demo jak dodawać broń? Mam angielskiego XP.

Bardzo mi pomogliście, nie ma co... Odpowiedzi od groma... :evil:
________________________
89% graczy uważa, że najważniejsza jest grafika.
Jeśli należysz do pozostałych 11% wklej to do swojego podpisu.
____________________________________________________
Jam jest Lord Voldemort!
 
 
 
Wyświetl posty z ostatnich:   
Odpowiedz do tematu
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene