Reply To: Mafia 3 Modding (Mega Thread)

Download Mods for the Mafia Games Forums Mod Creation Mafia 3 Modding (Mega Thread) Reply To: Mafia 3 Modding (Mega Thread)

#164493
JoshJosh
Participant

I found a way to use cheat/debug commands in post #163017.

For example if you want use “carpls” command, make lua script like this.

SpawnVeh =[[

package.loaded.common.base.game_structure_console.carpls()]]

unbindKey("o");

bindKey("o", SpawnVeh);

You can spawn random vehicles by press O key when you’re on-foot.

If you want to spawn spicific vehicle,

change carpls() to carpls("smith_mainline_p")

But spawning vehicle is always full customized and painted with unsuitable livery.

What a terrible scripting game… ?<noscript>?</noscript><noscript>?<noscript>?</noscript></noscript><noscript>?<noscript>?</noscript><noscript>?<noscript>?</noscript></noscript></noscript><noscript>?<noscript>?</noscript><noscript>?<noscript>?</noscript></noscript><noscript>?<noscript>?</noscript><noscript>?<noscript>?</noscript></noscript></noscript></noscript>

Anyway anybody knows how to remove upgrade items from current vehicle?

Very nice find! How did you that function out? I’m trying to find if there is a way to decompile these 5.2.1 .lua files and edit them, would give us more control and see how some functions are used. And to answer your question, you can get the current vehicle you are in by using “game.game:GetActivePlayer():GetOwner()” and then you can use “game.hud:OpenCustomizeCarMenu(true)” to customize it and remove those upgrades.

Also interesting, reading that script shows carpls() command uses this:

SpawnCar……….GetPos……….GetDir……….UserData……….IsSuccess……….GetSpawnedEntity……….obtain_id……….DespawnEntity……….AddTag……….design……………MakeCarOwnership……….LockControls……….GetOnVehicle….€?………WALK……….DBGVehicleUpgrade…………all……….SetColor….€@………InstallTuningItems…€–D..–D..À»D..€ÎD..ÀÔD..áD………SetPainting……….paint_curves02—d……….SetDelivered

Would be preferable decompiled but you can sorta read how it is used.

SpawnCar uses game.traffic:SpawnCar(pos, dir, modelName?)

Then those upgrades are added using SetPainting, DBGVehicleUpgrade, InstallTuningItems.

So in theory, you can just use the game.traffic:SpawnCar function to spawn a default car because the carpls() command adds those upgrades that you don’t like.

Most functions can be found here: http://mafia3scripting.wikia.com/wiki/Welcome

Hopefully more Mafia 3 modding ensues!