Forum
Questions, builds, help and the odd argument. The mods and guides are out front.
Well, there is not that much to say. When ever i try to open the headlights, the "Angle" script doesn't work. Its an S13 with onevia front end (not svander/razine one).
Here some Pics:
Before clicking enything:
After clicking light
Moving the bar (nothing happens)
After clicking "ok" (as you can see, cero results)
Spoiler: package java.game.cars;
import java.render.osd.;
import java.io.;
import java.util.;
import java.util.resource.;
import java.game.;
import java.game.parts.bodypart.;
public class Baiern_L_headlights_4 extends Wing
{
float rads, degs;
public Baiern_L_headlights_4( int id )
{
super( id );
carCategory = COMMON;
name = "left headlights Onevia";
description = "";
value = tHUF2USD(40.000);
brand_new_prestige_value = 50.00;
rads = 0.0;
degs = rad2deg(rads);
setSlotPos( 9, null, new Ypr(0.000,rads,0.000) );
}
public void load( File saveGame )
{
super.load( saveGame );
int save_ver = saveGame.readInt();
if (save_ver >= 1)
{
rads = saveGame.readFloat();
}
}
public void save( File saveGame )
{
super.save( saveGame );
int save_ver = 2;
saveGame.write( save_ver );
if (save_ver >= 1)
{
saveGame.write( rads );
}
}
float old_rads;
public int isTuneable()
{
return true;
}
public void buildTuningMenu( Menu m )
{
old_rads = rads;
degs = rad2deg(rads);
m.addItem( "Angle", 1, degs, -43.0, 0.0, 1.1, null ).printValue(" %1.1f degrees");
m.addItem( "Reset to factory defaults", 0); //this should always be with cmd=0
}
public void endTuningSession( int cancelled )
{
if( cancelled )
{
rads = old_rads;
}
else
{
if (rads != old_rads)
GameLogic.spendTime(5*60);
getCar_LocalVersion();
if (the_car)
the_car.forceUpdate();
}
}
public void handleMessage( Event m )
{
if( m.cmd == 0 )
{
rads = 0.0;
m.gadget.osd.findGadget( this, 1 ).setValue( 0.0 );
setSlotPos( 9, null, new Ypr(0.000,rads,0.000) );
}
else
if( m.cmd == 1 )
{
rads = deg2rad(((Slider)m.gadget).value);
degs = ((Slider)m.gadget).value;
((Slider)m.gadget).changeVLabelText( Float.toString(degs, " %1.1f degrees"));
setSlotPos( 9, null, new Ypr(0.000,rads,0.000) );
}
}
public float rad2deg( float rad )
{
return(rad * 180 / 3.141);
}
public float deg2rad( float deg )
{
return(deg * 3.141 / 180);
}
}
Spoiler: # Vehicle importer wizard generated part configuration file #
resource ID of this part: 0x00000173
resource alias of this part: "L headlights 4"
render 0x00000176
mesh 0x00000175
texture 0x00020025
click 0x00000177
damage 0.10
front lights
render 0x0000018c 0.000 0.000 0.000 0.000 0.000 0.000 ; CITY
flags 4
render 0x00000191 0.000 0.000 0.000 0.000 0.000 0.000 ; INDICATOR
flags 16
render 0x00030008 0.000 0.000 0.000 0.087 0.000 0.000 ; CITY
flags 4
render 0x00030026 0.000 0.000 0.000 0.0 0.000 0.000 ; INDICATOR
flags 16
body 0.001 -0.001 -0.001 0.000 0.000 0.000 2.000 cars\racers\Nissan_Silvia_S13_data_phys_phys_L_headlights.scx ;0x00000017
total mass: 2.000 kg
category 2
slot 0.473 0.113 1.770 0.000 0.000 0.000 7 ; L_headlights
attach 0x00000006 7 ; chassis->L_headlights
attach 0x00000157 7 ; cabrio chassis->L_headlights
'L headlights' deflector
wing 4 -0.051917300 0.008619690 -0.029940500 -0.295864000 0.264491000 -0.895615000 1.332964500 -0.250 0.666
eof
Thanks in advance!
# PzyDuck :
After clicking "ok" (as you can see, cero results)
# PzyDuck :
as you can see, cero results
# PzyDuck :
see, cero results
# PzyDuck :
cero results
# PzyDuck :
cero
Sorry, had to do it. 😃
Btw i have no clue on how to fix that, i never messed too much with lights scripts, try asking Svander he will surely be able to help you(or wait Harrison15).
ps: i should've quoted also "Left_Headlingt_4.cfg".. oh, i just did 😃
You should fix the slot id in the headlight java.
Sorry about the zero, spanish shit :p
I asume Harrison doesn't have time or doesn't want to help as he ignore my PM. Thats why i post here.
Svander is still active? :/
Added 1 minute later:
# IceD :
You should fix the slot id in the headlight java.
Aaaaaaaaaaaaaaaaaaaaaaand a noob here, dont know how to do that :/
He does well to ignore your pm, topics are made to be used. 😉
Just change set slot pos from 9 to 7.
setSlotPos( 9, null, new Ypr(0.000,rads,0.000) ); slot in headlight cfg
slot 0.473 0.113 1.770 0.000 0.000 0.000 7 ; L_headlights your slot number/id
All you have to do is change that 9 in java to 7.
It works, but..
What car is that anyway?
now, you need to fix coordinates of the headlight, which is quite a pain in the butt. You need to play with headlight slot in main.cfg of the car and
slot 0.473 0.113 1.770 0.000 0.000 0.000 7 ; L_headlights here. these coordinates must be flipped and used in the main cfg. so basically you need to find your headlight slot in main.cfg and instead of zeros use -0.473 -0.113 -1.770 0.000 0.000 0.000 7
and in your cfg use 0.000 0.000 0.000 0.000 0.000 0.000 7
Last step to do is play with the third coordinates to get the pivot positioning right.
P.S. if you want, you can send me the car and i'll try to fix it.
Thanks for the help bros! 🙂