Sukaiba Posted September 7, 2024 Share Posted September 7, 2024 I'm trying to have the game run a randomization everytime you change from the main menu/item collection, so far I got this much working on the modmain.lua (I'm a total noob at .lua lmao) local array={"_box","_1"} local randomIndex = math.random(1, #array) local stuff = array[randomIndex] RemapSoundEvent("dontstarve/HUD/Together_HUD/collectionscreen/music/jukebox","music_mod/music/juke"..stuff) This chooses between juke_box and juke_1 for the item collection, the problem is that it only runs once, and stays like that until the entire main menu is reloaded (Like when you Apply Mods) Anyone know what kind of 'if' statement and condition I would need for the randomization to happen everytime the item collection screen is exit/returning from it, to main menu? Link to comment https://forums.kleientertainment.com/forums/topic/159550-if-for-loadingexiting-main-menuitem-collection/ Share on other sites More sharing options...
Haruhi Kawaii Posted September 7, 2024 Share Posted September 7, 2024 4 hours ago, Sukaiba said: I'm trying to have the game run a randomization everytime you change from the main menu/item collection, so far I got this much working on the modmain.lua (I'm a total noob at .lua lmao) local array={"_box","_1"} local randomIndex = math.random(1, #array) local stuff = array[randomIndex] RemapSoundEvent("dontstarve/HUD/Together_HUD/collectionscreen/music/jukebox","music_mod/music/juke"..stuff) This chooses between juke_box and juke_1 for the item collection, the problem is that it only runs once, and stays like that until the entire main menu is reloaded (Like when you Apply Mods) Anyone know what kind of 'if' statement and condition I would need for the randomization to happen everytime the item collection screen is exit/returning from it, to main menu? I remember that in FMOD there is an option to play sounds randomly, which seems easier than scripting, at least for me. Link to comment https://forums.kleientertainment.com/forums/topic/159550-if-for-loadingexiting-main-menuitem-collection/#findComment-1746301 Share on other sites More sharing options...
Sukaiba Posted September 7, 2024 Author Share Posted September 7, 2024 (edited) 12 hours ago, Haruhi Kawaii said: I remember that in FMOD there is an option to play sounds randomly, which seems easier than scripting, at least for me. Oh yeah, I am aware its possible to randomize it The problem is that it for example with 'juke_1', that's an event that has an 'intro' (plays once) and a 'loop' (after intro) soundfile While 'juke_box' can pick randomly and loop whatever soundfile picked, there's no way to tell the randomization to play one sound once, and then keep looping another afterwards, hence why I'm looking for a way to randomize the sound event selection instead Edited September 7, 2024 by Sukaiba Link to comment https://forums.kleientertainment.com/forums/topic/159550-if-for-loadingexiting-main-menuitem-collection/#findComment-1746442 Share on other sites More sharing options...
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