View previous topic :: View next topic |
Author |
Message |
T3mas1
Member


Joined: 11 Jul 2015 Posts: 165 Location: Czech Republic 375 Bank Notes
Items
|
|
As we know, unfortunately, we can't mod Mafia 2 as much as some other games because its developers used a lot of their own stuff (their programs, techniques etc.). We can change textures, script the game to some extent and add/replace cars. But it is almost impossible to put your own model (not a car model) into the game. Though I may have found a little workaround. I've always wanted to be able to put pieces of roads into the Mafia 2's world. I had an idea to put a bridge model onto a roof of a car and then spawn the car in the game. Crazy as it may seem, it was possible. I shared this idea with agens who tried it first.
BTW: It is worth knowing that you can add modded cars into the game as add-ons meaning, you don't have to replace anything and the car won't spawn in the streets.
Vide the first attempt:
The biggest problem was that it was impossible to drive on it and it was very unstable.
I had an idea to find a script that would freeze the car in one place. It took me a few days but I was succesful, the script is xxxxxxxx:Lock()
The problem is that for some reason you can't get in the car (truck). Almost every script mod regarding car changes available on the internet requires you to be in the car to activate the script. Luckily I was able to deal with it. I needed to use the StrM Editor, which can be found here: http://www.playground.ru/files/mafia_2_self_tools_nabor_utilit-83905/
in order to create an entity to which I could refer. There is a nice tutorial on how to do that in Mafia 2 Self Tools\StrM_Editor\Example\Example_2\Help
I opened the StreamMapa.bin found in Mafia 2\pc\dlcs\cnt_jimmys_vendetta\game_edit\tables via the program to add an entity.
I set the path of the entity (called Car_Entity_01) to sds/cars/shubert_armoured.sds, which is the car model with the bridge.
Then I made the line apply to config number one "game_main_load" and I saved the file.
Then I started the game and played Jimmy's Vendetta. Via a trainer that has been recently released for Mafia 2 you are able to add scripts in the game. I opened the script windows and entered my script:
DelayBuffer:Insert(function(l_1_0) CommandBuffer:Insert(l_1_0,{
function(l_2_0)return game.sds:ActivateStreamMapLine( "game_main_load")end,
function(l_3_0) player, V = game.game:GetActivePlayer(), game.entitywrapper
auticko = V:GetEntityByName("Car_Entity_01")
auticko:Activate()
auticko:RepairAndClear()
carPos = Math:newVector()
carPos:set(413.179,-317.481,-20.297)
auticko:SetPos(carPos)
carDir = Math:newVector()
carDir:set(1.000, 0.008,0.000)
auticko:SetDir(carDir)
auticko:Lock()
auticko:SetPos(carPos)
auticko:SetDir(carDir)
auticko:Lock()
end})end,{l_1_0},100,1,false)
It spawns the enity (the car model) at the given coordinates and locks it afterwards. The result is this:
Possible uses: a WTC mod, jump models, hopefully expanding the map
Problems: The biggest problem is that once you exit the car on the bridge you can't enter the car again (though it may be done using a script) but still it sucks It is also buggy to spawn cars via the trainer on the bridge.
It is hard to spawn it in some places, because it is too big.
It is not fully tested yet. But so far it works better than expected.
Last edited by T3mas1 on Sat Mar 17, 2018 6:56 pm; edited 2 times in total |
|
Back to top |
|
 |
AMadeMan
Senior Member


Joined: 23 May 2017 Posts: 347 Location: United States 461 Bank Notes
Items
|
|
Amazing work!! You just made a new breakthrough in Mafia 2 modding!! |
|
Back to top |
|
 |
Jaqub
Junior Member


Joined: 12 Dec 2017 Posts: 53 Location: idk 2 Bank Notes
Items
|
|
Yeah, Its getting warm now into the Mafia modding scene, althought I'm working on reversing its engine and playing style lol. _________________
 |
|
Back to top |
|
 |
T3mas1
Member


