About this mod
Plays the MaiMai enter and exit audio when you get in or out of ANY vehicle.
- Requirements
- Permissions and credits
- Changelogs
- Donations
Should work as long as you have the correct Cyber Engine Tweaks version.
Hey, so this mod used to exist: Wholesome Vehicles. But for some reason the creator Inuktiplater has set it to hidden, so I remade it really poorly.
It's a simple lua code that plays the MaiMai exit and enter audio ON EVERY VEHICLE (idk how to do vehicle by vehicle), and the code has been completely made by Microsoft Copilot and ChatGPT + a few LLM models, I only did the debugging and prompting.
It should work fine and I'M AWARE IT'S TOO QUIET, that is because I couldn't edit the .bnk file, and won't be doing so because the mod would stop being a simple lua mod and move onto being a redscript mod and I don't know how to do all those.
There are other problems too: such as the enter audio being not being played at times, or being too quiet on vehicle exit, and weird volume differences across each vehicle. But I won't be fixing any of those because like I said it wouldn't be a simple lua code if I tried fixing those and I'm not qualified enough to work on those.
ALSO PLEASE, I'd love it if someone took over this mod and remade it better if they think they can, in fact I hope they do because I'm not a creator I'm just a consumer when it comes to modding, this is literally my first mod.
Version 1.4 (latest) code:
--------------------------------------------------------------------------------
-- Greet and Bye
--------------------------------------------------------------------------------
-- Configuration Constants
local CONFIG = {
POLL_INTERVAL = 0.5,
ON_SOUND_NAME = "v_car_makigai_maimai_ui_on",
OFF_SOUND_NAME = "v_car_makigai_maimai_ui_off"
}
-- Runtime State
local state = {
elapsedTime = CONFIG.POLL_INTERVAL,
wasInVehicle = false,
initialized = false,
ON_SOUND = nil,
OFF_SOUND = nil,
getPlayer = nil,
getMountedVehicle = nil
}
--------------------------------------------------------------------------------
-- Initialization - Wait for Game APIs to be ready
--------------------------------------------------------------------------------
local function initializeMod()
-- Safely check if required APIs are available
local gameReady, gameAPI = pcall(function() return Game end)
local cnameReady, cnameAPI = pcall(function() return CName end)
if not (gameReady and gameAPI and cnameReady and cnameAPI) then
return false -- APIs not ready yet
end
-- Initialize API references
state.getPlayer = gameAPI.GetPlayer
state.getMountedVehicle = gameAPI.GetMountedVehicle
-- Initialize sound references
state.ON_SOUND = cnameAPI.new(CONFIG.ON_SOUND_NAME)
state.OFF_SOUND = cnameAPI.new(CONFIG.OFF_SOUND_NAME)
-- Final verification
local player = state.getPlayer()
if not player or not player.PlaySound then
return false -- Player or audio system not ready
end
print("[Greet and Bye] [OK] Initialization complete. Mod is active.")
return true
end
--------------------------------------------------------------------------------
-- Main Update Loop
--------------------------------------------------------------------------------
registerForEvent("onUpdate", function(deltaTime)
-- One-time initialization
if not state.initialized then
state.initialized = initializeMod()
return -- Skip processing until initialized
end
-- Throttle polling frequency
state.elapsedTime = state.elapsedTime - deltaTime
if state.elapsedTime > 0 then return end
state.elapsedTime = CONFIG.POLL_INTERVAL
-- Vehicle mount detection
local player = state.getPlayer()
if not player then return end
local inVehicle = (state.getMountedVehicle(player) ~= nil)
if inVehicle ~= state.wasInVehicle then
if player.PlaySound then
player:PlaySound(inVehicle and state.ON_SOUND or state.OFF_SOUND)
end
state.wasInVehicle = inVehicle
end
end)
local wasInVehicle = false
local startupLogged = false
local function playSoundSafe(soundEventName)
local player = Game.GetPlayer()
if player and player.PlaySound then
local event = CName.new(soundEventName)
player:PlaySound(event)
end
end
registerForEvent("onUpdate", function(deltaTime)
if not startupLogged then
print("[Greet and Bye] [OK] Initialization complete. Mod is active.")
startupLogged = true
end
local player = Game.GetPlayer()
if not player then return end
local isInVehicle = Game.GetMountedVehicle(player) ~= nil
if isInVehicle ~= wasInVehicle then
if isInVehicle then
playSoundSafe("v_car_makigai_maimai_ui_on")
else
playSoundSafe("v_car_makigai_maimai_ui_off")
end
wasInVehicle = isInVehicle
end
end)
--------------------------------------------------------------------------------
-- Configuration
--------------------------------------------------------------------------------
local POLL_INTERVAL = 0.5
local ON_SOUND = CName.new("v_car_makigai_maimai_ui_on")
local OFF_SOUND = CName.new("v_car_makigai_maimai_ui_off")
local _GetPlayer = Game.GetPlayer
local _GetMountedVehicle = Game.GetMountedVehicle
--------------------------------------------------------------------------------
-- State
--------------------------------------------------------------------------------
local elapsedTime = POLL_INTERVAL
local wasInVehicle = false
local initialized = false
--------------------------------------------------------------------------------
-- Main Polling Loop + Init Log
--------------------------------------------------------------------------------
registerForEvent("onUpdate", function(deltaTime)
-- initialization log
if not initialized then
print("[Greet and Bye] [OK] Initialization complete. Mod is active.")
initialized = true
end
-- throttle
elapsedTime = elapsedTime - deltaTime
if elapsedTime > 0 then return end
elapsedTime = POLL_INTERVAL
-- guard player
local player = _GetPlayer()
if not player then return end
-- detect mount/unmount (no log output)
local inVeh = (_GetMountedVehicle(player) ~= nil)
if inVeh ~= wasInVehicle then
if player.PlaySound then
player:PlaySound(inVeh and ON_SOUND or OFF_SOUND)
end
wasInVehicle = inVeh
end
end)
Rambling:
I've tried to make a panel. Couldn't make the ImGui work, the panel was appearing when the CET overlay was off and was disappearing after the overlay was turned on, spent a few hours trying to get it work through prompting a few LLM models, couldn't get it to work so I gave up.
Also thought about adding a drop down menu for enter and exit events, you could choose which enter/exit audio to play via the panel alongside a toggle to turn the function on or off, but like I said gave up when I couldn't get the UI to work.
I dunno if I'll try adding those functions sometime, though I'm sure the latest version works the best now, so I'm leaving it at that.
Enjoy ^^