Lua scripts can be used to:

Mafia 2 Lua scripts offer a powerful way to customize and extend the game's behavior, providing a wide range of possibilities for game modding and customization. While there are challenges and limitations to consider, the use of Lua scripts can breathe new life into the game, providing a fresh and exciting experience for players.

| Category | Script Command / Name | Effect | | :--- | :--- | :--- | | | game.game:GetActivePlayer():InventoryAddMoney(5000) | Adds $5,000 to Vito's wallet. | | 🛡️ God Mode | game.game:GetActivePlayer():SetDemigod(true) | Makes Vito invincible. | | 🔫 Weapons | game.game:GetActivePlayer():InventoryAddWeapon(11, 200) | Gives Vito a Thompson 1928 (Tommy Gun) with 200 rounds. | | 👮 Police | ai.police:SetDensity(0) game.traffic:SetPolice(false) | Removes all police from the game, making you untouchable. | | 🌦️ Weather | game.gfx:SetWeatherTemplate("DTFreerideNight") | Changes the weather instantly to a wet, atmospheric nighttime. | | ⏰ Timer | game.hud:TimerStop() | Stops mission timers (useful for exploring during missions). | | 🌀 Teleport | game.game:GetActivePlayer():SetPos(Math:newVector(-1500, 0, 0)) | Teleports Vito to a specific coordinate in the game world. | | 📌 Spawn NPC | Joe = game.entitywrapper:GetEntityByName("Joe") Vito = game.game:GetActivePlayer() Joe:SetPos(Vito:GetPos()) | Teleports Joe right next to Vito. | | 🏎️ First-Person | game.cameramanager:GetPlayerMainCamera(0):EnableFPV... | Enables an immersive first-person driving view. | | 🏠 Interact | [F1] - Use Toilet [F2] - Take Shower [F4] - Wash Hands | Allows Vito to perform various animations in safehouses. | | 📸 Save Game | [F12] - Save | Allows the player to save their game at any point. | | 🚫 Wanted Level | (Script Name: F3.lua ) | Ignores police, clears wanted level, and removes license plate. | | ✍️ Creator Credits | N/A | A script from XSTEAMTOWER that unlocks all Artworks and Playboy Magazines. |

Enables the ability to play in a populated, unrestricted city, allowing you to buy houses, visit shops, and manage garages without mission constraints.

Modders often use internal strings to reference items. For example, to give a player a specific item like "Papers" (often used for mission-related items), a command similar to the one found in the console might be used: Command Structure Giveweapon -1 1 "Papers"

Or to spawn a :

Many of the most famous Mafia II mods rely on Lua scripting to function:

Whether you're a seasoned developer or just starting out, the world of Mafia 2 Lua scripting has something to offer. So why not give it a try? Join the community, share your own scripts, and see what possibilities emerge.

: Often used for more advanced modding, including extracting game files and viewing existing script structures.

You’ll see .lua files grouped by mission ( mission_01.lua , etc.) and system files like player.lua or vehicle.lua .

Here is an example of a simple, functional Lua script that gives Vito a Tommy gun and refills his health when a specific key is pressed:

While Lua scripts offer a wide range of possibilities for game customization and modding, there are also some challenges and limitations to consider:

Alter the weather, time of day, and traffic density. 🛠️ How to Use Mafia 2 Lua Scripts