Coin system

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.
strajepi
Posts: 15
Joined: Sat Apr 17, 2021 11:47 am
Points: 10

Coin system

Post by strajepi »

Hi everyone,

I m sorry to open a new topic.
I m making my first IF and I would like to create a systeme that would allow the player to earn money and to spend it in shops. Is that possible ? If yes, could you explain me how to do it or tell me where to look for ?
Thank you very much !
User avatar
Denk
Posts: 786
Joined: Mon Feb 22, 2016 6:21 pm
Points: 291
Location: Hjørring, Denmark

Re: Coin system

Post by Denk »

strajepi wrote: Mon Apr 19, 2021 8:01 pm I m sorry to open a new topic.
No problem - that is what we are here for.
strajepi wrote: Mon Apr 19, 2021 8:01 pmI m making my first IF and I would like to create a systeme that would allow the player to earn money and to spend it in shops. Is that possible ?
When you install ADRIFT, it is already equipped with a money system, though it is deselected by default.

Go to Setttings->Libraries and you will see this screen similar to this:
DefaultLibraries.png
DefaultLibraries.png (21.17 KiB) Viewed 191 times
Note that the exact path to the libraries may depend on which version you installed and where you decided to install ADRIFT. Make sure that the standard library stays selected and select the Money System too. Then click okay to close the window. Then go to the file-menu and click "new" to start to work on a new game with these libraries. Note that the standard library must always be loaded first, which it will if it is at the top of the list.

If everything works as intended, you should be able to see the folders "Standard Library" and "Money System" in the folder-window. The behaviour of the Money System can be modified if needed.

Just ask if you need more help.
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
Lumin
Posts: 2318
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Coin system

Post by Lumin »

All you need is a variable for the amount of coins the player has, than have task actions add or subtract from it as needed.

With restrictions in place to make sure they actually have enough for the item they're purchasing.
strajepi
Posts: 15
Joined: Sat Apr 17, 2021 11:47 am
Points: 10

Re: Coin system

Post by strajepi »

Thank you very much for your help !
How do I create buyable items ? Once I have created the shop as a location, do I create a simple item and modify something in the properties ?
User avatar
Denk
Posts: 786
Joined: Mon Feb 22, 2016 6:21 pm
Points: 291
Location: Hjørring, Denmark

Re: Coin system

Post by Denk »

strajepi wrote: Tue Apr 20, 2021 1:41 pm How do I create buyable items ? Once I have created the shop as a location, do I create a simple item and modify something in the properties ?
Assuming you are using the Money System, if you create a DYNAMIC object, then the property "Buyable item" will appear in "properties" of that object. Once you select that, a field called "item cost" appears so you can type in the price of the object.
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
Lumin
Posts: 2318
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Coin system

Post by Lumin »

I'm sure there's multiple ways to do this, but I would just have the items sitting in Hidden, then when the player goes to the shop and looks at the menu or display case or whatever, they type 'buy [whatever]', which triggers a task that subtracts that amount and moves the item to their inventory with a little message about the shopkeeper handing it to them. (if they have enough coin)

This is how you do it with the standard system though, I haven't really looked at any extra libraries.
strajepi
Posts: 15
Joined: Sat Apr 17, 2021 11:47 am
Points: 10

Re: Coin system

Post by strajepi »

thanks a lot !
strajepi
Posts: 15
Joined: Sat Apr 17, 2021 11:47 am
Points: 10

Re: Coin system

Post by strajepi »

Also I was wondering :

If my story begins in a house, is there any alternative for the directions North, South, West and East ? I mean it is kind of weird to say "Go West in the bathroom"... I thought about In and Out but if there are other directions available, this will not work.
User avatar
BattleoftheBased
Posts: 18
Joined: Sun Mar 28, 2021 4:56 pm
Points: 10
Location: your left nostril
Contact:

Re: Coin system

Post by BattleoftheBased »

You can also use variables for consumable items or things you buy multiples of, like ammo or healing potions. Most things can work the same way a coin system does, there's not much difference between holding an object called an apple and the game checking that the apple variable is 1.
User avatar
Lumin
Posts: 2318
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Coin system

Post by Lumin »

strajepi wrote: Tue Apr 20, 2021 4:51 pm Also I was wondering :

If my story begins in a house, is there any alternative for the directions North, South, West and East ? I mean it is kind of weird to say "Go West in the bathroom"... I thought about In and Out but if there are other directions available, this will not work.
It's weird from a realism standpoint, but not weird for players, compass directions have been the standard for these games for like thirty years now.

Other methods are sometimes attempted but they don't really catch on, 'type W to go left on grid map' is all it comes down to and it's pretty engrained.

It's possible to use tasks to set movement shortcuts, but typing 'bathroom' is actually more work than 'w'.

For locations a longer distance away that can be useful though. GO MALL from anywhere in town, as opposed to travelling through thirty locations for instance.
User avatar
Lumin
Posts: 2318
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Coin system

Post by Lumin »

BattleoftheBased wrote: Tue Apr 20, 2021 5:07 pm You can also use variables for consumable items or things you buy multiples of, like ammo or healing potions. Most things can work the same way a coin system does, there's not much difference between holding an object called an apple and the game checking that the apple variable is 1.
Oh good, you're still around.

Yes for anything dealing with identical multiples, holding 14 pieces of scrap metal for instant looks much cleaner than 'You are holding a scrap metal, a scrap metal, a scrap metal....' and so on.
strajepi
Posts: 15
Joined: Sat Apr 17, 2021 11:47 am
Points: 10

Re: Coin system

Post by strajepi »

BattleoftheBased wrote: Tue Apr 20, 2021 5:07 pm You can also use variables for consumable items or things you buy multiples of, like ammo or healing potions. Most things can work the same way a coin system does, there's not much difference between holding an object called an apple and the game checking that the apple variable is 1.
Is it also how you make a health bar ? With variables ?
User avatar
Lumin
Posts: 2318
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Coin system

Post by Lumin »

strajepi wrote: Tue Apr 20, 2021 5:32 pm
Is it also how you make a health bar ? With variables ?
Right. A variable just stores a number or string of text that you can have the game alter or react to at any time. A variable called health can display the number hit points, or even visibly a row of asterisks or something representing them.
strajepi
Posts: 15
Joined: Sat Apr 17, 2021 11:47 am
Points: 10

Re: Coin system

Post by strajepi »

thank you very much !
I will try to learn more about the variables on the internet.
strajepi
Posts: 15
Joined: Sat Apr 17, 2021 11:47 am
Points: 10

Re: Coin system

Post by strajepi »

Sorry I have another question...
I would like to add bandaids in my game. I would like them to be buyable and foundable in many locations. Do I have to create one item per location ? When I choose dynamic and then the initial location, it seems that I can only choose one location...
Thanks a lot !!
Post Reply