Jump to content
Sign in to follow this  
GantzRPG

RE WEAPONS SYSTEM 2 PROBLEM GRAPHICS

Recommended Posts

What command are you using to make the character visble/invisble : I will try to make sure it makes the weapon invisible too

Share this post


Link to post
Share on other sites

Put this bit of code

      if $game_player.actor.character_name == ""  
        sprite.visible = false
      else
        sprite.visible = true
      end

at line 53 just blow sprite.update in the Sprite Set Map script

Share this post


Link to post
Share on other sites

Use this script for invisibility issues

class Game_Player < Game_Character
	alias hide_weapon_update update
  def update
    if $game_player.actor.character_name == "" 
      abs_update
    else
      hide_weapon_update
    end
  end
end
 

For the other one could you not change your party and make another character with no weapon instead ?

Share this post


Link to post
Share on other sites

Use this script instead of what I gave you previously

class Game_Player < Game_Character
  
  attr_reader :hidden_weapon
  
  
	alias hide_weapon_update update
  def update
    if $game_player.hidden_weapon
       abs_update     
    else
      hide_weapon_update
    end
  end
  
  def show_weapon
    @hidden_weapon = false
  end
  
  def hide_weapon
    @hidden_weapon = true
  end
  
end

class Spriteset_Map
  
  def update_vis_equip
    if @weapons.keys.include?(:player)
      sprite = @weapons[:player]; player = $game_player
      sprite.update
      if $game_player.hidden_weapon
        sprite.visible = false
      else
        sprite.visible = true
      end
      sprite.x = player.screen_x + Static_Move[player.direction][0]
      sprite.y = player.screen_y + Static_Move[player.direction][1]
      sprite.angle = Static_Angles[player.direction]
      sprite.z = Static_Z[player.direction]# - 15
      sprite.mirror = Static_Mirror[player.direction]
    else
      icon = ($game_player.equipped_weapon.weapon.icon_index rescue nil)
      return if icon.nil? 
      bitmap = Bitmap.new(24,24)
      bitmap.blt(0,0,Cache.system("Iconset"),Rect.new(icon%16*24,icon/16*24,24,24))
      sprite = Sprite.new(@viewport1)
      sprite.ox, sprite.oy = 22,22
      sprite.zoom_x, sprite.zoom_y = 0.85, 0.85
      sprite.bitmap = bitmap
      @weapons[:player] = sprite
    end
  end
  
end

and use the scripts commands

$game_player.show_weapon 

and
$game_player.hide_weapon

to make the weapon invisible/unusable

Share this post


Link to post
Share on other sites

It works :) however I should solve one last issue.

 

Basically when you finish the game, you will unlock extra mode, with another part of the game, I wish the weapon removed from the inventory, I tried to remove it but I can't do it, can you help me?

Share this post


Link to post
Share on other sites

You are trying to remove a weapon from the inventory not from the player , in actor there is a change equipment tab you can set the player weapon to none from there

Share this post


Link to post
Share on other sites

In my previoi sscript try to replace this line (around 42)

return if icon.nil?

with

 if icon.nil? 

        sprite.visible = false
        return
      end

Share this post


Link to post
Share on other sites

I have no idea why it's still not working you can try this instead 

 if icon.nil? 
        sprite.dispose unless sprite.disposed?
        return
 end

Use it to replace the previous stuff I gave you

Share this post


Link to post
Share on other sites

Try this one then

class Game_Player < Game_Character
  
  attr_reader :hidden_weapon
  
  
	alias hide_weapon_update update
  def update
    if $game_player.hidden_weapon
       abs_update     
    else
      hide_weapon_update
    end
  end
  
  def show_weapon
    @hidden_weapon = false
  end
  
  def hide_weapon
    @hidden_weapon = true
  end
  
end

class Spriteset_Map
  
  def update_vis_equip
    if @weapons.keys.include?(:player)
      sprite = @weapons[:player]; player = $game_player
      sprite.update
      if $game_player.hidden_weapon
        sprite.visible = false
      else
        sprite.visible = true
      end
      sprite.x = player.screen_x + Static_Move[player.direction][0]
      sprite.y = player.screen_y + Static_Move[player.direction][1]
      sprite.angle = Static_Angles[player.direction]
      sprite.z = Static_Z[player.direction]# - 15
      sprite.mirror = Static_Mirror[player.direction]
    else
      icon = ($game_player.equipped_weapon.weapon.icon_index rescue nil)
      if icon.nil? 
        sprite.visible = false
        return
      end
      bitmap = Bitmap.new(24,24)
      bitmap.blt(0,0,Cache.system("Iconset"),Rect.new(icon%16*24,icon/16*24,24,24))
      sprite = Sprite.new(@viewport1)
      sprite.ox, sprite.oy = 22,22
      sprite.zoom_x, sprite.zoom_y = 0.85, 0.85
      sprite.bitmap = bitmap
      @weapons[:player] = sprite
    end
  end
  
end


class Game_Actor < Game_Battler

  def change_equip(slot_id, item)
    if slot_id == 0
      for weapon in $weapons
        break if item == nil
        if weapon.weapon.id  == item.id
          $game_player.equipped_weapon = weapon
          $game_player.equipped_weapon.bullets = 0 if $game_player.equipped_weapon.bullets.nil?
          break
        else
          $game_player.equipped_weapon = nil
        end
      end
      if item == nil
        $game_player.equipped_weapon = nil
       
       if SceneManager.scene.is_a?(Scene_Map) 
          SceneManager.scene.spriteset.weapon_dispose          
       end
      end
      my_def(slot_id, item)
    else
      my_def(slot_id, item)
    end
  end
end

class Spriteset_Map
  
  def weapon_dispose
    if @weapons[:player].is_a?(Sprite)
      @weapons[:player].dispose if not @weapons[:player].disposed?
      @weapons[:player] = nil
    end
  end
end

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×