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
37,942
Reaction score
10,523
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
37,942
Reaction score
10,523
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
37,942
Reaction score
10,523
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
37,942
Reaction score
10,523
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
7,563
Reaction score
5,328
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

Someday, I hope they make a game where 95% of the animation budget went to turning valves and opening door animations, leaving every other animation looking like a CDI zelda cutscene.
programming at 12 years old: "I love how it works!"
programming at 18: "I love that it works."
programming at 25: "I love why it works."
programming at 30: "I love when it works."
programming at 50: "How did this work?"
Why can't I insert picture in this profile post? Only insert image -> by URL. No option to upload from my pc?
Trying out a new Battle Ui.
BattleUI.png
And.... I couldn't help myself. I linked my card game Lore and Concepts back to my RPG Maker game and made them take place in the same universe. I think that means I need to get back to work on my RPG Maker Game. There's obviously a story here my brain wants to tell.

Forum statistics

Threads
129,758
Messages
1,204,888
Members
170,847
Latest member
Reddyfrog
Top