Items Obtained Based on Class?

So, I have my game set up so that a player can choose their gender and their class at the beginning. There are three classes to choose from; soldier, caster and marksman.

What I want to do is create certain chests that give an item based on the character's class. Since the player can choose their character at the start I need a way to create this event to determine which actor was chosen, male or female, and then determine what class the actor is; soldier, caster or marksman.

I tried using conditional branches but I could only get it to work for one actor, not both. Basically, it would only work for the first actor, the male, that was listed in the conditional branches. When I tried to have it check for the female it would mess up by giving it the wrong item, the item meant for the first class (soldier) and doubling that item. Obviously, I had it set up completely wrong.

I don't know if there is an easy way to event this or if I need some sort of script. If someone can help with this  I would really appreciate it. I hope I was clear enough. If anyone needs better clarification, please ask.

Thanks,

Bynks
conditional branches is the correct way - if that didn't work for you, then you made a mistake in the event logic.


Please post screenshots of all event pages, and we can tell you where you went wrong and how to correct the bugs.
It sounds like you have your two actors set up as separate actors in the database. If the player gets to choose ONE actor, and their attributes are based on those choices, then only have ONE actor set up in the database, and use the Change Actor Name, Change Actor Class, Change Actor Graphic commands to customize that one actor.


Then your conditional branch can use Actor 1 instead of having to determine which actor was chosen.
Shaz, I have it set up that way because I'm not sure how to get victor's battlers to work without it being set up as two different actors, since it requires a note tag to get the right actor battler to show. Is there a way to make it so that the battler switches based on the character choices? I haven't seen anything in my searching about a way to make that work with only one actor.

Andar, this is how I have the branches set up to check for the character and then the class:

Spoiler
Event%20Screenshot_zpsrp3d0vqw.jpg
It was too long to get the whole chest set up in one shot, but everything else is there to make the chest itself work. It just won't check beyond the first actor. I tired setting up two separate conditional branches for each actor but it didn't work that way either.
you don't need the else-branches if the other combinations can't be available at the same time.

Set it up first to check if the actor used is either Eric or Bynks - that will require an else.

Inside each of the two branches, make only conditional branches "Eric is XY" without elses (for Eric in one, for Bynks in the other branch of the first condition)

That will make it much easier to read, prevent any double condition logic (which is most probably where it currently fails), won't indent the branches as fas as they are now and has some other advantages.
Andar,

Thank you! I had to tweak this a bit. Inside the initial conditional branches I added for it to check the character, as you suggested and then put the single conditions for each class. However, when I tried it this way it wouldn't work. Nothing happened after activating the chest.  I actually had to add the 'else' into the first two sections of the sub-conditions to get it to register the different classes after it had determined the character being used. I do believe my problem has been solved! *Fingers crossed* I'm going to be testing this with each selection to make absolutely sure it works every time. I'll update once I have this done and let you know.
Then you have something else in your event logic that isn't on the same logic level - I can't tell because you didn't give the full event.

But the method I described works without the elses as long as no other logic sequence interferes.
The only other thing was the original script for the chest. I just took the generic quick event for the treasure chest, removed the add gold option and the text and the put in the conditional branches. I didn't change anything else on it, but it wouldn't work without the else.

I tried this method, leaving off the else on the last branch of each sub-section. The firs two will register on each character but the last one on each character will not. When I choose caster then try to open the chest it does nothing.

Here's how I have it set up now:

Spoiler
Event%20Screenshot%202_zpsftguzxzf.jpg
It's set up the same way for the second character, it just doesn't have enough room to show it. The caster section in each one doesn't work at all. I tried adding else to it and leaving it blank, that didn't work either. If I take out the else and just use each branch separately it won't register for any of the classes and simply opens the chest but doesn't give out anything. Not sure why it wouldn't register your way, since I didn't change anything that makes the chest work.

Here is the top part for the chest sequence and the control switch:\

Spoiler
Event%20Screenshot%203_zps1ghh5hrj.jpg
Edit: I went back through, re-did the branches back to your method and I still have the same problem. For what ever reason, the first two classes now work, when they wouldn't even register before, but the last class will not register at all on either character.

Spoiler
Event%20Screenshot%204_zpsvdnkkobu.jpg
They are set up the exact same way for each character, but the last class just refuses to work. It opens the chest but nothing is given.
move the control self switch command to the bottom - that is to switch the pages after you got the treasure, and if done before the page will be switched and aborted on next frame (which is probably the time when the third class is to be checked,
Okay I moved it to the bottom, but it still didn't work on the last class, just the first two. Is there a limit on how many conditional variables it can check or how much can be on one event page?
no, it shouldn't be limited.


What exactly happens if eric is a caster? can you give a screenshot of the class database of it and the event where the class can be changed?
I'm really glad you mentioned the event to choose the classes.... I'm a moron. I had it set to witch instead of caster.... 🤔

Yeah, I'm a bright crayon. 🤣

I fixed it.

Thank you so much for your help. It's now fixed and I know a better way to set up my class based treasure chests. For the life of me I never thought to check the intro event.

I'm marking as solved. Again, thank you so much! I really appreciate it!  🙂
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/items-obtained-based-on-class.42043/