ffman1985 Posted January 4, 2023 Posted January 4, 2023 (edited) I would like to know if it is possible to execute some more complex instructions in the cheat script, eg. saving and loading state? (Like the following:) If peek($123abc)==$ab Save to kof97.sv0 Endif If peek($123abc)==$cd Load from kof97.sv0 Endif I would like to create a script that automatically make a save under certain circumstance, and automatically load the save under another circumstance. If it is possible, what is the syntax for saving and loading a state? Edited January 4, 2023 by ffman1985
Tux Posted January 4, 2023 Posted January 4, 2023 (edited) Well the functions do not exist yet, but it should be trivial to do, although it's a little hard to imagine how you could use that, but I'll leave that to you... you now have : set_save_slot number : where 0 <= number <= 9, to choose save slot, like key F3 save_state : like key F2 load_state : like key F4 Edited January 4, 2023 by Tux
ffman1985 Posted January 4, 2023 Author Posted January 4, 2023 (edited) Hello, Tux. Thank you for adding the new function. With this new function, I have created script that change the gameplay to verus mode for the Real Bout Fatal Fury Special (rbffspec) using the save/load function in cheat script. (I will create more of it for other old fighting games). Here is my work, feel free to have a look: https://drive.google.com/file/d/1s1HEDh9s_ncRwOd0-Qx3eZkNSk_DjTz1/view?usp=share_link In the txt file, there is also a boss hack and a practice mode cheat. Press Start button can change character during battle and you Do Not need controller 2 to select character for player 2. All the 3 new cheat are on the top of the file. Again, thank you for your great effort in making that new fuction. Edited January 4, 2023 by ffman1985
ffman1985 Posted January 5, 2023 Author Posted January 5, 2023 Also, can I use any random number function (eg between 1 to 100 or 0 to 99) in the script? If yes, what is the syntax of it? I want this because I want to control the probability of the cases to happen, something like the following: if RND<50 poke $12345 $ab else poke $12345 $cd endif
Tux Posted January 5, 2023 Posted January 5, 2023 Not really convinced here, when I use a cheat I want it to be either enabled or disabled, not 50% chance.
ffman1985 Posted January 5, 2023 Author Posted January 5, 2023 I am not using that for cheating. I use the script to make a vs mode for some older fighting game. I want that 50/50 probabilities function, because i want to set that 50% chance playing the battle music of the 1p character and 50% chance playing that of 2p character.
Tux Posted January 5, 2023 Posted January 5, 2023 oh well... ! I guess it can be done, not top priority, I'd like to find the problems with the cps2 driver 1st, but ok... !
Tux Posted January 5, 2023 Posted January 5, 2023 Well after some tries : the basic random function in C is not exactly random, it expects some random seed to be fed, so you can initialize the seed yourself, or call repeatedly the rand() function for a real random interval this time to get a chance to get some real random number... ... too complex for that. Luckily for you there is an alternative : openssl provides its version of a random number generator and random numbers are important for cryptography so it's serious this time. Since it's already used by curl, it's just a lib which was already here anyway. The result : a function rnd() which returns a random byte, that is, a number between 0 & 255. So you see, simple request, but not so easy solution... ! But anyway it's done...
ffman1985 Posted January 5, 2023 Author Posted January 5, 2023 (edited) Hello, Tux, appreciate for making this new function for me and also the fixing of the CPS2 Save function. I am so sorry that I have requested so much in a short period of time. (No next time). With the three new functions for cheat scripts, it allows to do something extra and more complex. I hope I can make sth useful and share here in the future. Edited January 6, 2023 by ffman1985
ffman1985 Posted January 6, 2023 Author Posted January 6, 2023 Just use the new rnd() function on my vs mode cheat of rbffspec, it nows have equal chance of playing the bgm from p1 character and p2 character (unlike the old version which only play the bgm from p1 character since loading from a savestate.). Here is the updated file: https://drive.google.com/file/d/1Jl1Il-bQaibfx5Mf05y6eAXctszJh5CA/view?usp=share_link Again, thank you Tux for making those new functions for the cheat script.
mer-curious Posted January 6, 2023 Posted January 6, 2023 Nice job, ffman1985! The lack of a practice mode in older fighting games is really a down side for newcomers and/or for players who want to try new combos. I guess they weren't added even in recent releases of the games such as the ones for the Switch, which is a shame. I tried here your cheat and it worked Ok for the "Practice Mode", but the "VS Mode" is returning the following error: And then I have to click Ok many times to continue. Some times it works, some times it gets stuck there prompting "Ok" and I never am taken back to the game. My NG BIOS is set to "Unibios 4.0" and the region is "Japan" and Console". Hopefully this can be fixed. Thank you anyway for sharing your work here. 👍
ffman1985 Posted January 6, 2023 Author Posted January 6, 2023 (edited) Hello, mer-curious, thank you for trying my new cheat. You see this error in the vs mode because this script use the new function rnd() which is not supported in the public version of Raine yet, you should first update Raine through git first. If you do not use git, you can also try my older version of the script (in a older post), but that always play the music of the 1p character. Sorry that I didn’t make a clear description of my work. There are other things should be bear in mind: 1. This vs mode script (and also my future vs mode script), will make savestate using the saveslot no.9 (as I expect no one use the savestate of big no.). The savestate creates after the “how to play” screen, in other word everytime you use this script will make a savestate once. (It is actually not needed to save everytime, as the save producted should alway the same, provided that you don’t go to the option to make change. I can modify the script to remove the autosave part, but I think it will be not user-friendly for other user as they may not know they should make a savestate in slot 9 in advance.) 2. All of my script (include my future work) are expected to enable early (on or before the how to play screen). 3. Sometime my work includes the change of the input. Eg. In practice mode, after 1p selected character, the 1p controller will control p2 side until p2 selected character. In this short period of time don’t restart Raine (by pressing f1), otherwise the control in p2 is not restored to normal. If this is the case, don’t worry, simply close Raine and load the game again. 4. I am using the neogeo unibios v.4 japanese console mode in creating my script. (But i guess it is no problem even using other bios or mode) 5. The vs mode script and practice mode script should not enable together. So remember to close the unuse one and restart(f1) when switching other mode. Edited January 6, 2023 by ffman1985 1
ffman1985 Posted January 6, 2023 Author Posted January 6, 2023 If there are no other bug reported within one week, i will post the similar cheat for other fatal fury games and kof94-95. 1
mer-curious Posted January 7, 2023 Posted January 7, 2023 Thank you for the explanation on your cheats, ffman1985. Perhaps you could add some of these observations in the cheat as a comment as well as happens with other cheats and then reuse the comment in your other creations. We never know where these files might get in the inter webs and people might not know about the Raine forums if they break something eventually. I haven't tested the VS Mode cheat yet, but it no longer produces those errors in the latest Raine release. Thank you again for sharing your work.
Tux Posted January 7, 2023 Posted January 7, 2023 Yep I second the opinion of mer-curious : comments welcome ! Most of the scripts currently in raine are from a conversion from mame, and there are not lots of comments (sometimes there are texts introduced by comm which appear at the bottom of the screen when you select the cheat...). Anyway I added the ability to add comments anywhere on a line starting by ; or #, and here you are even patching the rom from what I saw, and I have no idea what most of these poke do, that's where I see you are an expert at doing these patches, but comments are really most welcome here... 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now