RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Event: Donation System

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 82
Dreamers often lie.
Donation System
By Drakusatheon
Software: RMVX, but likely doable on others too.
Difficulty: Normal [Medium]

Some Possible Applications:
~Church Donations: Give the player holy items or reputation if enough is donated~
~Toll Roads: Allow the player to take certain paths once a certain amount is paid~
~Highway Robbery: Pay the Highwayman or prepare to fight!~
~Convert into a Gambling System (May make one for this at a later date)~

Parts:
1 Donation Variable
1 "Validating Variable"
1 "Accumulative Variable"
[OPTIONAL]1 (or more) Common Event(s)

This is a pretty durable, fairly simple little event system for making donations, payments, and other cumulative monetary transactions inside the game. The bones of the event are easy, but difficulty is farther varied by how complicated the associated events become, so the difficulty is more or less "salt to taste". Thusly, I set it at "Normal". But the overall setup time should only take a few minutes once you get used to it. One only needs basic variable knowledge and Event Calling to make basic use of the system.  :D

The first thing you need to do is set up the event itself that the player is going to "donate" to. For this demo, I'll set this event on the counter in front of the woman behind it. Keep in mind that if you use this method and do not set a graphic, the software won't automatically change the event Priority to Same as Characters. You'll have to do it yourself, or the event won't activate like it should.



Within this event, start with some simple welcoming text. For the demo, the woman asks how much you would like to donate. The easiest way to go about donations is with the "Input Number" Option in the Message Frame of the Event Menu. It will as you how many digits to allow, and also which variable the player's choice will be altering. This is where our first variable will come into play: our Donation Variable. This variable is just used as a placeholder to remember how much money the player is trying to donate. We'll call this variable "DonationAmount" for this example, and allow three digits. This means the most the player can donate at a single time is 999 Gold.

Now you need the event to check to see if the player has that much as they're trying to give. This is important because you can't really give what you don't have to begin with. So we'll need a Conditional Branch that will compare the Donation Variable against the next variable on our list: The Validating Variable. We'll call this one "DonationValidation". But before we make that, we still need to give DonationValidation a value. We need it to be equal to the amount of Gold the player is currently carrying. Select "Control Variables" and Set DonationValidation to equal Gold by selecting the Other option and moving the scroll bar down to Gold.
Spoiler for:

Now that we've done that, we can make our Conditional Branch. :D
We want to make sure that if the player does possess as much gold as they are trying to give that the event will terminate. We do that thusly:

Quote
@>Conditional Branch: Variable [0003:DonationAmount] > Variable [0001:DonationValidation]
    @>Text: 'People2', 1, Normal, Bottom
    :          : Oh? It appears you don't have enough
    :          : Gold. Please come back when you have
    :          : enough, or switch to a lower amount.
    @>
    Else
    @>
    Branch End
@>

Basically; it says that if DonationAmount (The amount the player is trying to donate) is larger than DonationValidation (The amount of Gold the player possesses), then the event is to display the selected text and terminate itself. We're halfway done. What remains is what happens with a successful donation, which we'll put under the "Else" area. All you need to start is a bit of text to tell that the transaction was a success, then subtract the DonationAmount from the player's gold. Now we need the final variable: The Accumulative Variable. This isn't necessary for all events (such as that Highwayman event possibility), but if it is a total amount that you wish to grow over time as the player donates, this variable is essential. We'll call it TotalDonations in this demo. All you have to do is Add the variable DonationAmount to TotalDonations. In the end it should look something like this:


From here you can do many things. You can set a separate event to display how much you've donated in total by creating a text event that says something like "You have donated \V[ x ] Gold in total" ("x" is the ID number of the variable you want to display. To show how much has been donated in total, you'd use the ID number for TotalDonations). You could also call a Common Event somewhere before the end of the Else Branch. This could be to give the play and item if they donate a certain total amount or any multitude of things. :D

I hope this has been helpful :) I suggest downloading the demo to see it in action if you're still not sure, and also to see the eventing firsthand. Good day, all.

~~~~~~~~~~~~~~~~~~~~~~
Demo: http://www.mediafire.com/file/mnn5igmnx0j/Donation.exe
« Last Edit: January 04, 2010, 01:13:51 AM by Drakusatheon »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
It looks like this could help a lot of people. Nice work.