Registrarse

[RPG - Scripting] Añadir objetos sin avisar

FiaPlay

Bro, This Fire!
Hola WAH sucede que tengo una duda , ¿cómo puedo entregarle un objeto a PLAYER sin que aparezca el cartel avisándole?
Busqué en la wiki pero lo que vi creo que era para la 20.1 y uso la 19.1
 

Manurocker95

Doctorando en Ingeniería Biomédica & Game Dev
Miembro insignia
Hola WAH sucede que tengo una duda , ¿cómo puedo entregarle un objeto a PLAYER sin que aparezca el cartel avisándole?
Busqué en la wiki pero lo que vi creo que era para la 20.1 y uso la 19.1
Tienes varias opciones, por un lado puedes añadir directamente el item con
Código:
$PokemonBag.pbStoreItem(item,quantity)
comprobando antes previamente que puedes añadirlo con
Código:
$PokemonBag.pbCanStore?(item)
. Por otro lado, si te hace ilusión utilizar lo mismo que en las PokéBall, créate un nuevo método que sea igual que el que hay para dar objeto pero eliminando el mensaje o añade un parámetro a la función y simplemente poones un if para que no se muestre.

Código:
def Kernel.pbItemBall(item,quantity=1,showMsg = true)
  if item.is_a?(String) || item.is_a?(Symbol)
    item = getID(PBItems,item)
  end
  return false if !item || item<=0 || quantity<1
  itemname = (quantity>1) ? PBItems.getNamePlural(item) : PBItems.getName(item)
  pocket = pbGetPocket(item)
  if $PokemonBag.pbStoreItem(item,quantity)    # If item can be picked up
    if showMsg
        if isConst?(item,PBItems,:LEFTOVERS)
              Kernel.pbMessage(_INTL("\\me[Item get]You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        elsif pbIsMachine?(item)   # TM or HM
              Kernel.pbMessage(_INTL("\\me[Item get]You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(pbGetMachine(item))))
        elsif quantity>1
              Kernel.pbMessage(_INTL("\\me[Item get]You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
        elsif ['a','e','i','o','u'].include?(itemname[0,1].downcase)
              Kernel.pbMessage(_INTL("\\me[Item get]You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        else
              Kernel.pbMessage(_INTL("\\me[Item get]You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        end
     
        Kernel.pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].",
               itemname,pocket,PokemonBag.pocketNames()[pocket]))
    end    
    return true
  else   # Can't add the item
    if showMsg
        if isConst?(item,PBItems,:LEFTOVERS)
          Kernel.pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        elsif pbIsMachine?(item)   # TM or HM
          Kernel.pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(pbGetMachine(item))))
        elsif quantity>1
          Kernel.pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
        elsif ['a','e','i','o','u'].include?(itemname[0,1].downcase)
          Kernel.pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        else
          Kernel.pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        end
     
        Kernel.pbMessage(_INTL("But your Bag is full..."))
    end
    return false
  end
end
y simplemente lo llamas a false en evento:
Código:
pbItemBall(:POKEBALL, 5, false)
 

FiaPlay

Bro, This Fire!
Tienes varias opciones, por un lado puedes añadir directamente el item con
Código:
$PokemonBag.pbStoreItem(item,quantity)
comprobando antes previamente que puedes añadirlo con
Código:
$PokemonBag.pbCanStore?(item)
. Por otro lado, si te hace ilusión utilizar lo mismo que en las PokéBall, créate un nuevo método que sea igual que el que hay para dar objeto pero eliminando el mensaje o añade un parámetro a la función y simplemente poones un if para que no se muestre.

Código:
def Kernel.pbItemBall(item,quantity=1,showMsg = true)
  if item.is_a?(String) || item.is_a?(Symbol)
    item = getID(PBItems,item)
  end
  return false if !item || item<=0 || quantity<1
  itemname = (quantity>1) ? PBItems.getNamePlural(item) : PBItems.getName(item)
  pocket = pbGetPocket(item)
  if $PokemonBag.pbStoreItem(item,quantity)    # If item can be picked up
    if showMsg
        if isConst?(item,PBItems,:LEFTOVERS)
              Kernel.pbMessage(_INTL("\\me[Item get]You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        elsif pbIsMachine?(item)   # TM or HM
              Kernel.pbMessage(_INTL("\\me[Item get]You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(pbGetMachine(item))))
        elsif quantity>1
              Kernel.pbMessage(_INTL("\\me[Item get]You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
        elsif ['a','e','i','o','u'].include?(itemname[0,1].downcase)
              Kernel.pbMessage(_INTL("\\me[Item get]You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        else
              Kernel.pbMessage(_INTL("\\me[Item get]You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        end
    
        Kernel.pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].",
               itemname,pocket,PokemonBag.pocketNames()[pocket]))
    end   
    return true
  else   # Can't add the item
    if showMsg
        if isConst?(item,PBItems,:LEFTOVERS)
          Kernel.pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        elsif pbIsMachine?(item)   # TM or HM
          Kernel.pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]",itemname,PBMoves.getName(pbGetMachine(item))))
        elsif quantity>1
          Kernel.pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]",quantity,itemname))
        elsif ['a','e','i','o','u'].include?(itemname[0,1].downcase)
          Kernel.pbMessage(_INTL("You found an \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        else
          Kernel.pbMessage(_INTL("You found a \\c[1]{1}\\c[0]!\\wtnp[30]",itemname))
        end
    
        Kernel.pbMessage(_INTL("But your Bag is full..."))
    end
    return false
  end
end
y simplemente lo llamas a false en evento:
Código:
pbItemBall(:POKEBALL, 5, false)
Gracias me has sacado de un buen apuro.
 
Arriba