Is there a way to add the radio station back into the list of applicable radios that the player can select with the "next/previous" buttons? I scrolled through the list but samizdat is missing (although I'm sure your mod still adds it in a random sense)
Yes, the current code skips Samizdat when using the next/prev button. It should be easy enough to fix it so it no longer skips as follows. Note that I can't test this myself as I'm not playing the game right now.
You should be able to cut and paste the below to the end of the r6\scripts\Revive Random Samizdat Radio.reds file this mod installs. Add a couple blank lines at the end before pasting in the new code.
Yeah, you can modify the same function this mod does and then provide a menu for selecting the stations to exclude. I'll take a look at it next I get some time, which may be a while.
i made a workaround with a simple array. it works. thank you. but i have a question. how did you find this function? what docs or software did you use? @replaceMethod(RadioStationDataProvider) public final static func GetRandomStation() -> ERadioStationList { let array = [0, 1, 2, 3, 4, 5, 6, 7, 9, 14]; return IntEnum<ERadioStationList>(array[RandRange(0,10)]); }
You can see the code for the scripting layer of this game at https://codeberg.org/adamsmasher/cyberpunk - I suggest you clone that repository using git so you have a local copy. I use Visual Studio Code to read through it, since VS Code has very good multi-file search. Just open up the code and start searching for the stuff you're interested in. I found this code because I was interesting in the Pocket Radio in general for a couple of other mods I made.
To make changes you have two options: redscript lets you make changes like in this mod, using well rescript. CET lets you make changes using Lua. Both methods are good, both are very full-featured and each has its own strengths. Pick the one you find easier, more to your taste.
The RED modding wiki has some good redscript tutorials. It has them for CET & Lua, too! Dig around the site, it has a lot of useful info.
Finally, this discord is a fantastic resource - everyone on there is helpful and friendly with plenty of very experienced modders who will help you with your mod: RED modding discord.
This is a fun game to mod and it's not difficult - as your change shows. You're not too far from a general purpose "Favorite radio stations" mod, which I'm sure a lot of folks would appreciate having!
8 comments
You should be able to cut and paste the below to the end of the r6\scripts\Revive Random Samizdat Radio.reds file this mod installs. Add a couple blank lines at the end before pasting in the new code.
Good luck!
@replaceMethod(RadioStationDataProvider)
public final static func GetNextStationTo(currentIndex: Int32) -> ERadioStationList {
let uiCurrentIndex: Int32 = RadioStationDataProvider.GetRadioStationUIIndex(currentIndex);
// uiCurrentIndex = uiCurrentIndex == 4 ? 5 : uiCurrentIndex; // v1ld: don't skip Samizdat
let uiNextIndex: Int32 = (uiCurrentIndex + 1) % 14;
return RadioStationDataProvider.GetRadioStationByUIIndex(uiNextIndex);
}
@replaceMethod(RadioStationDataProvider)
public final static func GetPreviousStationTo(currentIndex: Int32) -> ERadioStationList {
let uiCurrentIndex: Int32 = RadioStationDataProvider.GetRadioStationUIIndex(currentIndex);
// uiCurrentIndex = uiCurrentIndex == 6 ? 5 : uiCurrentIndex; // v1ld: don't skip Samizdat
let uiPrevIndex: Int32 = (uiCurrentIndex - 1 + 14) % 14;
return RadioStationDataProvider.GetRadioStationByUIIndex(uiPrevIndex);
}
@replaceMethod(RadioStationDataProvider)
public final static func GetRandomStation() -> ERadioStationList {
let array = [0, 1, 2, 3, 4, 5, 6, 7, 9, 14];
return IntEnum<ERadioStationList>(array[RandRange(0,10)]);
}
You can see the code for the scripting layer of this game at https://codeberg.org/adamsmasher/cyberpunk - I suggest you clone that repository using git so you have a local copy. I use Visual Studio Code to read through it, since VS Code has very good multi-file search. Just open up the code and start searching for the stuff you're interested in. I found this code because I was interesting in the Pocket Radio in general for a couple of other mods I made.
To make changes you have two options: redscript lets you make changes like in this mod, using well rescript. CET lets you make changes using Lua. Both methods are good, both are very full-featured and each has its own strengths. Pick the one you find easier, more to your taste.
The RED modding wiki has some good redscript tutorials. It has them for CET & Lua, too! Dig around the site, it has a lot of useful info.
Finally, this discord is a fantastic resource - everyone on there is helpful and friendly with plenty of very experienced modders who will help you with your mod: RED modding discord.
This is a fun game to mod and it's not difficult - as your change shows. You're not too far from a general purpose "Favorite radio stations" mod, which I'm sure a lot of folks would appreciate having!