Author | Message |
9kRPM
Posts: 50
Location: Argentina Occupation: Age: V$: |
#143884 2018-07-02 20:25 |
# gorgoil : great work bro # Outlaw_Racer : Hey! You came back ! # Lagano : Sounds good! The idle lacks that brap brap though. Also where did you find that track?Thanks to all You can find the track in kietekas, but you need an account. __________________________________________________________________________________________________________
UPDATE: To do this, I modified the Track.java, Block.java and the block java of the engine that I was using (in this case, Emer_StreetGT_block.java). I will dont share the complete files because all we have different versions, so I will share only the code parts. Starting with parts/scripts/enginepart/src/Block.java, you need to add the following atributes: int TRUE = 1; int FALSE = 0; int internalCamera = FALSE; int hoodCamera = FALSE; int externalCamera = TRUE; And add the following functions too: public void setInternalCameraSound() { externalCamera = FALSE; if(internalCamera == TRUE) { internalCamera = FALSE; hoodCamera = TRUE; } else internalCamera = TRUE; } public void setExternalCameraSound() { internalCamera = FALSE; hoodCamera = FALSE; externalCamera = TRUE; } Now, in the block java of the engine, for example parts/engine/Baiern_Emer/scripts/src/Emer_StreetGT_block.java, You need to add the following functions (with your custom sounds): public void setExteriorSfxTable(SfxTable tab) { if (tab = the_car.getSfxTable(0))//S54 on { tab.clear(); tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000002Ar), 1216, 500.0, 1306, 2, 3);//on1 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000002Br), 1306, 1216, 1577, 3, 4);//on2 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000002Cr), 1577, 1306, 2831, 4, 5);//on3 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000002Dr), 2831, 1577, 4322, 5, 6);//on4 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000002Er), 4322, 2831, 5913, 6, 7);//on5 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000002Fr), 5913, 4322, 18000, 7, 9);//on6 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000030r), 7333, 5913, 18000, 8, 9);//on7 } if (tab = the_car.getSfxTable(1))//S54 off { tab.clear(); tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000023r), 1216, 500.0, 1306, 2, 3);//off1 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000024r), 1306, 1216, 1577, 1, 2);//off2 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000025r), 1577, 1306, 2831, 2, 3);//off3 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000026r), 2831, 1577, 4322, 3, 4);//off4 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000027r), 4322, 2831, 5913, 4, 5);//off5 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000028r), 5913, 4322, 7333, 5, 6);//off6 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000029r), 7333, 5913, 18000, 6, 7);//off7 } if (tab = the_car.getSfxTable(2)) { tab.clear(); the_car.setSfxExhaustMinVol(0.9); } } public void setHoodSfxTable(SfxTable tab) { if (tab = the_car.getSfxTable(0))//S42 on { tab.clear(); tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000045r), 1216, 500, 1577, 9, 9);//on1 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000046r), 1577, 1216, 2831, 9, 9);//on2 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000047r), 2831, 1577, 4322, 9, 9);//on3 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000048r), 4322, 2831, 5913, 9, 9);//on4 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000049r), 5913, 4322, 18000, 9, 9);//on5 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000004Ar), 7333, 5913, 18000, 9, 9);//on6 } if (tab = the_car.getSfxTable(1))//S42 off { tab.clear(); tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000003Er), 1216, 500, 1577, 1, 1);//on1 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000003Fr), 1577, 1216, 2831, 1, 1);//on2 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000040r), 2831, 1577, 4322, 1, 1);//on3 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000041r), 4322, 2831, 5913, 1, 1);//on4 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000042r), 5913, 4322, 7333, 1, 1);//on5 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000043r), 7333, 5913, 18000, 1, 1);//on6 } if (tab = the_car.getSfxTable(2)) { tab.clear(); the_car.setSfxExhaustMinVol(0.1); } } public void setInteriorSfxTable(SfxTable tab) { if (tab = the_car.getSfxTable(0))//S42 on { tab.clear(); tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000019r), 1216, 500, 1577, 9, 9);//on1 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000001Ar), 1577, 1216, 2831, 9, 9);//on2 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000001Br), 2831, 1577, 4322, 9, 9);//on3 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000001Cr), 4322, 2831, 5913, 9, 9);//on4 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000001Dr), 5913, 4322, 18000, 9, 9);//on5 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x0000001Er), 7333, 5913, 18000, 9, 9);//on6 } if (tab = the_car.getSfxTable(1))//S42 off { tab.clear(); tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000011r), 1216, 500, 1577, 1, 1);//on1 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000012r), 1577, 1216, 2831, 1, 1);//on2 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000013r), 2831, 1577, 4322, 1, 1);//on3 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000014r), 4322, 2831, 5913, 1, 1);//on4 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000015r), 5913, 4322, 7333, 1, 1);//on5 tab.addItem(new ResourceRef(addon.Sounds.PureSound.BMW:0x00000016r), 7333, 5913, 18000, 1, 1);//on6 } if (tab = the_car.getSfxTable(2)) { tab.clear(); the_car.setSfxExhaustMinVol(0.1); } } And the "public void updatevariables()" will be like this: public void updatevariables() { super.updatevariables(); if (the_car) { the_car.starter_torque = 20.0; SfxTable tab; if(internalCamera == TRUE) setInteriorSfxTable(tab); if(externalCamera == TRUE) setExteriorSfxTable(tab); if(hoodCamera == TRUE) setHoodSfxTable(tab); } } Now inside sl/scripts/game/src/Track.java You need to import the following packages: import java.game.*; import java.game.parts.enginepart.*; import java.game.parts.bodypart.*; And added the atribute: Block engine = null; The constructor will be like this: public Track() { createNativeInstance(); player=GameLogic.player; player2=GameLogic.player2; int nElements = 0; //this "while" gets the instance of the block that the car is using while(nElements < player.car.chassis.attachedParts.size() && engine == null) { if(player.car.chassis.attachedParts.elementAt(nElements) instanceof Block) engine = player.car.chassis.attachedParts.elementAt(nElements); nElements++; } } In "public void enter( GameState prev_state )" and "public void exit( GameState next_state )", the first two lines are: engine.setExternalCameraSound(); player.car.chassis.updatevariables(); Inside "public void handleMessage( Message m )" there are two "if" statement together: "if( cmd == CMD_CHANGECAM_INT )" and "if( cmd == CMD_CHANGECAM_EXT )". You will modifiy both like this: if( cmd == CMD_CHANGECAM_INT ) { changeCamInternal(); engine.setInternalCameraSound(); player.car.chassis.updatevariables(); } else if( cmd == CMD_CHANGECAM_EXT ) { if (cameraMode != CAMMODE_FOLLOW) { changeCamFollow(); engine.setExternalCameraSound(); player.car.chassis.updatevariables(); } } And thats all. For any question comment here. |
|
-------------------------------------------------------- youtube.com/9kRPM Discord: 9kRPM#6366 -------------------------------------------------------- |