Category | Scripting |
Created | 03.11.2016 20:54 |
Julien Rüggeberg (Unknown) | 03.11.2016 20:59 |
---|---|
Hey Guys, I have some trouble in changing to another Vehicle by code. In Fs15 I used g_client:getServerConnection():sendEvent(VehicleEnterRequestEvent:new(g_currentMission.steerables[Index], g_settingsNickname)); to switch to a new Vehicle, however in FS 17 this does not work, I get stuck in vehicles, tabbing is not working anymore and so on, although the first switch seems to work. Regarding the luadoc, I've changed this to g_client:getServerConnection():sendEvent(VehicleEnterRequestEvent:new(g_currentMission.steerables[index], g_settingsNickname, g_currentMission.player.id, g_currentMission.player.playerColorIndex)); but the result stays the same. Log shows Error: Running LUA method 'update'. dataS/scripts/vehicles/specializations/Steerable.lua:0: attempt to index a nil value I've also tried using g_currentMission.steerables[index]:enterVehicle(true, g_currentMission.player.id, g_currentMission.player.playerColorIndex); but this doesn't work, there's simply no switch occuring. No errors in log either. I've then tried g_server:broadcastEvent(VehicleEnterRequestEvent:new(g_currentMission.steerables[index], g_settingsNickname, g_currentMission.player.id, g_currentMission.player.playerColorIndex)); but this seems to do nothing. Only way it worked for me yet was g_currentMission:requestToEnterVehicle(g_currentMission.steerables[index]); but this seems to cause trouble in multiplayer on some machines (CTD). What would be the correct way to switch vehicles via the g_currentMission.steerables-table both for SP and MP? Any tip is appreciated! |
Mass Yas (massyas) | 11.11.2016 22:10 |
---|---|
Hello, For me it's working with g_client:getServerConnection():sendEvent(VehicleEnterRequestEvent:new(self.currentVehicle, g_settingsNickname, self.playerIndex, self.playerColorIndex)); self.currentVehicle is the vehicle I want to enter, self.playerIndex is set to 1 self.playerColorIndex = g_currentMission.player.playerColorIndex But i have some issue, like when camera is inside the vehicle I have sometimes the character still visible, so I can see the inside of the character. Should I use vehicleCharacter:setCharacterVisibility(false) to hide it ? Is there something special to do compared to FS15 ? Thanks for feedbacks |
Note: Log in to post. Create a new account here.