Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX]Give items to NPCs[SOLVED]

This is a request for a Give Item to NPC script

The main idea is that when I talk to a NPC and choose to give her an item...
http://img238.imageshack.us/img238/3334/gifthw9.th.png[/img]

It will open a custom item menu that show only gifts (maybe an array of @items.id?)
http://img208.imageshack.us/img208/9870/gift2xl5.th.png[/img]

Actually I don't need to give any items to the event (NPC), I just need to remove the selected item in the menu to give a similar effect and make react the event according to the selected item.

I found a very similar request here, but the script is for XP
http://www.rmxp.org/forums/index.php?topic=31741.0

Thanks for reading this.
 
Well! thanks OS, this is surely a great start!

but like always there are some issues xD

- First: items outside the array are unusable with the buzzer sound wich is it great, but items inside the array (gifts) are unremovable but with the confimation sound, in others words, the gifts do not remove from my inventory.. =( don't know why.. maybe because my items properties?

Scope: none
Occasion: Only from the Menu
Consume: NO

I have those items properties to avoid incidental consume of the gift, (after all, there will be dificult to obtain)

*Pls refer to issue number 3 for a possible solution to this matter.

*SOLVED*

- Second: Is posible to select just one gift at the time? I mean.. talk to the event, select gift, and immediately close the item menu. I want to process each gift separately.. for example:

I give to a event any gift (present, flower, pet), they reward me with +1 point, but instead I give a chocolate they will reward me with +10 points!

*SOLVED*
Code:
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      @item = @item_window.item
      if @item != nil
        $game_party.last_item_id = @item.id
      end
      if GiftItems.include?(@item.id)
        Sound.play_decision
        determine_item
        return_scene ########to exit inmediatly after first selection###########
      else
        Sound.play_buzzer
      end
    end
  end

Third one: What happen after your script? I mean.. item.id is stored in a variable as a constant? or how do I make react my event acording to the selected gift?

if item.id is stored in a variable I can make react the event with some conditional branches and even remove the selected item witch solve issue number 1 =D

*SOLVED*
Code:
#--------------------------------------------------------------------------
  # * Confirm Item
  #--------------------------------------------------------------------------
  def determine_item
    $game_map.events[@event_id].give_item(@item.id)
    $game_party.consume_item(@item)
    @item_window.draw_item(@item_window.index)
    $game_variables[n] = @item.id  ####assign item.id to a variable were variable.id = n####
  end
end

Well that's wall, this is surely a great push to continue my project.

Thanks ^^
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top