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: Simple Steal Skill Tutorial

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 82
Dreamers often lie.
Simple Steal Skill System
By Drakusatheon
Software: RMVX, but likely doable on others too.
Difficulty: Easy

Some Possible Applications:
~Mid-Combat Steal Skill: Steal from the enemy in the middle of the fray!
~Steal From NPCs: Pickpocket NPCs. They won't miss a few coins.
~Enemy Steal Skill: With just a minor tweak, enemies and NPCs can steal from you!

Parts:
1 "Chance" Variable
1 "Reward" Variable
1 Common Event

The reason this has a difficulty of Easy is because it's mercifully short, and highly customizable. There's plenty you can do with this event, and by making simple adjustments you can do many things with it. I'll go over a couple of these possibilities, the rest you should try to accomplish on your own.  ;)

The only things you need to know for this event are Basic Variable Functions, as well as ratios and percentages; both are going to be coming into play immediately. If you're making a Steal Skill, you're going to need a Common Event to call once the skill is used. Let's call this Common Event "Steal" for simplicity's sake. With that done, we can move on to our first variable: the Chance Variable. This variable is going to help determine if the player's Steal attempt is successful or not. Let's call it something easy to remember like "StealChance". We're going to want this variable to set itself randomly whenever the skill is activated. To do this, we change the Operand to Random. This is the first place you can customize it bit. How I have it set, StealChance randomly becomes a number between 1 and 3. The system we're going by uses a Conditional Branch to check to see if StealChance became 1, rather than 2 or 3. If it's 1, then it considers the Steal attempt successful. That means the odds are 1:3, or 33%. By changing maximum number to 4, you can make the odds 1:4, or 25%. Changing it to 5 makes the odds 1:5, 20%. Et cetera, et cetera. Conversely; if you feel 33% is too low, you can change the maximum number to 2 to make the odds 1:2, 50%.



Congratulations! With that done, you've completed the hardest part of this event. Now we need that Conditional Branch mentioned in the previous section. Easy enough. We just need it to check if StealChance equals 1.

Code: [Select]
@>Conditional Branch: Variable [0001:StealChance] == 1

Be sure to have the Else handler active. Since StealChance randomly becomes 1, 2, or 3, checking to see if it became 1 is a simple and effective way to set up a percentile chance. If the check is successful, we'll need to have the Reward Variable ready. This can be just about any number you wish, from a constant number to a random amount (though if you are making it a constant number, you do not need to use a variable. ;)). For the demo, We want this new variable to be randomly chosen between 5 and 15. Using the same method as last time, we can do this. Let's name this variable "StolenGold". Now we need to add the stolen amount to the player's money. Just like any other time you want to give the player money, use the Change Gold option. This time, however, rather than increasing it by a constant, we want to increase it by the variable amount of StolenGold.

Code: [Select]
@>Control Variables: [0002:StolenGold] Random No. (5...15)
@>Change Gold + Variable [0002: StolenGold]

I'd probably be a good idea to let the player know that the Steal was successful, and also how much they stole. We can do that with the \v[ x ] we talked about in my last tutorial (You can find the whole list in the Help file). Done correctly, it will tell the player exactly how much gold they're getting.

Code: [Select]
@> Text: -,-, Normal, Bottom
:      :Stole \v[2] Gold!

All that's left for this Common Event is to put what happens if the Steal attempt fails. Under the Else handler, you can just leave a simple message like "Failed to steal any Gold!" or the like. You don't even have to say anything, but it is recommended. In the end, it should look a little something like this:



Now that all the complicated stuff is out of the way, we just need to affix the Common Event to a skill.

Spoiler for:

There's a drop down menu in the skills window where you can set a Common Event to be activated upon use of the skill. With this set, everything is in place. Now all you have to do is test it out!

Now remember, this is an event. Because of event limits, this doesn't actually steal the amount of Gold from the enemy's reward money value. It just gives the player a randomly generated amount of money. You can also tweak it to give the player items instead of money, in which case the "Reward" Variable is unnecessary and can be omitted.

Stealing from NPCs can also be easily done by putting the event code into an NPC event instead of a Common Event. You could even have the player be thrown into battle with the NPC if they fail the Steal Attempt. You could also set this to steal items from containers if you wished. The amount of things you can do with this basic knowledge is vast. Get out there and try something new! Attached is a demo that you can use to see some different functions and see the code up close. Good day, all. :D