Forum
Questions, builds, help and the odd argument. The mods and guides are out front.
Hi guys! I have a small problem with an engine. I was making new sounds for him, changed the java block based on GM L44 engine (Harrison15's Pontiac Fiero).
But when I test it, says that the alternator is missing, but he's not missing. I've tried many things, but none of right .. can someone help me?
(sorry my bad english xD)
Chances are that you forgot to change the alternator slot ID within the new Java code. Go into the .cfg for the block and look for the correct alternator slot ID #, and then change the ID within the .java file accordingly (something like "if partOnSlot( ### )").
Thank Harrison15, but see if I understand right:
cfg of the block:
slot 0.000 0.000 0.000 0.000 0.000 0.000 14 ; engine_block_alternator_IN
slotdmgmode 0x00000002
The number of slot is the 14?
Then I have to put 14 in the java of block?
p = partOnSlot( 14 );
if (!p)
return "the engine is missing the alternator.";
return super.isDynoable();
This right?
Added 6 hours 53 minutes later:
I made all the settings, but when I go to load game the game crashes and this error:
JVM::compileSource: Syntax error in "parts\engines\MAZDANA8C\scripts\src\Ishima_IshiBox_block.java" at line 161
I went to the line 161, but there's nothing wrong there.. what can it be?
Please post the complete CFG file and the Java source for your engine block. That will give me a better idea what the problem is.
Spoiler:
package java.game.parts.engines.mazdana8c;
import java.util.;
import java.util.resource.;
import java.game.;
import java.game.parts.;
import java.game.parts.enginepart.;
import java.game.parts.enginepart.block.block_inline.;
import java.game.parts.enginepart.slidingenginepart.reciprocatingenginepart.;
import java.game.cars.;
public class mazdana8c extends Block_Vee_OHC
{
int turbotype;
public mazdana8c( int id )
{
super( id );
name = "NA8C Engine Block";
description = "High RPM engine block";
value = tHUF2USD(120);
brand_new_prestige_value = 38.32;
setMaxWear(kmToMaxWear(420000.0));
bore = 89.0;
cylinder_length_from_top = 133.43;
crank_center_to_cylinder_top = 280.60;
crankshaft_slot_ID = 40;
transmission_slot_ID = 1;
crankshaft_bearing_slot_ID = 97;
oil_pan_slot_ID = 37;
cylinder_head_slot_ID = 47;
rpm_idle = 900.0;
time_spark_min = sparkAngleTo4cycleTime(330.0);
time_spark_inc = sparkAngleTo4cycleTime(335.0)-time_spark_min;
time_spark_RPM0 = 3250;
time_spark_RPM1 = 5750;
RPM_limit = 11000;
cylinders = 4;
check4warnings();
}
public void getTurboType()
{
Part Rcyl = this.partOnSlot(this.R_cylinder_head_slot_ID);
if (Rcyl)
{
Part exh = Rcyl.partOnSlot(16);
if (exh)
{
Part turbo = exh.partOnSlot(53);
if (turbo && turbo instanceof GM_V6_twin_turbocharger)
turbotype = 4;
else
if (turbo)
{
turbotype = 2;
}
else
{
turbotype = 1;
}
}
else
{
turbotype = 1;
}
}
else
{
turbotype = 0;
}
}
public void updatevariables()
{
super.updatevariables();
getTurboType();
// includes code by NightRiderBR //
// ALL SOUNDS BY ELECTRONIC ARTS, SIMBIN, OR INVICTUS GAMES //
if (the_car)
{
SfxTable tab;
if (tab = the_car.getSfxTable(0))
{
tab.clear();
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000A0r), 900.0, 500.0, 1800.0, 0.22, 0.22);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000A2r), 2000.0, 1000.0, 3000.0, 0.22, 0.32);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000A4r), 3000.0, 2000.0, 5500.0, 0.32, 0.42);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000A9r), 5500.0, 3500.0,18000.0, 0.42, 0.50);
}
if (tab = the_car.getSfxTable(1))
{
tab.clear();
if (dynodata.P_turbo_max > 0.0)
{
if (dynodata.P_turbo_waste >= 0.75)
{
if (this.turbotype == 2)
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001AEr), 8000.0, 6000.0, 12000.0, (1.25*dynodata.P_turbo_waste), (1.25*dynodata.P_turbo_waste));
else
if (this.turbotype == 4)
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001AFr), 7000.0, 5000.0, 12000.0, (1.5*dynodata.P_turbo_waste), (1.5*dynodata.P_turbo_waste));
}
}
if (dynodata.mixture_ratio <= 11.5 )
{
if (dynodata.mixture_ratio <= 9.5 )
{
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001B2r), 5500.0, 4500.0, 12000.0, 0.80, 1.20);
}
else
{
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001B1r), 5500.0, 4500.0, 12000.0, 0.80, 1.20);
}
}
}
if (tab = the_car.getSfxTable(2))
{
tab.clear();
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000ABr), 900.0, 150.0, 1350.0, 2.0, 2.0);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000ACr), 4500.0, 1000.0, 2300.0, 0.5, 0.5);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000AEr), 6000.0, 1600.0, 3500.0, 1.0, 1.0);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000B1r), 6000.0, 2500.0,18000.0, 1.0, 1.0);
if (dynodata.P_turbo_waste >= 0.5)
{
if (this.turbotype == 1)
{
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001B3r), 5000.0, 800.0, 12000.0, 1.00, 1.00);
}
}
the_car.setSfxExhaustMinVol(0.8);
}
}
}
public String isDynoable()
{
Part p;
p = partOnSlot( 14 );
if (!p)
return "the engine is missing the alternator.";
return super.isDynoable();
}
}
Spoiler: # Vehicle importer wizard generated part configuration file #
resource ID of this part: 0x000000DF
resource alias of this part: "Ishima_IshiBox_block"
lods 3 0.001 1 2
#render 0x00000091
#lod 0 0 //lo-res
render 0x0000001F ; "93x90er_engine_block - 1 1"
lod 1 1 //hi-res
render 0x0000001F
lod 2 2 //extr-hi-res
mesh 0x0000001E
texture 0x0000971A
click 0x0000006D
body 0.0 0.0 0.0 0.0 0.0 0.0 39.0 sphere 0.1
noclick
nocollision
category 1
slot 0.000 -0.200 -0.100 0.000 0.000 0.000 99 ; japanese_engine_block_OUT
slot 0.000 0.000 0.000 0.000 0.000 0.000 14 ; engine_block_alternator_IN
slotdmgmode 0x00000002
slot 0.000 0.200 0.000 0.000 0.000 0.000 47 ; engine_block_cylinder_head_IN
slotdmgmode 0x0000000E
slot 0.000 0.000 1.000 0.000 0.000 0.000 1 ; engine_block_transmission_IN
slotdmgmode 0x0000000A
slot 0.000 -0.150 0.000 0.000 0.000 0.000 40 ; engine_block_crankshaft_IN
slotdmgmode 0x00000002
slot 0.000 -0.150 0.000 0.000 0.000 0.000 97 ; engine_block_crankshaft_bearing_bridge_IN
slotdmgmode 0x00000002
slot 0.000 0.000 0.000 0.000 0.000 0.000 37 ; engine_block_oil_pan_IN
slotdmgmode 0x00000002
slot 0.130 0.025 -0.200 0.000 0.000 0.000 3037 ; engine_block_oilcool
slotdmgmode 0x00000002
slot 0.000 0.000 0.000 0.000 0.000 0.000 4037 ; engine_block_oilcool
slotdmgmode 0x00000002
slot -0.101 0.237 -0.230 0.000 0.000 0.000 18 ; engine_block_supercharger_IN
slotdmgmode 0x0000000E
eof
It looks like you copied the entire source code from the Fiero engine block and overwrote the NA8C engine block's code with it. This won't work, because the Fiero V6 is a vee-type engine and the NA8C is an inline-type engine, so the slots are going to be different. Furthermore, the "turbotype" code won't work either because it uses tricks specific to the Fiero engine.
I realized this, I made some changes .. looks the new code:
Spoiler:
package java.game.parts.engines.mazdana8c;
import java.util.;
import java.util.resource.;
import java.game.;
import java.game.parts.;
import java.game.parts.enginepart.;
import java.game.parts.enginepart.block.block_inline.;
import java.game.parts.enginepart.slidingenginepart.reciprocatingenginepart.;
import java.game.cars.;
public class mazdana8c extends Block_Inline_OHC
{
public mazdana8c( int id )
{
super( id );
name = "mazdana8c";
description = "mazdana8c teste";
value = tHUF2USD(120);
brand_new_prestige_value = 38.32;
setMaxWear(kmToMaxWear(420000.0));
bore = 89.0;
cylinder_length_from_top = 133.43;
crank_center_to_cylinder_top = 280.60;
crankshaft_slot_ID = 40;
transmission_slot_ID = 1;
crankshaft_bearing_slot_ID = 97;
oil_pan_slot_ID = 37;
cylinder_head_slot_ID = 47;
rpm_idle = 900.0;
time_spark_min = sparkAngleTo4cycleTime(330.0);
time_spark_inc = sparkAngleTo4cycleTime(335.0)-time_spark_min;
time_spark_RPM0 = 3250;
time_spark_RPM1 = 5750;
RPM_limit = 11000;
cylinders = 4;
check4warnings();
}
public void updatevariables()
{
super.updatevariables();
getTurboType();
// includes code by NightRiderBR //
// ALL SOUNDS BY ELECTRONIC ARTS, SIMBIN, OR INVICTUS GAMES //
if (the_car)
{
SfxTable tab;
if (tab = the_car.getSfxTable(0))
{
tab.clear();
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000A0r), 900.0, 500.0, 1800.0, 0.22, 0.22);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000A2r), 2000.0, 1000.0, 3000.0, 0.22, 0.32);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000A4r), 3000.0, 2000.0, 5500.0, 0.32, 0.42);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000A9r), 5500.0, 3500.0,18000.0, 0.42, 0.50);
}
if (tab = the_car.getSfxTable(1))
{
tab.clear();
if (dynodata.P_turbo_max > 0.0)
{
if (dynodata.P_turbo_waste >= 0.75)
{
if (this.turbotype == 2)
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001AEr), 8000.0, 6000.0, 12000.0, (1.25*dynodata.P_turbo_waste), (1.25*dynodata.P_turbo_waste));
else
if (this.turbotype == 4)
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001AFr), 7000.0, 5000.0, 12000.0, (1.5*dynodata.P_turbo_waste), (1.5*dynodata.P_turbo_waste));
}
}
if (dynodata.mixture_ratio <= 11.5 )
{
if (dynodata.mixture_ratio <= 9.5 )
{
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001B2r), 5500.0, 4500.0, 12000.0, 0.80, 1.20);
}
else
{
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001B1r), 5500.0, 4500.0, 12000.0, 0.80, 1.20);
}
}
}
if (tab = the_car.getSfxTable(2))
{
tab.clear();
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000ABr), 900.0, 150.0, 1350.0, 2.0, 2.0);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000ACr), 4500.0, 1000.0, 2300.0, 0.5, 0.5);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000AEr), 6000.0, 1600.0, 3500.0, 1.0, 1.0);
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000000B1r), 6000.0, 2500.0,18000.0, 1.0, 1.0);
if (dynodata.P_turbo_waste >= 0.5)
{
if (this.turbotype == 1)
{
tab.addItem(new ResourceRef(parts.engines.General_Motors_L44:0x000001B3r), 5000.0, 800.0, 12000.0, 1.00, 1.00);
}
}
the_car.setSfxExhaustMinVol(0.8);
}
}
}
public String isDynoable()
{
Part p;
p = partOnSlot( 14 );
if (!p)
return "the engine is missing the alternator.";
return super.isDynoable();
}
}