Learn skills.

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
Ok, I am trying to write a script where actor learn skill from the item. For example, you got the book and you want to learn by read that book. 

I know you can do that by add learn skill or by call a common event. What I can't do is how to make the item can only be consumed specific to the class. That means you can't use that item on the other classes and you can't use that item if the skill already existed.

So far, what I can do with eventing is to make the common event but can't prevent item from being consumed though I can prevent the skill being added.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
I'm not quite sure about this. But you can modify "def usable?" in Game_Actor to meet your custom condition

Edit :

That method is defined in Game_BattlerBase
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You don't need to resort to scripts to do this.


Just use conditions to see if the actor is the correct class, and if they don't already know the skill. If that's the case, have them learn the skill.


If your item is set to consumable and they AREN'T the correct class, or they already DO know the skill, just do a Change Items to give it back to the party.


Player will never know.
 

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
You don't need to resort to scripts to do this.

Just use conditions to see if the actor is the correct class, and if they don't already know the skill. If that's the case, have them learn the skill.

If your item is set to consumable and they AREN'T the correct class, or they already DO know the skill, just do a Change Items to give it back to the party.

Player will never know.
I can do what you said but what I am trying to do is when you use the item on the wrong class or the skill already learned, the item will not be consumed, similar to when like in your OS when you click on something wrong a pop up message that won't allow to go any further.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
That's why you +1 the item if it's NOT the right class or if the skill is already learned.

The item is consumed before the common event is run. In the common event, you are testing to see whether the item SHOULD have been consumed, and if it shouldn't have, you give it back.

You don't need to use a script.

Something like this:

Conditional Branch: Actor is x Class Conditional Branch: Actor has learned Skill Comment: The actor already knows the skill, so should not be able to use this item again. Put the item back in inventory Change Items: Book + 1 Else Comment: Actor is the correct class, and has not yet learned the skill. Teach it to them. Change Skills: Actor learn Skill x Branch EndElse Comment: The actor is not the correct class, so should not be able to use this item. Put it back in inventory Change Items: Book + 1Branch EndSo ...The item is consumed

If the actor is not the correct class, the item is given back to the party

If the actor is the correct class but already knows the skill, the item is given back to the party

If the actor is the correct class but does not know the skill, the skill is given to the actor (and the item is NOT given back to the party)

The end result is that the skill is either learned, or the book remains in inventory. As I said, the player does not know (and does not need to know) that the book was removed and then added back.
 
Last edited by a moderator:

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
I know what you say but you will see the item consumed by the players instead of it cannot be used and the text is fade out when it is not the right class. What I was trying to do is like the title screen the continue button prevent you going further by playing a Buzz sound if you have no saved game.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Is it the person using the item, or the person the item is being used on, who has to be the right class? Or are you bypassing the 'select target' option for these items?


In the items list, there's an enabled? check. You could just look at that method, and if it's one of the particular items that requires a certain class, set the flag depending on whether or not the actor is that class. Window_ItemList is what you're looking at, and that is used both in and out of battle.


However, you only have a 'user' of an item in battle. Outside of battle, you don't know who is using it. Then it relies on the item having a target and checking THEIR class. The problem with that is you don't choose the target until AFTER you've chosen the item, so there's no way you can disable/grey it out before you even know who the target is going to be. Maybe you'd then need to extend it to enable the item, but disable the actors it can't be used on. Getting very messy.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
yeah, graying it out is only possible for battles (via extending/editing the enabled? method)... for non-battle usage, you would need to rework how things go so that there's a user of the item before the item is selected... probably an actor inventory script can do (so that the item has a specific user already)
 
Last edited by a moderator:

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
If you do what Shaz was saying, you can also add a message box that tells the player they're not the right class to use the item and even play a buzzer sound. And they shouldn't see it get consumed, but if they did you could simply reverse the concept. Make the item non-consumable, then remove it if they are the right class.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top