Combining and seperating items, like in an adventure

Status
Not open for further replies.

Candacis

Pixel Pusher
Restaff
Joined
May 2, 2012
Messages
1,652
Reaction score
2,549
First Language
German
Primarily Uses
I started this once for VX Ace, but that was a long time ago. Still, the idea stuck with me and I would like to try something similiar for MV. What is it about?

I'm looking for a plugin in which I can combine items together. Not so much as a crafting plugin, but more like in adventures? Using two unique items together or seperating them again. I already tried to start with a script, where you have a new item menu (with bigger icons, too) and in which you can select one item from the list and do one of four things: examine, equip, combine and seperate. Examine should open a new window, having an item description or something the like. Equip would equip the item (every item is sorted in the weapons category right now), when I would click combine, you should be able to select a second item and then those two would either combine (if they can) or you would get a message (or sound) that it isn't possible. Lastly, seperate would seperate a combined item back into the two previous items (if possible - e.g. you shouldn't been able to seperate a poisoned wine back into wine and poison).

Seperate already works, all the other stuff.. not. My thought was to have recipies for every item combination. Like the item 4 in the weapons category database (Hook) and the item 5 (Pole) would combine to item 3, a Pike Pole. And you can also undo (seperate) the final item.

This is the script I once started (with help) for VX Ace, but obviously that was in Ruby and I have no idea how to turn it into Javascript, but maybe it gives a good starting point:

Code:
######## Module  #######

module Kombos
Rezepte = {
"Pike Pole" => [[4,5],[3]],
"Sword" => [[11,12],[10]],
"Grappling Hook" => [[4,24],[23]],
"Fishing Rod" => [[7,8,9],[6]],
"Letter" => [[17,18,19],[19,16]],
"Billard Cue" => [[5,12,26],[25]],
"Poisoned Wine" => [[14,15],[13]]
}
end

######## Windows #######

class Quest_Items < Window_ItemList
def initialize
    super(0, 0, Graphics.width, 250)
    self.category = :weapon
  end
 def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, true)
    end
  end
  def current_item_enabled?
    true
  end
end

class Item_Kommandos < Window_HorzCommand
  def initialize
    super(0,320)
    self.x = (Graphics.width/2) - (500/2)
  end
 def window_width
   return 500
   end
  def make_command_list
    add_command("Examine", :examine)
    add_command("Equip", :equip)
    add_command("Combine", :combine)
    add_command("Separate", :separate)
    end  
  end
 
######## Scenes ###########

class Scene_Adventure < Scene_Base
def start
super
create_background
createhelpwindow
createlistwindow
end
def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap
@background_sprite.color.set(16, 16, 16, 128)
end
  def dispose_background
    @background_sprite.dispose
  end
def createhelpwindow
  @itemdescription = Window_Help.new(3)
  @itemdescription.y = 250
  end
def createlistwindow
@listwindow = Quest_Items.new
@listwindow.viewport = @viewport
@listwindow.help_window = @itemdescription
@listwindow.set_handler(:ok, method(:on_ok))
@listwindow.set_handler(:cancel, method(:return))
@listwindow.activate
@listwindow.select(0)
end
def createkommandoswindow
  @kommandowindow = Item_Kommandos.new
  @kommandowindow.viewport = @viewport
  @kommandowindow.set_handler(:ok, method(:on_ok2))
  @kommandowindow.set_handler(:cancel, method(:return2))
  @kommandowindow.set_handler(:examine, method(:on_examine))
  @kommandowindow.set_handler(:equip, method(:on_equip))
  @kommandowindow.set_handler(:combine, method(:on_combine))
  @kommandowindow.set_handler(:separate, method(:on_separate))
  @kommandowindow.activate
  @kommandowindow.select(0)
  end
def on_ok
    @listwindow.deactivate
    createkommandoswindow
  end
def return
    dispose_background
    SceneManager.return
  end
def on_ok2
  @kommandowindow.activate
end
def on_examine
  @kommandowindow.activate
end
def on_equip
    Sound.play_equip
    @actor = $game_actors[1]
    @actor.change_equip(0, @listwindow.item)
    @listwindow.unselect
    @listwindow.refresh
    @kommandowindow.close
    @listwindow.activate
  end
def on_combine
  @kommandowindow.activate
end
def on_separate
  item = @listwindow.item
  for key in Kombos::Rezepte.keys
    if item.id == Kombos::Rezepte[key][1][0]
      for gefunden in Kombos::Rezepte[key][0]
      $game_party.gain_item($data_weapons[gefunden], 1)
      end
    RPG::SE.new("Equip1", 80, 100).play
    $game_party.lose_item($data_weapons[item.id], 1)
      @listwindow.unselect
      @listwindow.refresh
      @kommandowindow.close
      @listwindow.activate
    else
      @kommandowindow.close
      @listwindow.activate
    end
  end
end
def return2
  @kommandowindow.close
  @listwindow.activate
end
end

If anyone wants to try and help me out, it would be greatly appreciated.
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
I know you specifically say "two unique items", but is that the absolute limit, or would you want it to be able to be 3, or even 4, etc items? I guess that would make it sort of more akin to a crafting system though.

