Jump to content


Photo

Tutorial for getting a prefab into the game as a selectable unit (FILES EXPLAINED)


  • Please log in to reply
19 replies to this topic

#1 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 15 September 2015 - 11:52 PM

Ok so here we go.  Let me warn you that messing with game files can make this game unstable and also unplayable.  I'm sure 
 
if you have been modding this game at all you already know this.  Let this serve as your one and only warning.  
 
Not that we got this out of the way lets begin.  First let me say that this tutorial is to instruct and show you how to 
 
make a vehicle show up in the game and be selected.  I will try and explain how to change each of the files and what the 
 
function seem to do.  If you find something wrong and/or better please feel free to put it in this post and share it with 
 
us all.  Hopefully my frustration and constant corruption of the game files can help someone else out here.
 
This tutorial covers the following
I am using Windows 7 Pro
Emergency 5 Deluxe Edition (Steam Patched to 1.4.1)
Files are modified and opened using Wordpad
 
 
Ok lets begin.  The first thing you need to do is create a new project using the EM5 World editor.  Open the world editor 
 
and press F11.  Give your project a name and save.  
 
****Please remember that if you name a project please remember that you must use the following characters a-z, 0-9.  The 
 
system at this time DOES NOT accept a project with capital letters as a project name.  Actually it doesn't seem to work 
 
for any file after the most recent patches.****
 
Make sure that your new project is loaded and "running"  
A running project is highlighted in white color.  If it is not running it will be grey in color.  While in this view make 
 
sure that ONLY the project you want to work on is "running"  if other projects are "running", right click and stop the 
 
other projects.  The reason for this is you want the files to go into your current project and not anywhere else.  
 
Once you are sure that no other projects are running, resize the EM5 world editor into a smaller window.  We will now go 
 
grab some files that are needed by the game to operate a new model correctly.  
 
**I am only showing the files needed for placing the vehicle model into the EM5 game.  This does not include the material, 
 
skeleton, mesh, and .dds texture files etc.**
 
Navigate to the find the following file
 
Navigate to the next file needed
C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\em5\content\prefab\spawnpoint
 
When in this folder you need to select the file based on what department the vehicle will be assigned to.  If its a police 
 
car then select the spawnpoint for the police etc.
Drag this file into the EM5 world editor 
When you do this a window should pop up asking you to save the file.  Save the file.  When the file is saved it will be 
 
added to your project folder.  I do not think you can edit it in the editor.
 
Also in the folder is a file called "spawn_exit_ground"
You will need to drag this as well into the EM5 editor and save it.  If your working on a civilian vehicle you will need 
 
the other exit file for civilian vehicles.  The above example of the spawn exit is for all the unit class vehicles only.
For a vehicle to work it MUST have a START (SPAWN) and EXIT point!!
 
Navigate to the next file needed 
C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\em5\gamedata\em5_order_info
Inside this folder you will see the different departments (Police, Fire, Tech, Medical)  select the department of the 
 
vehicle that you are working with.  For my example it will be police.  
Select the vehicle file that is a close example of the unit your creating.  My example was a police SUV and I chose to 
 
copy the file for the police station wagon.
Grab that file and drag it into Em5 world editor. Save this file as and add.  My example was police_unmarked_suv.
 
Navigate to the next file needed
C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\em5\gamedata\em5_unitpool\default\startup
Drag this file and drop it as well and save it.
 
Close the Em5 World editor and go and find your new project
it should be located in 
C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data
Your new project file should be located here.  Open your new project and examine the contents.  You should have the 
 
following files needed above in the folder.. (for this example the locations will have my project name in it.  For you the 
 
project folder will be your name)
 
Now lets start to get our vehicle into the game.  All files are .json files and can be edited with wordpad.  Please note 
 
that you want to make sure that when windows ask you if you want to use this program to open all .json files you unselect 
 
it EACH AND EVERY time. If you do not you will then have to go through and delete the file association from the window 
 
