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.
Item Requirements for Skill Use [Tutorial]

0 Members and 3 Guests are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
It seems a lot of people have questions about using or requiring specific items in order to cast a spell. This will descibe the general process. It requires 1 master common event and 1 additional common event for each skill you want to have this item requirement. Additionally, we will be using at least 2 switches, which we will call "Initialize Reagent Skills" and "<skill name> learned by <hero name>". You will also need a dummy skill for each skill you intend to give an item requirement, and you can do that in this way: merely copy the skill in question and past it into another slot in the skills tab of the Database (DB). Now, all that you have to do is make it so that this skill can never be used, which means using the pull-down menu under Occasion and selecting Never in the dummy skill. If you like you can edit the description to say "you do not have enough <generic item> to cast this spell.

Now, let's set up the master events:

(1) This is pretty simple. First thing we want to do is keep track of when your character obtains the skill in question (let's say it is Fireball, and Arshes is learning it, and it requires a gold mushroom to cast.). Since there is not a set point in the game that this skill is learned, we need to make a common event which is running all the time and testing to see if the character has the skill. All we want this event to do is notify the event system as to when this skill is first obtained. Let's call this event "Testing". Now, set it to paralell process, called by the switch "Initialize Reagent Skills". So our design for this part should look like this:


Conditional Branch: Switch [Fireball learned by Arshes] is OFF
    Conditional Branch: [Arshes] is [001: Fireball (original)] learned
        Control Switch: [Fireball learned by Arshes] is ON
    Branch END
Branch END


Pretty simple eh?

(2) Now,  what we want this to also do is replace the real skill Fireball with the dummy skill we made, because this is equivalent to disabling the skill. Once the skill is disabled in this way though, we need something which will re-enable it once we have the item, so this event should also perform that function. Now, let's make our event: We can call it "Skill Disabler", and it will be paralell process and called by the switch "Initialize Reagent Skills". It ought to look like this:


Conditional Branch: Switch [Fireball learned by Arshes] is ON
    Conditional Branch: Item [Gold Mushroom] is in inventory
        Change Skills [Arshes], + [001: Fireball (original)]
        Change Skills [Arshes] - [002: Fireball (dummy)]
    Else
        Change Skills [Arshes], + [002: Fireball (dummy)]
        Change Skills [Arshes] - [001: Fireball (original)]
    Branch END
Branch END


Notice, how this begins with the same condition the first event we wrote does. We can combine the two functions into one common event merely by writing it like this:


Conditional Branch: Switch [Fireball learned by Arshes] is ON
    Conditional Branch: Item [Gold Mushroom] is in inventory
        Change Skills [Arshes], + [001: Fireball (original)]
        Change Skills [Arshes] - [002: Fireball (dummy)]
    Else
        Change Skills [Arshes], + [002: Fireball (dummy)]
        Change Skills [Arshes] - [001: Fireball (original)]
    Branch END
Else
    Conditional Branch: [Arshes] is [001: Fireball (original)] learned
        Control Switch: [Fireball learned by Arshes] is ON
    Branch END
Branch END


(3) That's enough if all you want to do is make it so that the skill can only be used if you have the item. If you want the item to be consumed upon using the skill you will need one more common event. We will call this one "Fireball Skill" and you will leave it's Trigger as None. Now, go to your skills database and set the original fireball skill to call this common event. Now, we need this event to do one thing: reduce the number of gold mushrooms we have. That's pretty simple, but keep in mind that paralell processes do not run during battle, so you will need to reproduce a simplified version of the first event within this one. If we run out, we will need to disable the skill, but we will not need to make allowances for re-enabling the skill since you will not bee able to replenish your gold mushroom stock until you are out of battle, and then our second event will do it's job. SO, let's make it:

It ought to look like this:



To set this event-based system into motion, all you need to do is turn on the switch "Initialize Reagent Skills". You can do that at the very beginning of the game. There, that gives us a perfectly good event system for reagent-based skills. Now, you might think: what if I want to make more skills like this? Will each one take two common events? The answer, of course, is no. It will only take one more common event, since for the skill disabler eveny, all you need to do is put an additional conditional branch underneath. To show you, I will add another skill to our event. Let's say this one is for Basil, and it is the skill Heal, which takes a Green Herb.

"Skill Disabler" should look like this:


Conditional Branch: Switch [Fireball learned by Arshes] is ON
    Conditional Branch: Item [Gold Mushroom] is in inventory
        Change Skills [Arshes], + [001: Fireball (original)]
        Change Skills [Arshes] - [002: Fireball (dummy)]
    Else
        Change Skills [Arshes], + [002: Fireball (dummy)]
        Change Skills [Arshes] - [001: Fireball (original)]
    Branch END
Else
    Conditional Branch: [Arshes] is [001: Fireball (original)] learned
        Control Switch: [Fireball learned by Arshes] is ON
    Branch END
Branch END
Conditional Branch: Switch [Heal learned by Basil] is ON
    Conditional Branch: Item [Green Herb] is in inventory
        Change Skills [Basil], + [003: Heal (original)]
        Change Skills [Basil], - [004: Heal (dummy)]
    Else
        Change Skills [Basil], + [004: Heal (dummy)]
        Change Skills [Basil], - [003: Heal (original)]
    Branch END
Else
    Conditional Branch: [Basil] is [001: Heal (original)] learned
        Control Switch: [Heal learned by Basil] is ON
    Branch END
Branch END


Now, the event Fireball remains the same. All you have to do is make an event which is analagous to Fireball, but which applies to Heal instead.

Hopefully that all makes sense. Be sure to post if you don't understand.
« Last Edit: August 11, 2007, 06:15:08 PM by modern algebra »

pokeball :)OfflineMale
********
Cheese
Rep:
Level 95
?
sweet work man! now I can just give them a link.  ;D
Watch out for: HaloOfTheSun

*****
Ancient Mummy
Rep:
Level 90
Cooooool :D

You made another one !
Great work !
I will take time and read it all later ;)

**
Rep:
Level 87
I am Hitler's sidekick.
I was reading this and thinking "is there any way to do this with weapons or armor that must be equipped to use a skill?" Well...is there?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Yes.


Conditional Branch: Switch [Fireball learned by Arshes] is ON
    Conditional Branch: Armor [Chain Mail] is equipped
        Change Skills [Arshes], + [001: Fireball (original)]
        Change Skills [Arshes] - [002: Fireball (dummy)]
    Else
        Change Skills [Arshes], + [002: Fireball (dummy)]
        Change Skills [Arshes] - [001: Fireball (original)]
    Branch END
Branch END

Of course, it might be a little different, since you might not want to even have the skill show up in the skills section, in which case you would just not bother with a dummy skill.

***
Rep:
Level 87
ohheythar :O
Very awesome!
This helps alot, I maybe will use it in my game.

*
Meet me in the middle
Rep:
Level 89
or left of the dial.
For frequently finding and reporting spam and spam botsSecret Santa 2012 Participant
Very awesome!
This helps alot, I maybe will use it in my game.
Can you say bump?

**
Rep: +0/-0Level 85
How would i go about if i wont a skill to be used for 2 or 3 weapons EG. The skill heal and the weapon wand or rod
and for different actors