Money Bags?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
MadCatter
Posts: 34
Joined: Mon Nov 03, 2014 5:02 am
Location: Southampton, UK

Money Bags?

Post 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.
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Money Bags?

Post by GoldenShadowGS »

Maybe you could add a counter component to your money bag.
User avatar
MadCatter
Posts: 34
Joined: Mon Nov 03, 2014 5:02 am
Location: Southampton, UK

Re: Money Bags?

Post 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.
cameronC
Posts: 80
Joined: Wed Apr 11, 2012 10:54 pm

Re: Money Bags?

Post 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.
Last edited by cameronC on Thu Nov 20, 2014 11:55 pm, edited 1 time in total.
Writer and sometimes artist of the very slightly acclaimed comic series Scrambled Circuits. A comic series about a robot written by a human.

Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
User avatar
MadCatter
Posts: 34
Joined: Mon Nov 03, 2014 5:02 am
Location: Southampton, UK

Re: Money Bags?

Post 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.
Post Reply