function test_take_damage_cb(npc_name, attacker, hp, explode, melee, vomit, amount, is_tk, is_dfa, is_energy, is_stomp, is_headshot, ss_stun, is_buff, is_shark, ...)
local material_effect = "cid_shield"
local playback_duration = 1.0
local anim_play = "flinch chest front"
local explosion_spawn = "Murderbot_exp"
-- From SaintsRowMods.com User:bigbang
local damage_type = "unknown"
if explode then
damage_type = "explosion"
elseif melee then
damage_type = "melee"
elseif vomit then
damage_type = "vomit"
elseif is_tk then
damage_type = "telekinesis"
elseif is_dfa then
damage_type = "death from above"
elseif is_energy then
damage_type = "energy"
elseif is_stomp then
damage_type = "stomp"
elseif is_headshot then
damage_type = "headshot"
elseif ss_stun then
damage_type = "stun"
elseif is_buff then
damage_type = "buff"
elseif is_shark then
damage_type = "shark"
end
local weapon_name = attacker or "unknown"
local message = "You took damage!\n"
message = message .. "Damage Type: " .. (damage_type or "nil") .. "\n"
message = message .. "Damage From: " .. (weapon_name or "nil") .. "\n"
message = message .. "Applying material effect: " .. material_effect .. "\n"
message = message .. "anim play: " .. anim_play .. "\n"
message = message .. "----> From \nwww.SaintsRowMods.com \nUser : bigbang\n"
script_message(message)
--ingame effect apply -- From SaintsRowMods.com User:bigbang
explosion_create(explosion_spawn, LOCAL_PLAYER, SYNC_ALL)
action_play(LOCAL_PLAYER, anim_play,nil,false,nil,true,true,nil,nil)
end
function init_take_damage_test()
on_take_damage("test_take_damage_cb", LOCAL_PLAYER)
--script_message("Take Damage Test initialized\nTake any damage to see the material effect")
end
function cleanup_take_damage_test()
on_take_damage("", LOCAL_PLAYER)
end
function common_function()
while true do
-- From SaintsRowMods.com User:bigbang
if player_action_is_pressed("CBA_VDC_OFFHAND_GRENADE") and player_action_is_pressed("CBA_GAC_CANCEL_ACTIVITY") then
-- insert + delete
init_take_damage_test()
script_message("enable init_take_damage_test\n----> From \nwww.SaintsRowMods.com \nUser : bigbang\n")
elseif player_action_is_pressed("CBA_GAC_WEAPON_SELECT_7") and player_action_is_pressed("CBA_GAC_WEAPON_SELECT_8") then
-- 7 + 8
cleanup_take_damage_test()
script_message("disabled init_take_damage_test\n----> From \nwww.SaintsRowMods.com \nUser : bigbang\n")
elseif player_action_is_pressed("CBA_GAC_WEAPON_SELECT_6") and player_action_is_pressed("CBA_OFC_PICKUP_RELOAD") then
-- 6 + R
end
delay(0.5)
end
end