registry files.
 
So when you open the .json file make sure you uncheck that box. (learn from me!!)
 
Lets open the file 
C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\police_suv_unmarked\content\em5_order_info\default\"your 
 
project name chosen earlier"
 
double click select open with and then wordpad
uncheck the checkmark and open the file.  something like what is found below should be seen except it will still have the 
 
default values that you will need to change.  (all notes from me are enclosed in ** and are NOT part of this file)
 
========================================================================================================================
"Format":
{
"Type": "em5_order_info",
"Version": "1"
},
"OrderInfo":
{
//  police suv
"SUV":  **<---THIS IS THE CHOSEN SHORTENED NAME USED ON ALL THE OTHER FILES**
{
"Prefab": "em5/prefab/vehicle/police_suv", **<--YOUR PREFAB FILE LOCATION**    
"AvatarIcon": "police_stw",  **<--YOUR SMALL AVATAR ICON, NOT MESSING WITH IT NOW**
"SelectionIcon": "unit_SUV", **<--YOUR ICON USED TO SELECT THE VEHICLE, NOT WORKING YET**
"MiniMapIconType": "PoliceVehicle", **<--DEPENDS ON WHAT TYPE OF VEHICLE, THE SMALL DOTS**
"LocalizedName": "ID_NAME_SUV",  **<--BELIEVE THIS TELLS THE GAME TO LOOK FOR THE SHORT NAME**
"UnitTags": "Police Vehicle Road STW", **<-UNIT TAG, HAVE NOT MESSED WITH IT YET**
"OrderDepartment": "PoliceDepartment", **<-THE CHOSEN DEPARTMENT, CAN CHANGE AND MAKE IT WORK 
 
ELSEWHERE.
"OrderCost": "10", 
"OrderSpeed": "10",
"UnlockCost": "0",
"NumberAvailable": "5", **<--TOTAL NUMBER AVAILABLE**
"PersonnelSpace": "5", **<--TOTAL VEHICLE SPACE**
"StartPersonnel":
{
"Policeman" : "2"    **<--STARTING PERSONS, BELOW AVAILABLE PASS SPACE IN VEHICLE**
},
"PassengerSpace": "2",
"HelpPages":
[
"TUTORIAL_HELPTEXT_BACK_TO_HQ_STW",  **<--HELP TEXT .DDS FILE, NOT MESSED WITH YET**
"TUTORIAL_HELPTEXT_EXIT_STW"
]
}
}
}
 
 
=========================================================================================================================
You MUST change the prefab file location to point to your new vehicle
You MUST choose a shortened name for the game to relate to later
You MUST choose a localized name and a department for the vehicle to be assigned to.
Once this is done SAVE the file and close it.
 
Now to the next file 
C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\police_suv_unmarked\content\em5_unitpool\default\startup
This is the file that tells the game how many of every type of vehicle is available, for everything including the 
 
missions.  it is a long file.  Below we will only look at 1 part of this file.  All my comments are in ** and are NOT part 
 
of this file.  
 
