BloodGauntlet
Member
- Joined
- Jul 27, 2016
- Messages
- 45
- Reaction score
- 18
Could anyone explain (what and how) to manipulate this data? I'm reworking how damage is dealt and I need to get the type of damage and amount of the incoming damage.
Some output data:
Code:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
function print_r ( t ) --you can ignore reading this function, mimics php print_r
local print_r_cache={}
local function sub_print_r(t,indent)
if (print_r_cache[tostring(t)]) then
print(indent.."*"..tostring(t))
else
print_r_cache[tostring(t)]=true
if (type(t)=="table") then
for pos,val in pairs(t) do
if (type(val)=="table") then
print(indent.."["..pos.."] => "..tostring(t).." {")
sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
print(indent..string.rep(" ",string.len(pos)+6).."}")
else
print(indent.."["..pos.."] => "..tostring(val))
end
end
else
print(indent..tostring(t))
end
end
end
sub_print_r(t," ")
end
local returnValues = {
["creature"] = creature,
["attacker"] = attacker,
["primaryDamage"] = primaryDamage,
["primaryType"] = primaryType,
["secondaryDamage"] = secondaryDamage,
["secondaryType"] = secondaryType,
["origin"] = origin
}
print_r(returnValues)
end
Some output data:
Code:
[creature] => userdata: 0x2f51d490
[primaryType] => 8
[secondaryType] => 0
[attacker] => userdata: 0x2f51d4b8
[secondaryDamage] => 0
[primaryDamage] => 3
[origin] => 3