Проверенный
Репутация: 121 бал.
Замечания: 0 бал.
Вступление. Не давно я пытался настроить урон от горения, подходящей темы на форуме не было, создал свою - в данный момент уже разобрался и решил, сделать не большой учебник и тутор в котором будут описаны типы урона и как его настроить в моде DayZ. Написан для тех кому лень, много лазить по сайтам и форумам - типа меня.
1. Таблица id типов урона с комментариями.
1.1. Таблица частей тела
1.2 Все id урона
2. Использование в моде DayZ.
Файл survivorSystem_client.lua :
Урон по игрокам
Показать
function playerGetDamageDayZ ( attacker, weapon, bodypart, loss )
cancelEvent()
damage = 100
headshot = false
if weapon == 37 then
damage = 1000
setElementData(source,"blood",getElementData(source,"blood")-damage)
if getElementData(getLocalPlayer(),"blood") <= 0 then
if not getElementData(getLocalPlayer(),"isDead") == true then
triggerServerEvent("kilLDayZPlayer",getLocalPlayer(),attacker,headshot)
end
end
end
if getElementData(attacker,"zombie") then
setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-gameplayVariables["zombiedamage"])
local number = math.random(1,7)
if number == 4 then
setElementData(getLocalPlayer(),"bleeding",getElementData(getLocalPlayer(),"bleeding") + math.floor(loss*10))
end
end
if weapon == 49 then
if loss > 30 then
setElementData(getLocalPlayer(),"brokenbone",true)
setControlState ("jump",true)
setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-math.floor(loss*10))
end
setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-math.floor(loss*5))
elseif weapon == 63 or weapon == 51 or weapon == 19 then
setElementData(getLocalPlayer(),"blood",0)
if getElementData(getLocalPlayer(),"blood") <= 0 then
if not getElementData(getLocalPlayer(),"isDead") == true then
triggerServerEvent("kilLDayZPlayer",getLocalPlayer(),attacker,headshot)
end
end
elseif weapon and weapon > 1 and attacker and getElementType(attacker) == "player" then
local number = math.random(1,8)
if number >= 6 or number <= 8 then
setElementData(getLocalPlayer(),"bleeding",getElementData(getLocalPlayer(),"bleeding") + math.floor(loss*10))
end
local number = math.random(1,7)
if number == 2 then
setElementData(getLocalPlayer(),"pain",true)
end
damage = getWeaponDamage (weapon)
if bodypart == 9 then --В голову
damage = damage*300
headshot = true
end
if bodypart == 7 or bodypart == 8 then
setElementData(getLocalPlayer(),"brokenbone",true)
end
playRandomHitSound()
setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-math.random(damage*0.75,damage*1.25))
if not getElementData(getLocalPlayer(),"bandit") then
setElementData(attacker,"humanity",getElementData(attacker,"humanity")-math.random(40,200))
if getElementData(attacker,"humanity") <= -2500 then
setElementData(attacker,"bandit",true)
end
else
setElementData(attacker,"humanity",getElementData(attacker,"humanity")+math.random(40,200))
if getElementData(attacker,"humanity") > 5000 then
setElementData(attacker,"humanity",5000)
end
if getElementData(attacker,"humanity") > -2500 then
setElementData(attacker,"bandit",false)
end
end
if getElementData(getLocalPlayer(),"blood") <= 0 then
if not getElementData(getLocalPlayer(),"isDead") then
triggerServerEvent("kilLDayZPlayer",getLocalPlayer(),attacker,headshot,getWeaponNameFromID (weapon))
setElementData(getLocalPlayer(),"isDead",true)
end
end
elseif weapon == 54 or weapon == 63 or weapon == 49 or weapon == 51 then
setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-math.random(100,1000))
local number = math.random(1,5)
if loss > 30 then
setElementData(getLocalPlayer(),"brokenbone",true)
setControlState ("jump",true)
end
if loss >= 100 then
setElementData(getLocalPlayer(),"blood",49)
setElementData(getLocalPlayer(),"bleeding",50)
end
local number = math.random(1,11)
if number == 3 then
setElementData(getLocalPlayer(),"pain",true)
end
if getElementData(getLocalPlayer(),"blood") <= 0 then
if not getElementData(getLocalPlayer(),"isDead") == true then
triggerServerEvent("kilLDayZPlayer",getLocalPlayer(),attacker,headshot,getWeaponNameFromID (weapon))
setElementData(getLocalPlayer(),"isDead",true)
end
end
end
end
addEventHandler ( "onClientPlayerDamage", getLocalPlayer (), playerGetDamageDayZ )
Урон по зомби
Показать
function pedGetDamageDayZ ( attacker, weapon, bodypart, loss )
cancelEvent()
if attacker and attacker == getLocalPlayer() then
damage = 100
if weapon == 37 then
damage = 1000
setElementData(source,"blood",getElementData(source,"blood")-damage)
if getElementData(source,"blood") <= 0 then
triggerServerEvent("onZombieGetsKilled",source,attacker)
end
end
if weapon == 63 or weapon == 51 or weapon == 19 then
setElementData(source,"blood",0)
if getElementData(source,"blood") <= 0 then
triggerServerEvent("onZombieGetsKilled",source,attacker)
end
elseif weapon and weapon > 1 and attacker and getElementType(attacker) == "player" then
damage = getWeaponDamage (weapon)
if bodypart == 9 then
damage = damage*300
headshot = true
end
setElementData(source,"blood",getElementData(source,"blood")-math.random(damage*0.75,damage*1.25))
if getElementData(source,"blood") <= 0 then
triggerServerEvent("onZombieGetsKilled",source,attacker,headshot)
end
end
end
if getElementType(attacker) == "vehicle" then -- убийство машиной зомби
speedx, speedy, speedz = getElementVelocity ( attacker )
actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5)
kmh = actualspeed * 180
if kmh >= 20 then
local vehkiller = getVehicleOccupant ( attacker )
setElementData(source,"blood",0)
if getElementData(source,"blood") <= 0 then
triggerServerEvent("onZombieGetsKilled",source,vehkiller)
triggerServerEvent("Zomb_delete", getRootElement(), source)
end
end
end
end
addEventHandler ( "onClientPedDamage", getRootElement(), pedGetDamageDayZ )
Теперь кратко обо всём:
Я не стал расписывать под каждый тип - там уже аналогично.
Зомби - урон от огня прописывается аналогично.
Headshot:
"Давка" машиной:
Игрока:
По зомби: