multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 424 forks source link

onVehicleDamage doesn't trigger for crashes that knock the player off a bike #383

Open ArranTuna opened 6 years ago

ArranTuna commented 6 years ago

Describe the bug onVehicleDamage doesn't trigger for crashes that knock the player off a bike

To Reproduce Steps to reproduce the behavior:

  1. Enter this into runcode: srun addEventHandler("onVehicleDamage", getRootElement(), function(loss) outputChatBox(loss) end)
  2. Spawn a bike
  3. Scrape up against a few walls - you'll see it shows the loss every time
  4. Gain up speed and smash into a wall hard enough to fall off - doesn't show the loss

Expected behavior The event should trigger.

Additional context From https://bugs.mtasa.com/view.php?id=7679

qaisjp commented 6 years ago

What is the mantis report for this?

qaisjp commented 6 years ago

@sbx320 said:

Seems to be a GTA mechanic. Bikes don't seem to get damaged in a crash when the driver falls off.

qaisjp commented 6 years ago

In light of the above comment by sbx, what are your plans for this @patrikjuvonen?

patrikjuvonen commented 6 years ago

First I'm going to test around and see what can be done. If bikes really do get absolutely no damage when ped is falling off then there's also no reason to call the event.

patrikjuvonen commented 5 years ago

For whatever reason I am not able to reproduce this problem in Multi Theft Auto v1.5.6-release-16191 or then I'm doing it wrong. I spawned a NRG-500 (also tried a few other motorcycles and bicycles), hit the wall a couple times, then smashed right into a wall and fell off (after having used setPedCanBeKnockedOffBike on myself), and it does show the loss, although it seems it's a tiny bit late maybe...?

Dutchman101 commented 5 years ago

For whatever reason I am not able to reproduce this problem in Multi Theft Auto v1.5.6-release-16191 or then I'm doing it wrong. I spawned a NRG-500 (also tried a few other motorcycles and bicycles), hit the wall a couple times, then smashed right into a wall and fell off (after having used setPedCanBeKnockedOffBike on myself), and it does show the loss, although it seems it's a tiny bit late maybe...?

It's possible that this damage is a result of the bike bouncing/scratching on the ground after you already fell off. If the impact is sufficient, it can go 'lead its own life' and get additional damage that is separated from the main impact damage which may not register. I recommend you to try multiple times, I will also try to reproduce it and update my reply.

Note: when working on this issue, it's a good idea to take into account this related issue (not transferred): Bike crashes cannot inflict fatal HP damage to players - if it's a GTA mechanic, it may aswell be the same sort of.