Thanks for the advise @ashishcw , and sorry for the late reflection. Been working through the function and finally I can say I sort of figure it out. I have checked various native functions, and turns out, there isn't (at least as far as what I can more or less understand) a function that can return the value of the save slot player is using. My best guess is the STAT LOAD function (Oh yeah btw I turn to C++ as it somehow managed to load stats lol) however most of the time it only returns false without any regularities. My conclusion is that most likely there is not really an explicit "save" concept for this game. There are only combinations of stats values ready to be read as a whole. (Of course there should be a sth like "stats set index" written somewhere in the memory to tell the game which set of stats should be called but as far as I know there's no way to dig it out)
So, for someone who is working on making addon stats to the save data, here I recommend the solution I use. As a reverse to the save mechanism, I use the STATS::STAT_GET_(whatever datatype u want to get) to call several stats(e.g. people u killed, time spent driving a car etc. Full list accessible at updates.rpf/common/data/spstatssetup.xml with openiv) and, say, put together to generate a (very likely if it is long enough) unique serial. Then u can output it in an ini file and put all ur custom stats data under their respective sector. At last, u can setup a script to generate the same format of serial after game start and compare if there is any match in the ini file. If all goes well, the match should lead u to the correct slot. The final step I have not tested practically, but I figure there will be less uncertain, for there should always be a way in any system to monitor the change of the files. So, we can set an eventhandler for the change of files under save folder(which can only mean saving games), and trigger the game to manipulate our ini file.
That's how I make this function work. Hope it can help somebody out. And thanks again @ashishcw u have inspired me a lot!
Maffine21
View profile on GTA5-Mods.com »
Posts made by Maffine21
-
RE: Help with savegame scripting pleeeeeease
-
RE: Help with savegame scripting pleeeeeease
@ashishcw Hi, thanks a lot for the advise, unfortunately what I am looking for is a little bit further. Please let me explain. What I'm trying to do is the same creating a config file thing. However, I am trying to, say, create a series of booleans, each of them represent whether I have acquired the special ability. Then, depending on which save I'm loading, the game can read the respective data in the config file and decide whether to unlock the reward. For example, if I load an old save, in which Franklin hasn't finished the addon missions, then Franklin doesn't have the abilities. Then I switch to another save in which Franklin has already finished the missions, so he has the abilities. Do you know if there is anyway I can achieve this? Much appreciated : - )
PS Sorry for my bad explanationDon't know if I make myself clear
-
Help with savegame scripting pleeeeeease
Hello guys, here's a noob on gta scripting. I'm trying to make some functions to add special abilities to my characters (fireproof, increase maximum health etc) as rewards of completing my missions (just like what is in GTASA and GTAVC). Problem here is I would like these abilities only accessible in the savegames in which I completed the missions and "acquired" those abilities like a "native" skills like stamina, strength etc.
I did some searching on Google, and all I found is how to make a function run after any game start. One possible solution someone mentioned is using WritePrivateProfileString function to modify config files but this seems impossible to hold and read different data to different save slots.
Please can anyone tell me is it possible to attach some addon properties to a game file through scripts or where did Rockstar put the code that stands for the skill points of characters? Many thanks for help.PS English is not my native language. Apologies for any poor English.
PPS I'm currently coding with C# because I have learnt a few lessons. I would try to change to C++ or LUA if it is really necessary.