Forum Replies Created
For those where version 1.1 of the Script Hook is crashing, can you please try out the 1.2 release candidate? You can download it here https://mega.nz/#!c9diTBBQ!vhjXV1uMWLd6g2kYG1YblNeKUQdTr6f_xugUIS1sdaA and give me feedback if it works for you now? Thanks!
1 user thanked author for this post.
First of all: Thank you for your hard work on this! Sadly this version crashes the game when I run it. The previous version worked like a charm. Here’s the ScriptHook log: M3ScriptHook::M3ScriptHook PluginSystem::LoadPlugins PluginSystem::LoadPlugins loaded plugin ExampleDLLPlugin.dll M3ScriptHook::StartThreads LuaStateManager::StartThread M3ScriptHook::mainThread LuaFunctions::LuaFunctions LuaFunctions::LuaFunctions Game is not ready, script engine not initialized, retry LuaFunctions::LoadPointers m_pMainGameScriptMachine (7ff6f19b41b8) lua_pcall2 (7ff6efef3100) lua_tostring (7ff6ec5bb2d0) lua_isstring (7ff6ef00e7f5) lua_isstring (7ff6ef00e7f5) luaL_loadbuffer (7ff6eff51b93) plua_loadBuffer (7ff6efefd370) lua_newthread (7ff6efef2d30) lua_pushcclosure (7ff6efef51d0) lua_setfield (7ff6ec5bb090) LuaStateManager::StateChanged LuaFunctions::Setup
Alright this is my log
The reason why it crash must be lua_pushcclosure or lua_setfield, I’ll try to get a fix out as soon as possible. Thanks for sharing your information!
Can we use scripthook to do things like increase pedestrian count and traffic density?
Yes there should be a way todo so.
Here’s the game.traffic class http://hastebin.com/sedasiditu.hs
You should be able to control the density with one of these functions
If not, you probably need to modify the game config file directly
First of all, the source was not ripped off, the only class structures that are taken over are those from LuaFunctions, LuaStateManager and the PluginSystem. All content was reversed by myself, even the hooking module etc. was replaced. If you take a look at my source code you will see that it’s pretty much different etc.
Second of all, I have no problem with giving credits and copying license infos as seen here https://github.com/MartinJK/Mafia3ScriptHook/blob/master/shared/include/hooking/hooking.h#L50 .
There was no intention to violate the rights of his source code.
Unfortunately, his source code did not have any license info (the google code side does, but I’ve downloaded it somewhere else). Thats probably why I’ve forgot to add him.
I’ll add his credits, again, there was no intention to violate it.
Writing me a ‘normal’ note about that would be probably asking too much? (Good Job, ripping etc.)
A complete function and string dump of Mafia3’s LUA and a dump of all functions is available here:
All lua ‘game’ classes (idk if they are called classes in Lua :D)
game.ats game.audio game.battle game.cameramanager game.capture game.database game.datastore game.delayed game.detector game.director game.entitywrapper game.game game.garage game.gfx game.hud game.navigation game.perchars game.physics game.pipcamera game.police game.racemanager game.radio game.safehouse game.savesystem game.sds game.servicevalidation game.shotmgr game.skipscriptscene game.sniperservice game.squealer game.streaming game.streammap game.tail game.traffic game.videocapture game.ats game.audio game.battle game.cameramanager game.capture game.database game.datastore game.delayed game.detector game.director game.entitywrapper game.game game.garage game.gfx game.hud game.navigation game.perchars game.physics game.pipcamera game.police game.racemanager game.radio game.safehouse game.savesystem game.sds game.servicevalidation game.shotmgr game.skipscriptscene game.sniperservice game.squealer game.streaming game.streammap game.tail game.traffic game.videocapture
Alright guys, here are some functions (Once I wrote a script you get them prettyfied ;))
Until then, please compare the variables (like game.game – if they are correct) and take / guess the parameters from here http://mafiascene.net/thread-850.html
Unknown yet, only class reversed:
player http://hastebin.com/yuwexotomu.hs (you can access it with game.game:GetActivePlayer() )
car (vehicle) http://hastebin.com/iroxorijes.hs (when you are in a car, you can access it with game.game:GetActivePlayer():GetOwner() )
boat (vehicle) http://hastebin.com/ifuwoqidoj.hs (when you are in a car, you can access it with game.game:GetActivePlayer():GetOwner() )
gamecam and mafiacam http://hastebin.com/yozafehaca.hs
entity (wrapper) http://hastebin.com/cuhiyipifo.hs
Little insight how many functions register these variables (like game.game, game.hud etc.)
Alright, first version of the scripthook is out now. (I’ll upload it here once I’ve finished some cleanups (adding icons to executable, writing tutorial, list of commands etc.))
The Scripthook supports loading of library (.dll) and script (.lua) files. So you can either write your plugins with C++ (calling game functions directly) or simply use lua, or either use both.
The library part of the Scripthook features all needed memory functionality (searching for patterns (writing them into a cache file so search is next time faster etc.)) including LUA (you get the lua_State ptr once the plugin start routine is called)
Example can be seen here: https://github.com/MartinJK/Mafia3ScriptHook/blob/master/ExampleDLLPlugin/src/main.cpp
The files need to be placed in the following directories:
MAFIA III FOLDER/scripts/*.lua
MAFIA III FOLDER/plugins/*.dll
In order to allow quick development, you can reload the LUA scripts via F1 key press. Reload for .dll will be added soon
Oh and by the way, I’ve uploaded the Mafia 3 font files (extracted from the Launcher) for you guys, you can download it at https://mega.nz/#!l8NDVCKA (nearly 60MB because of chinese and japanese fonts)
Sooo… This is the first look in the Script Hook for Mafia 3, first version should be out on sunday 😉 This version is thread safe and works with the Game Main Script Thread / Machine. Also I’ll add a list with available commands and parameters (all game sciprting functions, as far as possible).. D3D11 hook and maybe developer console coming later on
(unfortunately i can’t embbed it with the video tag, keep on getting 403 not authorized, A potentially unsafe operation has been detected in your request to this site…)
PS.: Some nice messing around screenshot 😉