- Liquidize
 

Candacis

Pixel Pusher
Restaff
Joined
May 2, 2012
Messages
1,652
Reaction score
2,549
First Language
German
Primarily Uses
I have in my example an item that could be used in 2 different recipies. For instance, the pole could not also help, creating the Pike Pole, but also the Billard Cue.
So, I would imagine that you could use an item in different ways, but I think, that is not what you meant? Maybe you could do all kinds of combinations, for instance, combine a banana and a mango and getting 3 smoothies out of it.

But I didn't want to make my request overly complicated and was looking at the minimum functionality. I'm sure, one could spice it up and make a real adventure engine out of it, if someone likes working on it.
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
I was thinking more along the lines of say you had a Banana,a Mango, and an Apple. You could combine all 3, and not just 2 of them, to get a smoothie. I think however you meant strictly only two items per combination recipe? I could do this for you if ya want though.
 

Candacis

Pixel Pusher
Restaff
Joined
May 2, 2012
Messages
1,652
Reaction score
2,549
First Language
German
Primarily Uses
Ah, now I understand what you mean.
Yes, in my example I had combinations that had 3 items. I don't know, if that is more complicated.

Would be really awsome, if you want to give it a try. I'm happy with any progress.
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
Sure, I'll work on this asap for you.
 

Candacis

Pixel Pusher
Restaff
Joined
May 2, 2012
Messages
1,652
Reaction score
2,549
First Language
German
Primarily Uses
Thanks so much. I'm curious what you will come up with.
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
Just want to give you an update, I'm almost done what I think is something very close to what you want, work has had me busy though so it'll be about another day. Sorry for the delay.

EDIT:
Here you go, this is a bit rudimentary and I did forget about the "Equip" portion, but perhaps it could be used as a base? Plugin Code


- Liquidize
 
Last edited:

Candacis

Pixel Pusher
Restaff
Joined
May 2, 2012
Messages
1,652
Reaction score
2,549
First Language
German
Primarily Uses
Hey, thanks so much! No worries about the Equip function. I'm happy, you even worked on it :)

I'm guess, I'm doing something wrong because I can't get a game to start with the plugin in it. It says, it failed to load the plugin.

I'm also wondering, how would I access the adventure menu in the game? Is it in the normal menu or could I access it with a special button?
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
That is very strange, maybe I copied and pasted it wrong. I'll look shortly, and yes it would be accessed through the normal main menu.

Edit: It seems when you download the file from pastebin it adds an extra ".js" to it. Try making sure it doesn't have an extra ".js" in the file name.
 
Last edited:

Candacis

Pixel Pusher
Restaff
Joined
May 2, 2012
Messages
1,652
Reaction score
2,549
First Language
German
Primarily Uses
Thanks, now it works!
What doesn't work right now, is setting Item Separation to false. It still separates the item again.
I also noticed that the end product can't be a weapon or an armor. But that's not important to me, because I think, I will only have one item category anyway.

Other than that, I'm really happy with it. :)
I will probably try and give it its own button to access it real quick, and have icons only and use bigger icons, but those are all details. Right now it is a great start. Thanks so much.
If you ever need help, mapping or custom tiles, message me. :thumbsup-left:
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
You're welcome, I'll look into fixing those issues later today, and post an edited version with the fixes asap.

- Liquidize
 

Candacis

Pixel Pusher
Restaff
Joined
May 2, 2012
Messages
1,652
Reaction score
2,549
First Language
German
Primarily Uses
Thanks so much!
I discovered another issue, if you still have time to work on it.

When I have an item combination that goes like this:
item 1 (hilt), weapon 1 (blade) = weapon 2 (sword)
I can combine it now without problem, but when I separate it again, I only get item 1, not the weapon 1 portion of it.
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
Hmm, I'll look into it. I don't really want to give you a faulty plugin that doesn't work perfectly :p and just call it done.
 

Candacis

Pixel Pusher
Restaff
Joined
May 2, 2012
Messages
1,652
Reaction score
2,549
First Language
German
Primarily Uses
Hey, I was wondering, if you had looked into this again?
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
So sorry about the wait, I got caught up in work related things. I will take a look this weekend, promise.

Edit: Looking at it now.

-Liquidize
 
Last edited:

SVEzT

Warper
Member
Joined
Jun 6, 2020
Messages
3
Reaction score
0
First Language
German
Primarily Uses
RMMV
Hey Liquidize, I stumbled on your nice script. May I ask you wether you have made a new version?

I noticed a problem with version 1.01. Irregardless of which item has the note, I always get item #1 when using the combine function. Sorry, I am a newbie and maybe made a mistake. Any help would be appreciated. (Also, sorry for warming up such a rather old thread.)
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,497
Reaction score
5,334
First Language
english
Primarily Uses
RMMZ

@SVEzT , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


Please make your own thread if you're having trouble with a plugin instead of posting in a very old thread.

Closing.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,088
Members
137,585
Latest member
Reversinator
Top