XetaQuake Posted May 18, 2008 Share Posted May 18, 2008 Hi, i have a funny problem and PLEEASS take a little bit time to help me i created a cylinder-marker, and when i drive in it, i want to be teleporting in an interior. and yes, all that´s works PERFECT!, but: ( ) when i drive with a vehicle in it, i get pushed extremely away, here is a screenshot: (I think most people know what i mean, it´s like a cheater pushes you away in the old mta race client. ) Now i trying to fix that, and i already have a idea: i create a vehicle frezz time after the vehicle and player teleports, and 3 (for example) seconds latter, it will be unleashed. Ok, i already scripting it, but now the vehicle don´t move in the interior, its freezed inside the cylinder. The player moves to the interior, but he is still in the vehicle and so he don´t teleports too: Here is my code: ... ... function markerBeamer( player ) if isPlayerInVehicle ( player ) then setElementInterior ( player, 15, -1400.5998535156, 996.78350830078, 1043.6085205078 ) setPlayerRotation ( player, 90 ) local playerVehicle = getPlayerOccupiedVehicle ( player ) setVehicleFrozen ( playerVehicle, true ) setTimer( unfrozen, 3000, 1 ) end end function unfrozen( player ) local playerVehicle = getPlayerOccupiedVehicle ( player ) setVehicleFrozen ( playerVehicle, false ) end ... ... ------- And another question: why function unfrozen don´t work? i get this warnings: WARNING: warp.lua: Bad argument @ 'getPlayerOccupiedVehicle' - Line: 82 WARNING: warp.lua: Bad argument @ 'setVehicleFrozen' - Line: 83 and the vehicle don´t get unfrozen after 3 seconds, why? (but that´s not the main question!) Link to comment
XetaQuake Posted May 18, 2008 Author Share Posted May 18, 2008 Hi, i have a funny problem and PLEEASS take a little bit time to help me i created a cylinder-marker, and when i drive in it, i want to be teleporting in an interior. and yes, all that´s works PERFECT!, but: ( ) when i drive with a vehicle in it, i get pushed extremely away, here is a screenshot: (I think most people know what i mean, it´s like a cheater pushes you away in the old mta race client. ) Now i trying to fix that, and i already have a idea: i create a vehicle frezz time after the vehicle and player teleports, and 3 (for example) seconds latter, it will be unleashed. Ok, i already scripting it, but now the vehicle don´t move in the interior, its freezed inside the cylinder. The player moves to the interior, but he is still in the vehicle and so he don´t teleports too: Here is my code: ......function markerBeamer( player ) if isPlayerInVehicle ( player ) then setElementInterior ( player, 15, -1400.5998535156, 996.78350830078, 1043.6085205078 ) setPlayerRotation ( player, 90 ) local playerVehicle = getPlayerOccupiedVehicle ( player ) setVehicleFrozen ( playerVehicle, true ) setTimer( unfrozen, 3000, 1 ) end end function unfrozen( player ) local playerVehicle = getPlayerOccupiedVehicle ( player ) setVehicleFrozen ( playerVehicle, false ) end...... ------- And another question: why function unfrozen don´t work? i get this warnings: WARNING: warp.lua: Bad argument @ 'getPlayerOccupiedVehicle' - Line: 82WARNING: warp.lua: Bad argument @ 'setVehicleFrozen' - Line: 83 and the vehicle don´t get unfrozen after 3 seconds, why? (but that´s not the main question!) Link to comment
tma Posted May 18, 2008 Share Posted May 18, 2008 You're only setting the interior of the player - is that right ? Should you try setting the vehicles instead or both ? Also, your warnings are because when you set the timer, you need to pass the player variable so it will be passed to the unfreeze bit. Like: setTimer( unfrozen, 3000, 1, player) Link to comment
tma Posted May 18, 2008 Share Posted May 18, 2008 You're only setting the interior of the player - is that right ? Should you try setting the vehicles instead or both ? Also, your warnings are because when you set the timer, you need to pass the player variable so it will be passed to the unfreeze bit. Like: setTimer( unfrozen, 3000, 1, player) Link to comment
XetaQuake Posted May 18, 2008 Author Share Posted May 18, 2008 Thanks! your setTimer fix works Now the setTimer bug is away. So, back to the main bug: You're only setting the interior of the player - is that right ? Should you try setting the vehicles instead or both ? I already thinking about it too and tries that: setElementInterior ( player, 15, -1400.5998535156, 996.78350830078, 1043.6085205078 ) setElementInterior ( playerVehicle, 15, -1400.5998535156, 996.78350830078, 1043.6085205078 ) But don´t work. Then i tries that: setElementInterior ( playerVehicle, 15, -1400.5998535156, 996.78350830078, 1043.6085205078 ) (So i removed the setElementInterior for the player) But nothing from this works, it´s still the same problem. Any other ideas or tips? Link to comment
XetaQuake Posted May 18, 2008 Author Share Posted May 18, 2008 Thanks! your setTimer fix works Now the setTimer bug is away. So, back to the main bug: You're only setting the interior of the player - is that right ? Should you try setting the vehicles instead or both ? I already thinking about it too and tries that: setElementInterior ( player, 15, -1400.5998535156, 996.78350830078, 1043.6085205078 ) setElementInterior ( playerVehicle, 15, -1400.5998535156, 996.78350830078, 1043.6085205078 ) But don´t work. Then i tries that: setElementInterior ( playerVehicle, 15, -1400.5998535156, 996.78350830078, 1043.6085205078 ) (So i removed the setElementInterior for the player) But nothing from this works, it´s still the same problem. Any other ideas or tips? Link to comment
Willy Posted May 18, 2008 Share Posted May 18, 2008 i don't know whether this would work, and it is purely speculative, but once you and the car hits the marker you take the player out of the car (removePlayerFromVehicle) , move them both to the interior (at different positions otherwise one will be in the other) and then put the player back in the car (warpPlayerIntoVehicle). I've got a feeling this was a fix for another bug that was similar. I may however be wrong. let me know how it goes. Link to comment
Willy Posted May 18, 2008 Share Posted May 18, 2008 i don't know whether this would work, and it is purely speculative, but once you and the car hits the marker you take the player out of the car (removePlayerFromVehicle) , move them both to the interior (at different positions otherwise one will be in the other) and then put the player back in the car (warpPlayerIntoVehicle). I've got a feeling this was a fix for another bug that was similar. I may however be wrong. let me know how it goes. Link to comment
XetaQuake Posted May 18, 2008 Author Share Posted May 18, 2008 Nice idea with removePlayerFromVehicle and warpPlayerIntoVehicle, but how can i get the same car with the same damages zones (like broken doors) and whats with passangers? I think its very difficult with this way Link to comment
XetaQuake Posted May 18, 2008 Author Share Posted May 18, 2008 Nice idea with removePlayerFromVehicle and warpPlayerIntoVehicle, but how can i get the same car with the same damages zones (like broken doors) and whats with passangers? I think its very difficult with this way Link to comment
Willy Posted May 18, 2008 Share Posted May 18, 2008 I don't think it is too hard, find out what the vehicle element is and then setElementPosition (it'll be the same car, just moved). then just do a simple loop to check that the passengers: passenger = {} for i = 0, getVehicleMaxPassengers(theVehicle) do passenger[i] = getVehicleOccupant (theVehicle, i ) if passenger[i] then removePlayerFromVehicle( passenger[i]) --and setElementPosition(passenger[i], blah blah) here -- end setElementPosition(theVehicle, blah, blah) for k=0,#passenger do warpPlayerIntoVehicle(passenger[k],theVehicle,k) end i'd do something like that. Link to comment
Willy Posted May 18, 2008 Share Posted May 18, 2008 I don't think it is too hard, find out what the vehicle element is and then setElementPosition (it'll be the same car, just moved). then just do a simple loop to check that the passengers: passenger = {}for i = 0, getVehicleMaxPassengers(theVehicle) dopassenger[i] = getVehicleOccupant (theVehicle, i )if passenger[i] thenremovePlayerFromVehicle( passenger[i])--and setElementPosition(passenger[i], blah blah) here--endsetElementPosition(theVehicle, blah, blah)for k=0,#passenger dowarpPlayerIntoVehicle(passenger[k],theVehicle,k)end i'd do something like that. Link to comment
Capsinurass Posted May 19, 2008 Share Posted May 19, 2008 you should try.. setElementInterior ( player, 15) setElementPosition ( playerVehicle, -1400.5998535156, 996.78350830078, 1043.6085205078 ) and add a rotation to it.. setVehicleRotation ( playerVehicle, 0, 0, 0 ) Link to comment
Capsinurass Posted May 19, 2008 Share Posted May 19, 2008 you should try.. setElementInterior ( player, 15)setElementPosition ( playerVehicle, -1400.5998535156, 996.78350830078, 1043.6085205078 ) and add a rotation to it.. setVehicleRotation ( playerVehicle, 0, 0, 0 ) Link to comment
Remp Posted May 19, 2008 Share Posted May 19, 2008 have you tried setting the velocity and the turn velocity to 0? Link to comment
Remp Posted May 19, 2008 Share Posted May 19, 2008 have you tried setting the velocity and the turn velocity to 0? Link to comment
Ace_Gambit Posted May 19, 2008 Share Posted May 19, 2008 Hi, I has similar problems when teleporting an occupied vehicle. The vehicle would simply catapult into the air after the teleport and burst into flames . What I did afterwards is teleport the vehicle and froze it in position. At the same time a timer would check if the camera was back in position again. When it did the vehicle was unfrozen again and fixed the problem for me in almost all cases. Link to comment
Ace_Gambit Posted May 19, 2008 Share Posted May 19, 2008 Hi, I has similar problems when teleporting an occupied vehicle. The vehicle would simply catapult into the air after the teleport and burst into flames . What I did afterwards is teleport the vehicle and froze it in position. At the same time a timer would check if the camera was back in position again. When it did the vehicle was unfrozen again and fixed the problem for me in almost all cases. Link to comment
XetaQuake Posted May 19, 2008 Author Share Posted May 19, 2008 thanks for all the reply! @Willy: thanks, i will try it tonight @Capsinurass and R3mp: i already tried setVehicleRotation @Ace_Gambit: yea, i have the same idea, can you pleas post your code? @tma, Willy, Capsinurass, R3mp, Ace_Gambit: thanks for all the help =) Link to comment
XetaQuake Posted May 19, 2008 Author Share Posted May 19, 2008 thanks for all the reply! @Willy: thanks, i will try it tonight @Capsinurass and R3mp: i already tried setVehicleRotation @Ace_Gambit: yea, i have the same idea, can you pleas post your code? @tma, Willy, Capsinurass, R3mp, Ace_Gambit: thanks for all the help =) Link to comment
Willy Posted May 19, 2008 Share Posted May 19, 2008 just realised a potential problem, but testing would figure it out - to do with passengers if you've got one at 1, or 2 missing, but one at 2 or 3 (respectively) i.e. you've got a gap, it'll either not put the passenger after the gap back in, or it might put them in at the wrong seat. or... it could work fine. just thought i'd let you know - could be easily solved with other conditions and stuff. Link to comment
Willy Posted May 19, 2008 Share Posted May 19, 2008 just realised a potential problem, but testing would figure it out - to do with passengers if you've got one at 1, or 2 missing, but one at 2 or 3 (respectively) i.e. you've got a gap, it'll either not put the passenger after the gap back in, or it might put them in at the wrong seat. or... it could work fine. just thought i'd let you know - could be easily solved with other conditions and stuff. Link to comment
XetaQuake Posted May 20, 2008 Author Share Posted May 20, 2008 I fixed it now! But thanks all for all the help! I just added a timer to frezz the vehicle 100ms after i drives in a teleport, and not in the same function But i have a quick question in scripting: whats the opposite from isPlayerInVehicle? i searched in the wiki but found nothing like isPlayerNotInVehicle or isPlayerOnfoot. Can anybody help me? Link to comment
XetaQuake Posted May 20, 2008 Author Share Posted May 20, 2008 I fixed it now! But thanks all for all the help! I just added a timer to frezz the vehicle 100ms after i drives in a teleport, and not in the same function But i have a quick question in scripting: whats the opposite from isPlayerInVehicle? i searched in the wiki but found nothing like isPlayerNotInVehicle or isPlayerOnfoot. Can anybody help me? Link to comment
Ace_Gambit Posted May 20, 2008 Share Posted May 20, 2008 Here is an alternative (maybe cleaner) method to prevent vehicle from being catapulted into the air. Your method works as well but could cause problems on slow computers. I have noticed that the catapulting is related to the streaming of world objects. When objects are not fully streamed in the vehicle is catapulted more often. What happens on slow computers is that the camera is not close enough to the vehicle when your method unfreezes it. The following code may prevent that from happening. client function trackcam(vehicle) local x, y, z = getElementPosition(vehicle) local cx, cy, cz = getCameraPosition() local dist = getDistanceBetweenPoints3D(x, y, z, cx, cy, cz) if (dist < 25.0) then setVehicleFrozen(vehicle, false) else setTimer(trackcam, 50, 1, vehicle) end end function yourtpfunc() -- teleport the vehicle trackcam(vehicle) end But i have a quick question in scripting: whats the opposite from isPlayerInVehicle? i searched in the wiki but found nothing like isPlayerNotInVehicle or isPlayerOnfoot. Can anybody help me? Why do you need a function that says you are not in a vehicle when that is exactly what the isPlayerInVehicle function does? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now