KAR Posted August 3, 2011 Share Posted August 3, 2011 hey.. I have searched all over the forum but I cannot find a callback like onVehicleHitVehicle( player vehicle, player theVehicleHit) Can anyone please help me make it or.. send me a link? thanks.. Link to comment
BinSlayer1 Posted August 3, 2011 Share Posted August 3, 2011 the only event similar is: onVehicleDamage but it only returns how much damage your car takes. you could create a custom event maybe.. using colshapes or markers attached to cars. Problem with this is that it won't work very efficiently.. unless you find a way to get the colshape size to fit the car size perfectly. Link to comment
Scooby Posted August 3, 2011 Share Posted August 3, 2011 im not sure that would work BinSlayer1, the last time i tried that, the marker detection area didnt seem to move with whatever its attached to (player/vehicle), it seems to still get triggered from wherever the marker was when it was attached to the handler. (maybe someone could clarify this? ) i suppose a colshape could be created just a bigger than the size of the vehicle at the time the vehicle is damaged, then checked to see if another vehicle is within the shape, or by checking the distance to the next closest vehicle at the time its damaged... however neither would be very accurate and still wouldnt return who hit who. Link to comment
BinSlayer1 Posted August 3, 2011 Share Posted August 3, 2011 well onColshapeHit would be able to return who hit who, and for better accuracy try to see if the vehicle was damaged too (i.e the onVehicleDamage was fired) all of this, assuming attaching a colshape to a vehicle works. Link to comment
KAR Posted August 3, 2011 Author Share Posted August 3, 2011 I seem to get the idea of what you guys are saying.. I just checked the wiki about col shapes.. So I would like have to get the size of each vehicle then create a rectangle col shape on them? I got all vehicle sizes already I don't need this for every vehicle, only a few. #define Crazy8 474 #define Junkyard_Dog 525 #define Brimstone 576 #define Outlaw 599 #define Mr.Grimm 463 #define Roadkill 541 #define Thumper 474 #define Spectre 475 #define Darkside 514 #define Shadow 442 #define Yellow_Jacket 420 #define ManSalughter 406 #define Sweet_Tooth 423 those models Link to comment
JR10 Posted August 3, 2011 Share Posted August 3, 2011 #define? You used to script for SA-MP. Well it's different local Crazy8 = 474 local Junkyard_Dog = 525 local Brimstone = 576 local Outlaw = 599 local Mr.Grimm = 463 local Roadkill = 541 local Thumper = 474 local Spectre = 475 local Darkside = 514 local Shadow = 442 local Yellow_Jacket = 420 local ManSalughter = 406 local Sweet_Tooth = 423 Link to comment
Scooby Posted August 3, 2011 Share Posted August 3, 2011 well onColshapeHit would be able to return who hit who, and for better accuracy try to see if the vehicle was damaged too (i.e the onVehicleDamage was fired)all of this, assuming attaching a colshape to a vehicle works. onColShapeHit wont return who hit who it will just be triggered twice, once for each of the vehicles.(im assuming ur adding this to all ur cars?) as i mentioned earlier, i dont think u can use onColShapeHit or onMarkerHit. many other people on the forums have also said they have tried to attach a colshape to a moving element (player/car etc) and failed. Link to comment
KAR Posted August 3, 2011 Author Share Posted August 3, 2011 #define? You used to script for SA-MP.Well it's different local Crazy8 = 474 local Junkyard_Dog = 525 local Brimstone = 576 local Outlaw = 599 local Mr.Grimm = 463 local Roadkill = 541 local Thumper = 474 local Spectre = 475 local Darkside = 514 local Shadow = 442 local Yellow_Jacket = 420 local ManSalughter = 406 local Sweet_Tooth = 423 Yes, I am converting my sa-mp script.. sa-mp can't detect object collisions so when I attempt to like shoot missiles it can sometimes hit the player and a load of shit. @Scooby well.. I guess are there any other ways you can think of? besides the one you posted^^ Link to comment
Scooby Posted August 4, 2011 Share Posted August 4, 2011 can you explain in detail as much as you can what is it that youre trying to do? There are a few workarounds for this.... depending on what youre after. Link to comment
eAi Posted August 4, 2011 Share Posted August 4, 2011 You can use getElementBoundingBox to get vehicle sizes, or getElementRadius. Link to comment
KAR Posted August 4, 2011 Author Share Posted August 4, 2011 can you explain in detail as much as you can what is it that youre trying to do?There are a few workarounds for this.... depending on what youre after. Just detecting if a vehicle hit a vehicle, example. In the game I'm remaking the lastest one has a "Ram %d pts" there, I would like to decrease extra damage for "ramming" and one of the vehicles has a special whereas he speed off and rams people hard, aka it's speed increase severely so anyone caught in the ram will be damaged hard. - look at 1:00 to see what I mean or 5:10 where he actually hits a playerThanks eAi Link to comment
Scooby Posted August 5, 2011 Share Posted August 5, 2011 ok i see, well u can also benefit then by adding some element data to the player when he uses the boost button, that way when he collides with another vehicle u can give the extra points if the player is boosting. im sure theres a few ways u could do this, as i mentioned above, i think i would: when a players vehicle is damaged, create a temporary marker around the vehicle slightly bigger than the vehicle (invisible of course), then check to see if any other vehicles are in that marker by looping thru the other players vehicles. if one is detected in the marker, then check to see if the player is also boosting at the time. i know this isnt gonna be 100% but i dont know of a perfect way untill onMarkerHit/onColShapeHit is working on moving elements. if u need help making this, let me know. or if anyone else has any better suggestions on how this might be achieved, please say so. Link to comment
Wojak Posted August 6, 2011 Share Posted August 6, 2011 maybe counting the tick's between "onVehicleDamage" events calls (if the delay will be les then 50ms its likely that vehicles collided with each other). Who hit who could be detected comparing the vehicles positions and velocity vectors... but this is just a theory Link to comment
arezu Posted August 10, 2011 Share Posted August 10, 2011 You can use onVehicleDamage and check like between 100 ms and see if the vehicles that got damaged were within range with getElementBoundingBox and getDistanceBetweenPoints3D. 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