Twisted

Villager
Member
Joined
Jun 6, 2020
Messages
19
Reaction score
5
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
34,758
Reaction score
8,967
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
19
Reaction score
5
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
19
Reaction score
5
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
34,758
Reaction score
8,967
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
19
Reaction score
5
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
34,758
Reaction score
8,967
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
19
Reaction score
5
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
34,758
Reaction score
8,967
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
19
Reaction score
5
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
3,154
Reaction score
1,865
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 Profile Posts

Been playing through Skies of Arcadia again, and it really makes me wanna see someone try to implement how ship battles were done in the game into RPG Maker (or really just in general).
split.png
split view of both versions of the pocket city you traverse through. there's differences like areas only being accessible in one version of Autumn Bay. or events that only happen in one or the other.
theortically if there were a developer who spied on people's game playthroughs and changed things in real time to make it harder for them, what might be said game developer's motivation?
Hi everyone! Enjoying this nice long weekend. How are you all doing? :)
I just successfully tested having events check if specific actors are in a particular party slot and then changing image to match. This will let me make scenes take into account who is in the party at the time and arrange them accordingly - this is important since I'll have extra actors beyond current party. The script used is the same from MV and is compatible with my current core plugin setup in MZ. Thank goodness.

Forum statistics

Threads
118,433
Messages
1,115,910
Members
155,390
Latest member
knutsendaniel
Top