I know this question like this has been made a couple times but I still don't get it. I want to make a special building you can only enter when you complete certain objectives, but you can only complete one per save file, so you have to have at least 3 save files to get access to the building. There would be 3 variables, each for it achievement, and when you have completed those three in each save file, the building would be open for you. How can I make something this? Also sorry if this wasn't the right place to post this, I wasn't sure if this was it.
How to have a global variable that keeps its value over multiple save files?
RGSS3 Script Requestsit's called persistent variables, and it needs a script.
there have been several scripts made for this, but a lot of the old script sites are down.
one such script should still be available on himeworks.com however.
there have been several scripts made for this, but a lot of the old script sites are down.
one such script should still be available on himeworks.com however.
Moderator note: Moving to RGSS3 (VX Ace) Script Request
You're probably looking for something with 'global' or 'persistent' in the title.
You're probably looking for something with 'global' or 'persistent' in the title.
A variable or a switch? Either way you could have the event run a script which reads the data of save files.
What this does is print the value of the game variable 001 from Save01.rvdata2 in the debug console. But you could also use it as a condition to flip a switch.
With 3 switches ON (meaning true), the door opens.
The trick is going through all existing save files. It's been awhile since I've played with Ace so I'm not sure what the most effective way to loop through the number of save files is.
File.open("Save01.rvdata2")do |file|
Marshal.load(file)
saved_var1 = Marshal.load(file)[:variables][1]
p saved_var1
end
What this does is print the value of the game variable 001 from Save01.rvdata2 in the debug console. But you could also use it as a condition to flip a switch.
if saved_var1 > 0
$game_switches[1] = true
end
With 3 switches ON (meaning true), the door opens.
The trick is going through all existing save files. It's been awhile since I've played with Ace so I'm not sure what the most effective way to loop through the number of save files is.
Thank you everyone for your responses! Unfortunately the scripts Hime has are for RPG Maker MV, but after doing some research, I found a script by Fomar0153 for VX Ace that does what I want perfectly. Problem solved!
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/how-to-have-a-global-variable-that-keeps-its-value-over-multiple-save-files.135515/