Jump to content

Run over zombies


JimmyJ

Recommended Posts

Hi, I was wondering how I would go about making it so zombies could be ran over by cars in MTA DayZ. We bought the scripts from -ffs-Sniper and Woovie (ether of you can pm me to verify), so we do have access to the scripts to make the necessary changes.

As of right now when you run in to a zombie with a car it feels like you just ran in to a brick wall but I would like to make so it behaves the same as if you run over a regular player. I do have a little programming experience but I need a little guidance on how I would go about doing this.

Link to comment

So I was just derping arround with the collisions, now there was a bit of a problem, the event "onClientVehicleCollision" is ofcourse triggered when the client's vehicle has been collisioned, now the problem is the updating progress of the car bumping is just a matter of speed, my car bumps when it hit the ped hard, just like you said like wall, when i'm hitting it slowly, it doesn't work like a wall. Now the problem was, when I was hitting the peds with nitro on (infernus), the peds won't fly away, my car would just bump. (see the video below) this was tested with normal peds. Now I tought, maybe the zombies behaves different because it's walking arround etc, so I tested it with the zombies resource, and it was behaving the same... So the "onClientVehicleCollision" isn't working properly with the setElementVelocity on high speed, but what you can do is create colshapes arround every zombie and then when a vehicle hit the colshape, it will calculate the velocity with getElementVelocity or ( https://wiki.multitheftauto.com/wiki/GetElementSpeed ) and then use setElementVelocity to push those nifty zombies away, I don't have time for it, right now but i'll look into it when I have the time ofcourse. :)

Here's the video:

And here's the code that i used for the ped velocity (client only), it's not much (yet) but maybe someone can contribute it just because it's awesome to do a job for someone :

addEventHandler("onClientVehicleCollision", root, 
    function(collider,force, bodyPart, x, y, z, nx, ny, nz) 
if collider then 
         if ( source == getPedOccupiedVehicle(localPlayer) ) and (getElementType(collider) == "ped") then 
            -- local fDamageMultiplier = getVehicleHandling(source).collisionDamageMultiplier -- might come in later handy for calculating the damageMultiplier 
  
--setElementCollisionsEnabled ( collider, false ) 
local pedX, pedY, pedZ = getElementPosition ( collider ) 
  
local endX, endY, endZ = pedX-x, pedY-y, pedZ-z 
  
--[[ calculating output 
outputChatBox ( endX ) 
outputChatBox ( endY ) 
outputChatBox ( endZ ) 
]] 
setElementVelocity ( collider, endX, endY, endZ ) 
         end 
    end 
end 
) 

I'll probally gonna watch in the weekend for it, since I don't have alot of time right now (so much things for school what needs to be done).

(sorry if my english sentences are incorrect, i'm tired :P)

Regards,

Danny

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...