Twisted

Villager
Member
Joined
Jun 6, 2020
Messages
22
Reaction score
7
First Language
english
Primarily Uses
RMMV
Hi folks :p
So im looking for a little help as im abit stumped.
So i am trying to make it so a player can enter a password/code and receive specific item(s).
The code i have so far is this:

if ($gameActors.actor(9).name() == "M")

{

$gameSwitches.setValue(20, true);

}

which works fine for 1 code = 1 item(s).

What i need is something along the lines of:
Password:M = Item(s): 7 gold, 1 sword
Password:S = Item(s): 30 gold, 1 sword, 2 potions
Etc etc.
But i need it to all be in one event, common event. I also need it so each password can only be used once, while the rest of the event/script/passwords remain working until purchased.

Does this make sense?

I am currently not good with variables or the script, which is why im struggling.

Many Thanks
Mat
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,826
Reaction score
9,476
First Language
German
Primarily Uses
RMMV
absolutely no need for any script here - there should be an official blog post about how to use a fake actor to hold a password without any scripts at all.

then you only need a series of conditional branches that compare the actor name with the different possible passwords. It is important to disable the else branches for better readability here.
In each case if the password is detected, check by switch if that password has been used before.
if no give the reward and turn on the switch for "password used".

no need for a script, the conditional branch option for a name check is on page two of the conditional branch window. And it is better to use a conditional branch than a script sequence if you want to provide multiple different passwords.
 

Twisted

Villager
Member
Joined
Jun 6, 2020
Messages
22
Reaction score
7
First Language
english
Primarily Uses
RMMV
absolutely no need for any script here - there should be an official blog post about how to use a fake actor to hold a password without any scripts at all.

then you only need a series of conditional branches that compare the actor name with the different possible passwords. It is important to disable the else branches for better readability here.
In each case if the password is detected, check by switch if that password has been used before.
if no give the reward and turn on the switch for "password used".

no need for a script, the conditional branch option for a name check is on page two of the conditional branch window. And it is better to use a conditional branch than a script sequence if you want to provide multiple different passwords.
Thanks @Andar
This seems like the answer, not tried it yet.

It amazes me how things that are so simple can confuse anyone.
Cant see the forest for the trees
:p
 

Twisted

Villager
Member
Joined
Jun 6, 2020
Messages
22
Reaction score
7
First Language
english
Primarily Uses
RMMV
@Andar
Hi there,
i have tried this method and believe i am make some mistakes as i cannot get it to work.
is there any chance you could send some visual examples of the process please?

Many Thanks
Mat
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,826
Reaction score
9,476
First Language
German
Primarily Uses
RMMV
can you post what you have? I have some problems with making example pictures, but I can spot and correct your mistakes
 

Twisted

Villager
Member
Joined
Jun 6, 2020
Messages
22
Reaction score
7
First Language
english
Primarily Uses
RMMV
can you post what you have? I have some problems with making example pictures, but I can spot and correct your mistakes
@Andar
i hope this helps, its just confusing me a little
 

Attachments

  • prntscrn1.png
    prntscrn1.png
    758.9 KB · Views: 4
  • prntscrn2.png
    prntscrn2.png
    712.8 KB · Views: 4
  • prntscrn3.png
    prntscrn3.png
    710.5 KB · Views: 4

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,826
Reaction score
9,476
First Language
German
Primarily Uses
RMMV
first problem is that if you have a switch as a condition, you don't need to check it as a conditional branch.

second problem is that if one of the codes is used, the first page is disabled in both cases so the other code can no longer be executed.

both together comes from using multiple pages - this is one of the few cases where using multiple pages is a bad thing.

what you should have done is doing all on a single page.

one sequence for one code would be:

if name of redeem code is A
>if switch rc1 is on
>> code is already used
>else
>> give gold
>> control switch rc1 = ON

and then repeat for each code
 

Twisted

Villager
Member
Joined
Jun 6, 2020
Messages
22
Reaction score
7
First Language
english
Primarily Uses
RMMV
first problem is that if you have a switch as a condition, you don't need to check it as a conditional branch.

second problem is that if one of the codes is used, the first page is disabled in both cases so the other code can no longer be executed.

both together comes from using multiple pages - this is one of the few cases where using multiple pages is a bad thing.

what you should have done is doing all on a single page.

one sequence for one code would be:

if name of redeem code is A
>if switch rc1 is on
>> code is already used
>else
@Andar
Ok so here is what i have done, now it seems to work as i want it.
If you could just give it a quick check i would be most appreciative.
Many Thanks
Mat
>> give gold
>> control switch rc1 = ON

and then repeat for each code
 

Attachments

  • prnt1.png
    prnt1.png
    870.1 KB · Views: 3

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,826
Reaction score
9,476
First Language
German
Primarily Uses
RMMV
looks ok
by the way, it is easier to do screenshots with alt-prtscrn instead of just prtscrn. that limits the screenshot to the active window, making them better readable.
 

Twisted

Villager
Member
Joined
Jun 6, 2020
Messages
22
Reaction score
7
First Language
english
Primarily Uses
RMMV
@Andar
Everyday is a school day!
Thank you for your help
This issue has cost me a day lol
next question: Can i +1 you or similar. Your response was both timely and exact in solving my issue.
Regards
Mat
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,069
Reaction score
2,478
First Language
English
Primarily Uses
RMMV
next question: Can i +1 you or similar. Your response was both timely and exact in solving my issue.
You should see a button on the bottom of every post that says "Like."
 

Latest Threads

Latest Profile Posts

With the new phone, I can now play a lot of old RPGs that my old phone just didn't have room for. Some RPGs definitely show their age even with updated graphics and quick saving.
I don't think I have ever stuck to a project this long....And I'm still just in the planning stages basically xD
It's not about the engine, it's about the resources.
After several days, my new pc is finally built and working. What an ordeal!
Quest_Shop_Plugin.png

Harold will need to do a lot of shopping on his quest, so I thought I'd try tackling the shop design tonight.

Forum statistics

Threads
121,963
Messages
1,145,500
Members
160,239
Latest member
LonelyGoji
Top