Forum Replies Created
If you want to start mafia3 + ScriptHook together (similar to gta5) you can use my new tool: https://mafiamods.com/mods/mafia3-extended-configurator/
I had no trouble using the mod so far. Will test it in the next days with new game version.
Great update on the scripting wiki! How did you find out functions of the new classes (game.police …) ?
First problem is that togglePlayerGodMode never can be 0 or 1 because you say
togglePlayerGodMode = 0; — here you set variable value to 0.
togglePlayerGodMode = [[ — here you use the same variable and set value to a code block.
Also invulnerability should be used like that:
game.game:GetActivePlayer().invulnerability = true; — the “;” sign is not needed in lua but can be used
So for example your code could look like this:
togglePlayerGodModeSetting = 0
togglePlayerGodModeFunction = [[
if togglePlayerGodModeSetting == 0 then
game.game:GetActivePlayer().invulnerability = true
togglePlayerGodModeSetting = 1
elseif togglePlayerGodModeSetting == 1 then
game.game:GetActivePlayer().invulnerability = false
togglePlayerGodModeSetting = 0
For additional help take a look at the scripting wiki and its links at http://mafia3scripting.wikia.com/
Everyone can help to contibute the wiki 🙂
Follow that link. It might be interesting:
Also Mafia3SdsExlorer is open source. You can watch progress here:
I hope Barzakh / MartinJK will update SdsExplorer & ScriptHook soon.
Mafia III Scripting Wiki will help modders to know how to use scripting functions. Atm some functions are known but not how many and what kind of parameters they need. Scripters need to find out by trial and error how to use them. In the wiki people can bring together what they found out. The wiki already helped me for making my new script mod. You can get ar stromer 223 using it:
I also finished first version of my hardcore difficulty mod but it is to unstable to release. Mafia3ScriptHook needs to be updated first.
I guess it would be possible to start scripthook and mafia3 together but someone needs to code it. Someone could make a new application that starts scripthook and mafia3 together or someone adds this feature to scripthook on a branch on https://github.com/MartinJK/Mafia3ScriptHook .
1 user thanked author for this post.November 2, 2016 at 12:36 am in reply to: [Hartmann M60 Machine Gun]Early Unlock possibility (hack or placement): #163327
I just made a script mod that does what you are looking for: https://mafiamods.com/mods/change-time-of-day/
Is there any way to make a endless loop for code without crashing atm?
There is this note on M3ScriptHook mod page:
“Please be careful with pressing keys, spaming keys / executing the same things too often in a short time period can cause the game to crash!”
I made a script that executes code in a loop. To limit the rate I use setTimeout to trigger the script less often like this:
CODE TO EXECUTE … ;
Without limitation the game crashes almost instantly.
But even while waiting 1 – 5 seconds before each code exec the game crashes after a few minutes.
ScriptHook.log doesn’t tell anything about it.
Last lines of ScriptHook.log:
Trying to execute: CODE TO EXECUTE … ;
Okay maybe M3ScriptHook needs to be updated for game version 1.02. I was using M3 game version 1.01 last time.
You have mentioned the new lua classes. How is your progress releasing the corresponding functions like you already did for game.game etc. I don’t know how to find them. I need especially functions from game.police.
Is it possible to use events in lua scripts atm?
Btw it would be nice if someone could host a wiki for scripting or a nice function page like the one from gta 5 here
I am using M3ScriptHook 1.2 ReleaseCandidate from here: https://mega.nz/#F!VscigCQQ!yl3PBpGpZ075v6K5x6PICA
You should try that one. It works for me with current M3 game version.
@b4aD8oY: The only problem that I expirienced was that when I started M3ScriptHookLauncher it wasn’t able to hook the game. I solved this by starting M3ScriptHookLauncher as administrator.
@lincoln clay: I’m also trying to decompile the scripts but with no luck so far. I tried several lua decompilers from here:
I also found those threads that might be useful:October 18, 2016 at 1:40 pm in reply to: Harder difficulty (lower amount of health Lincoln has&increase enemy accuracy) #163151
I’m trying to achieve a harder difficulty mod aswell but everything I found out is how to reduce players max health bar counter to 1 healthbar (instead of max 3) and how to disable players armor. But I don’t know how to change the weapon damage itself and how to access peds (like enemy and police) to change their behaviors like fore example their accuracy …
I think we need a more complete api for scripting first and/or better modding tools before we can do that.