Page 1 of 1

Money Bags?

Posted: Wed Nov 19, 2014 10:16 pm
by MadCatter
I am trying to implement Rupees as a currency for my Legend of Zelda Map.

I have the green, blue and red rupees (wip) but I was wondering whether it is possible to use a rupee bag item (given to the player on map start) to automatically store the number of rupees (currency) collected as an integer, which could later be used with item vendors etc.

In theory the player would pick up the item from the ground, and either when they pick it up, or when it is placed in the inventory (whichever is more feasible), the item would disappear and the number stored in the "rupee bag" item would increment based on the number picked up.

I have no idea whether this is possible, so if anyone has any ideas or pointers as to how I can implement it, I would really appreciate it.

Thanks.

Re: Money Bags?

Posted: Thu Nov 20, 2014 4:14 am
by GoldenShadowGS
Maybe you could add a counter component to your money bag.

Re: Money Bags?

Posted: Thu Nov 20, 2014 4:45 am
by MadCatter
I could do, but that's the easy part. :) The part I need help with is which triggers to use to identify when the rupee is picked up, and how to code that into the object definition.
Thanks.

Re: Money Bags?

Posted: Thu Nov 20, 2014 6:33 pm
by cameronC
You can toy around with something like this.

There is an onPickUpItem hook that you could use to see if rupee_red, rupee_green, or rupee_blue and the item would vanish from their cursor and increase the money_bag counter.

Code: Select all

defineObject{
   name = "party",
   baseObject = "party",
   components = {
      {
         class = "Party",  
         onPickUpItem =
            function(party, item)         
				if string.find(item.go.name, "rupee_") then
					setMouseItem(nil)
                                        money_bag.counter:increment()
					return true
				end
				return true
            end
      }
   },
}
Untested, but should be a close enough starting point for you.

Re: Money Bags?

Posted: Thu Nov 20, 2014 11:45 pm
by MadCatter
Fantastic, that's exactly the sort of thing I was looking for, thanks :D
I'll see if I can get that to work.