Just wondering if there is a way to. Push data to the game before game loads

Status
Not open for further replies.

2DGameStudios

Veteran
Veteran
Joined
Oct 11, 2015
Messages
184
Reaction score
43
First Language
English
Hello Rpg maker community, I was wondering the following -


  Is there a way to pass information to the game, right now I have a html page before loading the game it self. I have html page open when you click on the game.exe. Is there a way to say I want to pass a certain amount of exp to the player before they start the game. I was thinking using the JSON data at first but I don't know if that would work or not, then I looked up the datamanager.js might be possible to do it from there. 


 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,774
First Language
German
Primarily Uses
RMMV
Please clarify what you want - usually, if you want the actors to start at a higher level, you increase the initial level in the actor tab of the database.


And please edit your title to tell us what you're wondering about - it will speed up responses to your topic not to keep us wondering what you want ;-)
 

2DGameStudios

Veteran
Veteran
Joined
Oct 11, 2015
Messages
184
Reaction score
43
First Language
English
OK so this is how i have my project set up.


I have index.php on my server which uses sessions to allow a player to connect once toy are signed in it brings you to the game page which is the game it self.


What I want to do is make a app.php/html page that while the player is at work, they can click a button on the website for ex - train sword skills which will give the player plus 20 exp - once they exit the app it pushes that 20 exp over to the game. So next time the game is open the player would have 20 extra exp points or a increase to the sword skill. 
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,774
First Language
German
Primarily Uses
RMMV
What can work in this case is that you can make a script with a command to load a value from your database, and then have that script called by an event command that loads the returned value into a game variable and add that to the actor automatically - perhaps a common event called on load or new game?
 

2DGameStudios

Veteran
Veteran
Joined
Oct 11, 2015
Messages
184
Reaction score
43
First Language
English
Thank you Andar for the helping on this topic still a little confused


So if I wanted to get a actor stats outside of MV how would I pull the data, Would it be JSON data or would it be a variable I made in MV and then referenced that variable outside of MV?


So lets say the following ex is happening. - 


Player A is playing the game fir 2 hours and now has to go to work, he gets to work and he knows he can not play the game at work so he loads the app which is load off the session once he logs in. He decedies that he wants to have his Hp increased so I have a variable delecared in a Javascipt as follows - 


function hp_Train(){
var hp = 0;
//Say the trained for 5 minutes
hp += 5;
}


How would I take the var hp and apply it in game to the player who is actor 1. Would i need a way for the game to grab the variable from the DOM and pass it in to the common event and then have that common event pass it to the actor Max_Hp?
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,774
First Language
German
Primarily Uses
RMMV
So if I wanted to get a actor stats outside of MV how would I pull the data,


Now I'm confused, because that is the opposite of something you wrote before.


What I suggested as a solution to your original problem was to have MV pull the data from your website (from the login database to be exact) and use that data (the gained EXP value or time or however you want to calculate the effects) in eventing to change the actor in the way you want.


Nothing before indicated that you want to pull data out of the MV database, because that is not as easy - can you explain for what you suddenly want to extract data from the game?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,482
Reaction score
12,026
First Language
English
Primarily Uses
RMMV
You wouldn't.  Assuming several people are playing your game, you would want to update a file that's strictly for their use - so you'd use a json file and would save it to the same location that MV uses for save files, not for data files (otherwise it would affect all players).  Then you'd make a mod to the program so when you load their save data, you also load this file that keeps their updated stats, you would update the stats based on what they'd earned, and then you'd set the data in that file back to 0 so they can start it all over again.
 

2DGameStudios

Veteran
Veteran
Joined
Oct 11, 2015
Messages
184
Reaction score
43
First Language
English
Now I'm confused, because that is the opposite of something you wrote before.


What I suggested as a solution to your original problem was to have MV pull the data from your website (from the login database to be exact) and use that data (the gained EXP value or time or however you want to calculate the effects) in eventing to change the actor in the way you want.


Nothing before indicated that you want to pull data out of the MV database, because that is not as easy - can you explain for what you suddenly want to extract data from the game?
 I was looking to make a leader board based on monster killed and stages cleared that when they logged in to the website they would be able to see who has the most monster kills.
 

2DGameStudios

Veteran
Veteran
Joined
Oct 11, 2015
Messages
184
Reaction score
43
First Language
English
You wouldn't.  Assuming several people are playing your game, you would want to update a file that's strictly for their use - so you'd use a json file and would save it to the same location that MV uses for save files, not for data files (otherwise it would affect all players).  Then you'd make a mod to the program so when you load their save data, you also load this file that keeps their updated stats, you would update the stats based on what they'd earned, and then you'd set the data in that file back to 0 so they can start it all over again.
Thank you Shaz and Andar
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,774
First Language
German
Primarily Uses
RMMV
@2DGameStudios, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


If you have something to add and your own post is the last one, simply edit that one. You also don't need to quote entire posts to answer, you can use the @username convention like I just did.


Additionally, you now personally experienced the reason why we say one problem - one topic. A leaderboard has nothing to do with the original question about giving the actor EXP (or other things).


Leaderboards are possible, but they work differently, simply because the security measures on the internet are there to prevent external data access. Please make a new topic for that so that people won't be confused with the EXP case.


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.


and:


I've moved this thread to Javascript Support. Please be sure to post your threads in the correct forum next time. Thank you.
 
Last edited by a moderator:
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I wonder if there's ever been an art challenge that involves drawing faces from the generator.
I'm sorry about earlier. I have the most hate and the most love for my art at the same time. Felt bad about my thread because I wasn't listening, and because I made it out of a bad mindset to begin with. S'another Thursday for me.

The main character of the book)
Things you can say about your rpg maker project but not your bf/gf: I'm not super committed but it's fun to play around with it.

Forum statistics

Threads
94,368
Messages
920,349
Members
124,134
Latest member
scrollstorm
Top