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,894
Reaction score
9,516
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,894
Reaction score
9,516
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,894
Reaction score
9,516
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,894
Reaction score
9,516
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,142
Reaction score
2,528
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 Posts

Latest Profile Posts

Wow! This game may be one of the best Maker games I've ever seen! Come hang out with us while Drifty and I experience this masterpiece:LZSjoy:
The team and I are taking a 2 month break from Evergloom (now in it's second year of development) to enter a Gamejam! We work pretty well together now so hopefully we can create something cool.

We've decided on a village idle game, because of the Jam's themes!! It's exciting to be working on something new!g11.gif
New Free Music! This is an epic orchestral called "Break These Chains." I think I posted a preview of it awhile back, but now it's finally available to download and use!


I hope everyone enjoys!
Recently played OneShot and it's reminded me how a game doesn't need to be very long or have a big complex story or gameplay to be good and interesting. It's a RPG Maker game that does unconventional things I would never dare trying to do but it's a cool one nevertheless.
Going live in 5 for tonight's stream! Kytt is going to be playing Dead Space for the first time, because she thought it would be funny for people to watch her play a game with jumpscares. Twitch

Forum statistics

Threads
122,116
Messages
1,146,635
Members
160,403
Latest member
FIL2
Top