FAQFAQ    Board RulesBoard Rules    SearchSearch    LotteryLottery    RouletteRoulette    UsergroupsUsergroups
     RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Shop    Log inLog in 
View posts since last visit View your posts View unanswered posts

MAFIA 2 - a way to import modded objects into the scene
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Mafiascene.com Forum Index -> Mafia Mods
View previous topic :: View next topic  
Author Message
T3mas1

Member
Member


Joined: 11 Jul 2015
Posts: 125
Location: Czech Republic
283 Bank Notes
Items

PostPosted: Wed Mar 07, 2018 7:23 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

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 Sad 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
View user's profile Send private message
AMadeMan

Member
Member


Joined: 23 May 2017
Posts: 174
Location: United States
220 Bank Notes
Items

PostPosted: Wed Mar 07, 2018 8:29 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

Amazing work!! You just made a new breakthrough in Mafia 2 modding!!
Back to top
View user's profile Send private message
Jaqub

Junior Member
Junior Member


Joined: 12 Dec 2017
Posts: 49
Location: idk
24 Bank Notes
Items

PostPosted: Thu Mar 08, 2018 7:30 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

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
View user's profile Send private message Visit poster's website
T3mas1

Member
Member


Joined: 11 Jul 2015
Posts: 125
Location: Czech Republic
283 Bank Notes
Items

PostPosted: Fri Mar 09, 2018 8:03 am    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

AMadeMan: Thank you, though I wouldn't call it a breakthrough yet. It is rather just a little workaround than a proper solution. Smile

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
View user's profile Send private message
T3mas1

Member
Member


Joined: 11 Jul 2015
Posts: 125
Location: Czech Republic
283 Bank Notes
Items

PostPosted: Sun Mar 11, 2018 11:32 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

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
View user's profile Send private message
AMadeMan

Member
Member


Joined: 23 May 2017
Posts: 174
Location: United States
220 Bank Notes
Items

PostPosted: Mon Mar 12, 2018 12:47 am    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

Awesome! Keep up the great work! The more progress on Mafia 2 modding, the better.
Back to top
View user's profile Send private message
agens

New Member
New Member


Joined: 29 Apr 2016
Posts: 13

29 Bank Notes
Items

PostPosted: Mon Mar 12, 2018 7:16 pm    Post subject: Re: MAFIA 2 - a way to import modded objects into the scene Reply with quote

I updated the bridge and made it as Add-on.
Here is the link: https://yadi.sk/d/nKAvRpTV3THMK9

https://www.youtube.com/watch?v=wHGEW9u_s00&t=66s
Back to top
View user's profile Send private message
T3mas1

Member
Member


Joined: 11 Jul 2015
Posts: 125
Location: Czech Republic
283 Bank Notes
Items

PostPosted: Mon Mar 12, 2018 7:25 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

UPDATE


Edit: Thank you agens. Very happy

agens delighted me with a surprise today - he worked on the model a bit and now the bridge has textures, has better collisions and works as an Add-on.

Video by me:



Video by agens:




Problems that I encountered: The collisions are buggy, the collisions are a bit too high. These are serious problems but the positive thing is that other than that the model works pretty well.

Some problems stay: you can't re-enter the car once you have got out of it on the bridge. It can be re-entered only by using a script.

I may have a brilliant idea. I've already written about the GTA V Map Editor/Map Editor thing here and using this method I could build a little city (hopefully!) on the flat surface used for testing in Joe's Adventures: https://www.youtube.com/watch?v=rie0u50YFvg

I would place there a flat object with textures of road, it would just cover the surface of the testing scene. There are already collisions on the flat surface so I wouldn't have to add any collisions to the added object. Added collisions would be only on buildings and pavements that I would later place there. This way it would be actually possible to re-enter cars on the road in the little city. The city would be connected with the rest of the map with the bridge model showed in the videos. But it is just theory.

If you want to test the model in-game for youreself, again you can!

The model: https://yadi.sk/d/nKAvRpTV3THMK9
Back to top
View user's profile Send private message
AMadeMan

Member
Member


Joined: 23 May 2017
Posts: 174
Location: United States
220 Bank Notes
Items

PostPosted: Mon Mar 12, 2018 11:39 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

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
View user's profile Send private message
T3mas1

Member
Member


Joined: 11 Jul 2015
Posts: 125
Location: Czech Republic
283 Bank Notes
Items

PostPosted: Tue Mar 13, 2018 9:19 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

UPDATE


agens has extended the bridge:

Back to top
View user's profile Send private message
Jaqub

Junior Member
Junior Member


Joined: 12 Dec 2017
Posts: 49
Location: idk
24 Bank Notes
Items

PostPosted: Tue Mar 13, 2018 9:54 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

I'm fully hyped but kinda nervous that this is worked on a instance of a car xd.
_________________

Back to top
View user's profile Send private message Visit poster's website
T3mas1

Member
Member


Joined: 11 Jul 2015
Posts: 125
Location: Czech Republic
283 Bank Notes
Items

PostPosted: Wed Mar 14, 2018 3:54 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

So am I. Smile
Back to top
View user's profile Send private message
AMadeMan

Member
Member


Joined: 23 May 2017
Posts: 174
Location: United States
220 Bank Notes
Items

PostPosted: Wed Mar 14, 2018 5:16 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

Love the work man!
Back to top
View user's profile Send private message
T3mas1

Member
Member


Joined: 11 Jul 2015
Posts: 125
Location: Czech Republic
283 Bank Notes
Items

PostPosted: Wed Mar 14, 2018 8:38 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

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. Sad

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
View user's profile Send private message
T3mas1

Member
Member


Joined: 11 Jul 2015
Posts: 125
Location: Czech Republic
283 Bank Notes
Items

PostPosted: Thu Mar 15, 2018 9:17 pm    Post subject: MAFIA 2 - a way to import modded objects into the scene Reply with quote

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. Smile So it is possible.

It has been proven that there are no boundaries around the original map.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Mafiascene.com Forum Index -> Mafia Mods All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
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

Generation Time: 0.041 | Queries: 19