========================================================================================================================
"map01_munich_freeplay_unitpool": // Unitpool of the player for Freeplay  
{           **<--THIS IS FOR FREEPLAY ONLY ON MAP MUNICH FOUND ABOUT HALF WAY DOWN FILE**
// Firefighters  **<-- THE DEPARTMENT TITLE THE NUMBER IN ""EQUALS THE VEHICLE TOTALS AVAILABLE**
"RW": "8", // "Rüstwagen"
"TLF": "8",    // "Tanklöschfahrzeug"
"DeKon-P": "3",    // "Dekontaminationsfahrzeug"
"DLK": "3",    // "Drehleiterfahrzeug"
"FLB": "3",    // "Feuerlöschboot"
"TFMB": "3",    // "Transportfahrzeug Motorboot"
"KF": "1",    // "Löschflugzeug-Kommandofahrzeug"
"TFD": "1", // "Transportfahrzeug Feuerwehrdrohne"
"TFT": "3", // "Transportfahrzeug Taucher"
"RW_Historic": "3", // "Historischer Rüstwagen"
 
// Ambulance
"NEF": "4", // "Notarzteinsatzfahrzeug"
"RTW": "4", // "Rettungstransportwagen"
"RHC": "2", // "Rettungshelikopter"
"RHF": "1", // "Rettungshundefahrzeug"
 
// Police
                 "SUV": "8",               // "unmarked_suv" **<-ADD VEHICLE TO THE CORRECT DEPT AND CHOSE NUMBER AVAIL. 
 
BE SURE TO FOLLOW THE CORRECT FORMAT OR ELSE IT MAY NOT WORK.  YOU WILL SEE THAT YOUR USING THE SHORTENED ID NOW FOR THESE 
 
FILES**
                "STW": "8", // "Streifenwagen"
"MTW": "8", // "Mannschaftstransportwagen"
"PHC": "8", // "Polizeihelikopter"
"SEKHC": "3", // "Sondereinsatz-Helikopter"
"TFSEKD": "3", // "Transportfahrzeug SEK-Drohne"
"TSEKR": "5", // "Transportfahrzeug SEK-Roboter"
                "ASF": "4", // "Abschleppfahrzeug"
 
==========================================================================================================================
 
Save this file again.  If when saving a .json file windows ask you to save it as another type of text file or to ignore 
 
all formatting then you have missed something in the file.  Example (.,//]} etc.  You should not get this message if the 
 
coding format is correct.
Save that file and close it too.
 
Move to the next file
C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\police_suv_unmarked\content\prefab\spawnpoint
(for my example below we are using the spawnpoint for the police department)
All comments by me are in ** and are NOT part of the coding
 
=========================================================================================================================
"Format":
    {
        "Type": "prefab",
        "Version": "2",
        "DifferenceToDefault": "true"
    },
    "Prototypes":
    {
        "17890118060222877828":
        {
            "qsf::MetadataComponent":
            {
                "Prefab": "18446744073709551615",
                "Name": "spawn_entry_ground_police"  **<-NAME OF THE SELECTED FILE USED PER DEPARTMENT
            },
            "qsf::TransformComponent":
            {
                "Scale": "2 2 2"
            },
            "em5::UnitSpawnPointComponent":
            {
                "UnitList":
                [
                    "MTW",
                    "STW",
                    "TFSEKD",
                    "TSEKR",
"SUV" **<--ADD YOUR VEHICLE SHORTENED ID TO THIS LIST MAKE SURE TO FOLLOW THE CORRECT FORMAT IT MUST BE IN "" **
                ]
            },
            "qsf::DebugTextComponent":
            {
                "Active": "true",
                "Text": "Spawn MTW STW TFSEKD TSEKR"
            },
            "qsf::DebugBoxComponent":
            {
                "Color": "1 0 1 1",
                "ShowDirection": "true"
            }
        }
    }
}
 
==========================================================================================================================
Remember to save it and close it.  Also remember that we said earlier every vehicle in the game must have a start and exit
so go to the exit point file and open it.
My notes are shown in ** and are NOT part of the coding
 
==========================================================================================================================
{
    "Format":
    {
        "Type": "prefab",
        "Version": "2",
        "DifferenceToDefault": "true"
    },
    "Prototypes":
    {
        "15413149182976023258":
        {
            "qsf::MetadataComponent":
            {
                "Prefab": "18446744073709551615",
                "Name": "spawn_exit_ground"  **<--SELECTED FILE OF VEHICLE TYPE**
            },
            "qsf::TransformComponent":
            {
                "Scale": "2 2 2"
            },
            "em5::UnitSpawnPointComponent":
            {
                "Type": "UNITSPAWNPOINTTYPE_EXIT",
                "UnitList":
                [
                    "RTW",
                    "NEF",
                    "RHF",
                    "RW",
"RW_Historic",
                    "TLF",
                    "DeKon-P",
                    "DLK",
                    "TFMB",
                    "KF",
                    "TFD",
                    "TFT",
                    "MTW",
                    "STW",
                    "TFSEKD",
                    "TSEKR",
                    "ASF",
                    "EKW",
"SUV",  **<--ADD YOUR SHORTENED UNIT IT NAME TO THIS LIST MAKE SURE TO FOLLOW THE CORRECT FORMAT**
                    "BFZ"
                ]
            },
            "qsf::DebugTextComponent":
            {
                "Active": "true",
                "Text": "Exit all ground Vehicles"
            },
            "qsf::DebugBoxComponent":
            {
                "Color": "1 0 1 1",
                "ShowDirection": "true"
            }
        }
    }
}
 
==========================================================================================================================Add your vehicle shortened ID to the list and keep the correct format.  Remember that each exit list is based on the type of vehicle.  only UNIT type of GROUND vehicles are on this list!!
 
 
Once you change all these files above your new vehicle prefab should be found in the game and selectable.  It will NOT however have a custom avatar or other features.  I'm still working out what files control the window that shows the unit status etc.
 
For now this is all I have and hopefully some people can learn from this and get their models into the game.  If you have more to offer about this PLEASE PLEASE PLEASE feel free to chime in and correct me or help out.
 
Thanks for reading this LONG and DRY tutorial but hopefully it will help you understand a little more about what is needed file wise for a vehicle to work and show up.
 
Have a great day
 
William516
Bill
Delaware, USA


#2 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 16 September 2015 - 07:49 PM

Very nice to see some help with this. In the process of trying it with the little free time I have. Let you know the outcome. Thanks for the hard work of trying it all out

 

William:  In this part   

 
Select the vehicle file that is a close example of the unit your creating.  My example was a police SUV and I chose to 
 
copy the file for the police station wagon.
Grab that file and drag it into Em5 world editor. Save this file as and add.  My example was police_unmarked_suv.
 
Are you renaming the file police_stw to your police_unmarked_suv?


#3 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 16 September 2015 - 09:19 PM

Yes you will be renaming this file because it is a New unit. If you wanted to simply edit the vehicle seats or other info you would save the file as the SAME name.

Good luck

William516
Bill
Delaware, USA

#4 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 16 September 2015 - 09:54 PM

Okie dokie.. Hope to screw with it tonight when I get home...

#5 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 17 September 2015 - 04:50 PM

OK after a huge headache of looking through tons of files I finally have figured out what controls the different windows; however, it will take someone with some more coding experience then me to figure out what to do with these files.

So far the menus are controlled by three types of files that I can find and reference.

 

.RCSS - files (can be opened in wordpad)  These files seem to create the individual coding for the menu layout and are referenced by the .rml file

.RML   - files (can be opened in wordpad)  These files point to the RCSS file and also contain the health % of the unit and the .dds graphics that are used as well

.DDS   - files (can by opened with photoshop with correct plugins only) Can also download a trial version of mysticthumbs342 to see the .dds files in a preview window without opening every file.  The DDS texture is used by both the RML and RCSS files to create the HUD display found in the games menu functions and windows.

 

The coding is a little odd and more like what you would see in a website or c++.  I can only see 1 occurrence of the vehicle and I'm assuming that the coding allows any vehicle to be swapped into the spot in the coding.  I will have to post the files later.  Here is the directory that everything can be found it.  If anyone wants to have a crack at this.

 

C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\em5\local\gui\asset\avatars    ------all the avatars of larger grpahics in the lower right side of the screen

C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\em5\local\gui\asset   ---- all the RCSS files and more .dds files used to make up the different windows

C:\Program Files (x86)\Steam\SteamApps\common\Emergency 5\data\em5\local\gui\asset\unit_selection    ---- contains the .dds textures used for the shield, ammo, and fire damage to a a vehicle or asset.

 

Anyone knows and EASY way to actually look at or modify a RCSS file or RML files please let me know.

 

Thanks and have a good day

 

William516

Bill

Delaware,USA



#6 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 17 September 2015 - 10:47 PM

got the suv to show up in the game but once you call it, it doesnt leave the station and just disappears... something must be missing from the files outside of what you have said... hmmm

 

how do you change the uservehicle? is it in the editor.

 

im guessing that is the problem..... and the command arraY



#7 godra

godra

    Lieutenant

  • Members
  • 59 posts
  • Gender:Male
  • Location:Germany

Posted 18 September 2015 - 12:31 AM

The user interface system is based on "libRocket". It's a C++ interface middleware package based on HTML and CSS specifications. If you can programm websites, you can also change the user interface of EMERGENCY 5. I think it's easier to change the code manually by editing the files with text editors. But you also can try "Rockete".



#8 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 18 September 2015 - 12:35 AM

Walker
I will have to email you the file for the prefab.
If you took a car from the civil vehicle loby you need to change it to a type 0 user vehicle.

Then you have to add the command array and also delete the em5 despawn from the vehicle.

I will send you the json file to look at and check against yours

William516
Bill
Delaware, USA

#9 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 18 September 2015 - 12:58 AM

alrighty ill be waiting for the email... Thanks



#10 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 18 September 2015 - 02:05 PM

Ok so here we go so far.  After a battle last night with this game of searching through file after file after file of .dds textures and everything else.  I have a HUGE breakthrough for myself and a personal accomplishment.  (I know others have done far more and better but hey I'm happy to finally understand some stuff) The other good thing is that I believe I can put together a tutorial that can explain this process to everyone that wants to get a vehicle into the game.

 

I have managed to get my graphic into the status window and also the unit selection window.  No more HUGE missing red box anymore.  Starting to look more like the game.  Also I have managed to keep all the original vehicles intact.  The system now shows the proper seating and space available.  The problem is the unit "armor", "ammo" and "fire" icons all show 0%.  I'm not sure where this is controlled.  I checked the whole prefab file for existing vehicles and cant determine where this status comes from.  Have yet to test the health of the vehicle either as of now.

 

Other problems are that despite showing color in Photoshop when the image is shown in game it appears to be mostly greyscale and looks like crap.  I am using the .dds plugin for the Photoshop program.  When I go to save as a .dds file it then gives me an nvidea window that shows tons of methods to save too.  I have no clue what the right option is.  Also I can't seem to see the properties of the original .dds texture files to figure out what it should be.  

 

Anyone that has a good idea on how to skin should be able to get that and hopefully explain it to me.

 

Well here is the progress 

 

2015_09_17_00001.jpg

Status window now shows the corrected unit, "ID_NAME_SUV" is linked to the unit order info file.  I will see if i change it there what happens.  Seating shows corrected seating. (test purposes for now)  Unit command array shows up, not completed as more commands and equipment must be added.  (simply a test right now to learn how it all comes together)  See the status all set at 0% and unsure what controls this right now.

 

2015_09_17_00003.jpg

Unit order window now shows correct graphic, but the unit selection window is still not working per department,  Another hidden thing to find.

 

2015_09_17_00004.jpg

Calling all cars, calling all cars LOL

A quick test to see if the numbers in unit selection "REALLY" work and they do

 

2015_09_17_00005.jpg

a quick test to check other vehicles from the police force and ensure no vehicles had problems.  So far so good

 

Moving along to other things later today.

 

(Walker sorry i have yet to have a chance to look at and email the prefab for you as of right now, the best thing i could recommend right now is to look into the prefab in the EM5 world editor.  Take your new civilian unit and open up the police vehicle.  Place them both into the editor at the same top and look at the difference between the two.  I know that you MUST change a property so the vehicle can be USER controlled.  I know that setting is "0"

I also know you have to add the component "Em5 commendable" then you have to add the command array from the police vehicle.  I have never had luck copying from one vehicle to another in the EM5 world editor.  So for the array you may have to do that in Wordpad.  Hopefully this can hold you over until I can get the prefab to you)

 

William516

Bill

Delaware,USA



#11 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 18 September 2015 - 03:50 PM

ya i did place them next to each other last night and got the command added to the suv. Still having trouble finding this user vehicle setting.... can't find it in the json file of the civil_car06 or anything .... still digging... will be waiting to hear from you as there isnt much i can do without figuring that out haha. Nice progress though. Some nice work for sure



#12 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 18 September 2015 - 10:06 PM

Walker

I just checked it is actually under "AI Navigation"  "Mover Type"  Change this to 0 "Player vehicle"

That should make the vehicle playable as a unit.

 

Open up your EM5 world editor and it should be in the properties of whatever vehicle you are using.  If not let me know.

 

William516

Bill

Delaware,USA



#13 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 18 September 2015 - 10:13 PM

Ok more updates on the progress.

I have now figured out where all the graphics are coming from.  Still no luck on the % stats yet.  I have also figured out the name of the unit so I don't have to look at the silly ID thing.

 

2015_09_18_00003.jpg

Unit name and icon now show up in the Select vehicle slot correctly.

 

2015_09_18_00005.jpg

Custom made help file now as well.  The only problem is once again somewhere there is text for the help file that I cant find.  Another search to find that as well.  This is a nice little thing as we will be able to tell about the features of the car in game and how to use them when/if anyone gets that far.

 

Moving right along with what little time I get to play with things.

 

William516

Bill

Delaware,USA



#14 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 18 September 2015 - 11:26 PM

My problem for some reason is I csnt change the values in the editor all the sudden... I use to be able to.... This is werid... Had this happen to you at all?

#15 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 19 September 2015 - 12:36 AM

Check to make sure you didnt close the running project. Make sure that your project and only your project is running and highlighted.

Are you getting any errors in your debug lines. If so wjat are they. All else fails reboot the computer.

I have had it happen after the new patch sometimes.

William516
Bill
Delaware, USA

#16 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 19 September 2015 - 12:43 AM

Alright Ill try that and let ya know... Sometime tonight I hope..

#17 William Stapleford

William Stapleford

    Lieutenant

  • Members
  • 99 posts

Posted 19 September 2015 - 02:02 AM

I'm working on multiple things at the same time so soon you should see another post.  I know Frozenone said he figured it out but i think i did too now.  Not like I'm copying off him or anything.  I was trying to figure this trick out for awhile and after looking at tons of .json files i think i finally found the one i was looking for.  Stay tuned lol

 

William516

Bill

Delaware,USA



#18 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 19 September 2015 - 02:25 PM

got the vehicle to move out of HQ finally and it didn't disappear. Thanks William haha


Edited by Walker282, 19 September 2015 - 02:36 PM.
Posts merged. Please use the edit button in future.


#19 Walker282

Walker282

    Lieutenant

  • Members
  • 67 posts
  • Gender:Male

Posted 19 September 2015 - 03:07 PM

Will:

 

Have you gotten the amour resistances to change from zero yet? If not the values are in the EM5 Road Vehicle drop down box in Object Properties in the editor. It is under Resistances. The values are 0.000000 and 0.800000 or whatever you want the car to be



#20 randomperson139

randomperson139

    Forum Ninja

  • Sub-Moderator
  • 5,404 posts
  • Gender:Not Telling
  • Location:Hiding in the shadows...

Posted 19 September 2015 - 03:12 PM

Seriously? I literally just merged your previous two posts... Don't double post, use the edit button. That is what it's for.


Owner of 295 Warning Points
Executive Director: Forum Child Watch

Think a lot. Say little. Write nothing.
-J.P. Morgan