callbackOnTakeDamage

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

callbackOnTakeDamage

#1 Post by HousePet »

If you return {dam=0, stopped=true} for example from the callback, DamageType.defaultProjector returns true.
Should you be blocking fire or cold or similar damage, this causes lua errors due to the game then comparing the returned value with 0.
eg.

Code: Select all

local realdam = DamageType.defaultProjector(src, x, y, type, dam)
if realdam > 0 then
I'll stop using the stopped flag for now, but it doesn't seem to be working as intended?
My feedback meter decays into coding. Give me feedback and I make mods.

StarKeep
Uruivellas
Posts: 703
Joined: Sun Feb 03, 2013 12:29 am
Location: Turtlemire

Re: callbackOnTakeDamage

#2 Post by StarKeep »

Hum, I thought you were supposed change data.stopped into a number value, and not just true. Was I mistaken?

I was under the impression that if 'stopped' is set to anything, it returns it instead.
So my thinking was that if it is returned in the same way that dam, a number value, is returned, should it not also be a number?
<mex> have you heard the good word about archmage?
<mex> I'm here to tell you about your lord and savior shalore archmage
<mex> have you repented your bulwark sins yet?
<mex> cornac shall inherit the Eyal

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: callbackOnTakeDamage

#3 Post by HousePet »

I might have misinterpreted the use.
My feedback meter decays into coding. Give me feedback and I make mods.

Post Reply