|
Post by MonstaWolf on Apr 27, 2016 12:20:40 GMT
I think I already know what the answer would be, but I'll ask it anyways. Is there a way to load an object's setting file (.obb) from within the game?
|
|
|
Post by Power Supersport on Apr 27, 2016 14:32:20 GMT
Very interesting concept indeed... If you were just able to do so, you would be able to make different car settings and load them runtime...
But I never used that technique... I never figured out if it is possible to do it...
|
|
|
Post by MonstaWolf on Apr 28, 2016 14:23:47 GMT
That would be extremely helpful if it worked. I'm stuck at a point right now where I'm trying to make it load car settings depending on what car you have chosen. All was going fine until I needed a way to change the wheel positions on the PCar with a script. If I keep the wheels how they are, they end up being too far back. Is there a way to set with a script?
|
|
|
Post by Power Supersport on Apr 28, 2016 15:14:06 GMT
There is a way, I will explain it step by step, but you have to know this is a pretty hard way of getting this implemented... Just preparing you...
If you go to the car folder, you see all these INI files with configuration...
Now, follow carefully and read carefully because this can be a little complicated...
COPY a main car properties (You probably use one car for collision)... I usually use Mercedes 190E... You have to copy all of the necessary files for the car to work... - mercedes190E.dds - mercedes190E.ini - mercedes190E_a.x - mercedes190E_a_shadow.x - mercedes190E_body_.spg
REPLACE the word mercedes190E with a custom name... You can use any name and keep in mind that it will be used by a script... Something like "custom" will be fine... But rename the COPIED files... They should look like this... - custom.dds - custom.ini - custom_a.x - custom_a_shadow.x - custom_body_.spg
ADD an index image into the index folder... Rename the image "custom"...
CREATE a folder in the MAIN directory of 3D Rad, called "car_settings" for example... It basicly doesn't matter where you will put the folder, but the easiest way to do so is to place it in the main directory...
Save the custom.ini file somewhere as a backup...
Now go back in 3D Rad and load up "custom" as a car in a NEW project...
This is the time to set up all of your cars' settings... Put a skinmesh on the car and set up the tires in the editor... When everything is done, do NOT close 3D Rad... Open the "custom.ini" file... Combine the numbers you have in the editor with the numbers in the file in "WheelLocations"...
In the file of your example car settings, you will see the default offset of the car's tires...
(WheelLocations) //coordinates are car-body model center relative -0.71,-0.50,1.45 //front-left 0.71,-0.50,1.45 //front-right -0.71,-0.50,-1.2 //rear-left 0.71,-0.50,-1.2 //rear-right Now combine the values... Let's just say that you have offset in the editor of: Front Tires: -0.1, -0.1, 0.2; Rear Tires: 0, -0.1, -0.2;
In position X, you have to subtract the absolute value... By this I mean... front-left = -0.61 front-right = 0.61 /Same goes for rear/
Do not count the minus here...
In position Y, everything is OK... Just do a simple math on them... front-left = -0.6 front-right= -0.6 /Same goes for rear/
In position Z, you do the same simple math as in Y... front-left = 1.65 front-right = 1.65 rear-left = -1.4 rear-right = -1.4
DISCLAIMER: All values that we combined are according to the example... You will have your own values... These are picked up to help you understand how it's done...
Now save the custom.ini file...
RELOAD the car in 3D Rad with OFFSET 0... By reload I mean either reloading the project or changing the car with another car and then reverting it to "custom"...
Check if your tires are on place... If they are not, make the same procedure with the offsets in the editor and combine them with the file... If the tires are fine, then you are on your way...
COPY the "custom.ini" file and paste it into the "car_settings" folder...
RENAME it with the model of the car(peugeot, mazda, bmw, mercedes etc...) Just rename it so you know this is a file for the specified car...
REVERT the backup on the "custom" file in the car folder...
RELOAD the car in 3D Rad and start setting up your next car... And repeat everything I said before...
When you're ready, time for scripting...
First, all of your cars must have different "custom" titled car settings... For example, you have 5 cars into the scene... you will have 5 different "custom" settings... (custom1, custom2, custom3, custom4, custom5)... Their VALUES don't matter...
The script has to be into a project before the main scene...
It has to copy the settings from "car_settings" and place them on "custom1" (or custom2 etc...) I think you can script this on your own...
Unfortunately, if you want to change the car runtime, you have to reload the whole project... But it works...
That's all the stuff you need to know... Ask questions if you have, because I am sure you will have...
|
|
|
Post by MonstaWolf on Apr 28, 2016 15:30:16 GMT
Woah, dude... you are freaking incredible, thank you so much. I'm definitely going to try this after my lunch... thanks a ton!
|
|
|
Post by Power Supersport on Apr 28, 2016 15:35:01 GMT
I am always ready to help you... You deserve respect and attention!
|
|
|
Post by MonstaWolf on Apr 28, 2016 15:56:21 GMT
So do you It's incredible how you know all of this stuff
|
|
|
Post by Power Supersport on Apr 28, 2016 16:07:38 GMT
Logic is one of my favourite and most important skills... You gain it anyway while programming... Just continue scripting and you will find gaps...
|
|
|
Post by MonstaWolf on Apr 28, 2016 16:09:07 GMT
My scripting skills have greatly improved since I first started, and I'm quite proud of how far I've come
|
|
|
Post by MonstaWolf on May 18, 2016 15:13:56 GMT
So, I got confused towards the end parts. In my Car_Settings folder, I have Custom1.ini and Custom2.ini, for each respective car, and in my car data folder, I have the one car named "Custom" with it's needed files. Am I supposed to be having the script copy from one of the files in the Car_Settings folder to the Custom.ini in the data folder?
|
|
|
Post by Power Supersport on May 20, 2016 13:06:17 GMT
Sorry for not replying you recently... It was because I had exams and I didn't have the time to think deeply... I had to read my post again to tell you what exactly needs to be done... So, if you have 5 cars into the scene (1 drivable and 4 AI for example), it means that you need to have 5 different system car INI-s... Because each car must have a slot for refresh... I will try to tell you the script logic with an example...
You chose BMW for your car... The script copies the bmw.ini file from the Car_settings folder and OVERWRITES the custom1.ini (The first custom car)... The first AI car has randomizer and it chose to be Mazda... The script copies the mazda.ini file from the Car_settings and OVERWRITES the custom2.ini (the second custom car)... And so on...
You just need to keep a slot for every car in the scene... Which means that your cars in the scene will be custom1, custom2, custom3, custom4, custom5... I do try to explain it my best, but if you still don't get something, tell me...
|
|
|
Post by MonstaWolf on May 23, 2016 12:05:59 GMT
I understand it now, but I have one last question...
What function(s) would be most efficient in copying the file or file contents?
|
|
|
Post by Power Supersport on May 23, 2016 13:32:29 GMT
You can copy file with iFileCopy(); It's flawless...
|
|
|
Post by MonstaWolf on May 23, 2016 13:34:35 GMT
I tried it, and for some reason, it won't seem to work :/
|
|
|
Post by Power Supersport on May 23, 2016 15:03:52 GMT
iFileCopy(".\\car_settings\\bmw.ini",".\\3DRad_res\\objects\\car\\data\\custom1\\custom1.ini"); I think that should help...
|
|
|
Post by Famer on May 23, 2016 15:47:38 GMT
Power Supersport, was it tough for you to learn angelscripting? I am afraid of those big syntaxes!
|
|
|
Post by Power Supersport on May 23, 2016 16:38:01 GMT
It's hard to start... You will be afraid to start... But just do it... Experiment with the functions... I learned AngelScript alone...
|
|
|
Post by nick on May 24, 2016 9:01:18 GMT
congratulations power supersport for learning the angelscripting
|
|
|
Post by MonstaWolf on May 24, 2016 12:46:09 GMT
iFileCopy(".\\car_settings\\bmw.ini",".\\3DRad_res\\objects\\car\\data\\custom1\\custom1.ini"); I think that should help... Hrm, I used it right the first time then... maybe I just mistyped something XP
|
|
|
Post by MonstaWolf on May 24, 2016 12:49:17 GMT
Power Supersport, was it tough for you to learn angelscripting? I am afraid of those big syntaxes! As for me, it took a while, but eventually it just 'clicked.' Once you understand the logic behind it, you just suddenly get it. At least, that's how it happened with me.
|
|