Joined: 11 Jul 2015 Posts: 165 Location: Czech Republic 375 Bank Notes
Items
|
|
AMadeMan: Thank you, though I wouldn't call it a breakthrough yet. It is rather just a little workaround than a proper solution.
Jaqub: Sorry for expressing my a bit discourteous opinion. If you can't import along with the map the great car handling and the awesome cover shooting system that Mafia 2 had, it is pointless to some extent, no style lol. |
|
Back to top |
|
 |
T3mas1
Member


Joined: 11 Jul 2015 Posts: 165 Location: Czech Republic 375 Bank Notes
Items
|
|
UPDATE
The script for spawning the object has changed a little bit, now also the object's direction is defined.
The script now is:
DelayBuffer:Insert(function(l_1_0) CommandBuffer:Insert(l_1_0,{
function(l_2_0)return game.sds:ActivateStreamMapLine( "game_main_load")end,
function(l_3_0) player, V = game.game:GetActivePlayer(), game.entitywrapper
auticko = V:GetEntityByName("Car_Entity_01")
auticko:Activate()
auticko:RepairAndClear()
carPos = Math:newVector()
carPos:set(413.179,-317.481,-20.297)
auticko:SetPos(carPos)
carDir = Math:newVector()
carDir:set(1.000, 0.008,0.000)
auticko:SetDir(carDir)
auticko:Lock()
end})end,{l_1_0},100,1,false)
Also I bought one-month licence for Zmodeler 3 yesterday. Now I am able to edit the model. Unfortunately collision editing seems to be a big deal. :/
On the other hand, I've managed to make the object move using using keys F1 - F6 in all directions. For example, one script (for one direction) looks like this:
F1
DelayBuffer:Insert(function(l_1_0)
auticko = V: GetEntityByName ("Car_Entity_01")
auticko:Unlock()
v = auticko:GetPos()
v.z = v.z + 5
auticko:SetPos(v)
auticko:Lock()
end,{l_1_0},100,1,false)
A video in which I tested this feature:
This is very important. Now I can build places by moving spawned objects. The same concept on which Map Editor used with Map Builder for GTA V works. I could make road and buildings packs for you.
For example: I created this map for GTA V just by spawning blocks next to each other: https://www.gta5-mods.com/maps/great-island and it looked good. The same principle could be used in Mafia 2. A simple moving objects trainer in which you can change the set attributes in-game would come in handy. It would make the task much easier and less "pain in the ass".
If you want to test the model in-game for youreself, you can. Everything you need to know is below:
The model (edited): http://www.mediafire.com/file/er7pnuewrd7jbuk/shubert_armoured.sds
Put it into: Mafia 2 \ pc \ sds \ cars \
For a successful load, you must insert this file http://www.mediafire.com/file/t7on9tql9t1o88l/StreamMapa.bin
into: Mafia 2 \ pc \ dlcs \ cnt_jimmys_vendetta \ game_edit \ tables
or you can instead edit the file yourself using the method described in the first post.
and then you have to write using the trainer ( https://mafiamods.com/mods/trainer-mod-menu/ ) (keyboard 0) this script:
DelayBuffer:Insert(function(l_1_0) CommandBuffer:Insert(l_1_0,{
function(l_2_0)return game.sds:ActivateStreamMapLine( "game_main_load")end,
function(l_3_0) player, V = game.game:GetActivePlayer(), game.entitywrapper
auticko = V:GetEntityByName("Car_Entity_01")
auticko:Activate()
auticko:RepairAndClear()
carPos = Math:newVector()
carPos:set(413.179,-317.481,-20.297)
auticko:SetPos(carPos)
carDir = Math:newVector()
carDir:set(1.000, 0.008,0.000)
auticko:SetDir(carDir)
auticko:Lock()
end})end,{l_1_0},100,1,false)
The car will be in Oyster Bay in front of Marty's house. You should play Jimmy's Vendetta.
If you want to move the object using F1-F6 download this: http://www.mediafire.com/file/f7n38c9rrzc34r9/To_move_the_object.rar |
|
Back to top |
|
 |
AMadeMan
Senior Member


Joined: 23 May 2017 Posts: 347 Location: United States 461 Bank Notes
Items
|
|
Awesome! Keep up the great work! The more progress on Mafia 2 modding, the better. |
|
Back to top |
|
 |
agens
New Member


Joined: 29 Apr 2016 Posts: 14
31 Bank Notes
Items
|
|
Back to top |
|
 |
T3mas1
Member


Joined: 11 Jul 2015 Posts: 165 Location: Czech Republic 375 Bank Notes
Items
|
|
Back to top |
|
 |
AMadeMan
Senior Member


Joined: 23 May 2017 Posts: 347 Location: United States 461 Bank Notes
Items
|
|
Simply Awesome T3mas1 and agens! This could lead to modders being able to expand the games map, improve, or add different areas across Empire Bay. I'm seein a bridge at the port that'll let you get a close up of the titanic right now.
 |
|
Back to top |
|
 |
T3mas1
Member


Joined: 11 Jul 2015 Posts: 165 Location: Czech Republic 375 Bank Notes
Items
|
|
Back to top |
|
 |
Jaqub
Junior Member


Joined: 12 Dec 2017 Posts: 53 Location: idk 2 Bank Notes
Items
|
|
I'm fully hyped but kinda nervous that this is worked on a instance of a car xd. _________________
 |
|
Back to top |
|
 |
T3mas1
Member


Joined: 11 Jul 2015 Posts: 165 Location: Czech Republic 375 Bank Notes
Items
|
|
So am I.  |
|
Back to top |
|
 |
AMadeMan
Senior Member


Joined: 23 May 2017 Posts: 347 Location: United States 461 Bank Notes
Items
|
|
Back to top |
|
 |
T3mas1
Member


Joined: 11 Jul 2015 Posts: 165 Location: Czech Republic 375 Bank Notes
Items
|
|
UPDATE
I made a long video testing one thing - moving the object. I spawned actually two objects of the same model to move them around the map to see if the game crashes or not or if there is any problem. Luckily it works perfectly! To add an object I just had to write another line in StreamMapa.bin using the StrM editor.
*Again I used scripts to move the object, more about that in the previous post.
During the testing I found out about a few things that I hadn't known about before. I made NOTES in the video, the NOTES are numbered.
NOTE 1: https://youtu.be/hwLOxdSrYPc?t=14s
Interestingly the object after using the "spawning" script which includes the lock script as well doesn't fully fix itself. If you decide to take a ride on it with a car, the car will fall throught the object - this is the situation that occurs: https://youtu.be/wuVWpWsSwrs?t=2m39s
In order to fix it you have to step on it, just little untill it shakes a little bit and you hear a sound. It may sound unpractical, luckily that is not the only way to do it! You can instead run the script consecutively twice to get the same result.
Moving the object in any direction using the F1-F6 script should do the trick as well.
!YOU MUST TAKE THIS INTO CONSIDERATION!
when you are testing the object's collisions
NOTE 2: https://youtu.be/hwLOxdSrYPc?t=3m35s
As agens told me once, in the game there are invisible collision walls along the the shores between the land and water. If you happen to know how to delete/move them, let me know as soon as possible. Luckily those collision walls aren't infinitely high opposed to Mafia 1 where the collisions were as high as they could. Using the bridge you should be able to get over these invisible walls by over passing them.
NOTE 3: https://youtu.be/hwLOxdSrYPc?t=9m1s
Unfortunately, to say the least, it is impossible to re-enter a car (without using a script) not only on the bridge bug also UNDER it.
NOTE 4: https://youtu.be/hwLOxdSrYPc?t=11m2s
It is quite possible, even at this point, to make a simple flat object with a flat collision and put it under the elevated railway track in order to be able to drive on it in a car. |
|
Back to top |
|
 |
T3mas1
Member


Joined: 11 Jul 2015 Posts: 165 Location: Czech Republic 375 Bank Notes
Items
|
|
UPDATE
agens made a commented video devoted to the topic showing also a new location.
I've noticed that agens was able to re-enter cars on the second object showed in the video and also able to spawn new ones. So it is possible.
It has been proven that there are no boundaries around the original map.  |
|
Back to top |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|