Page 1 of 1

Need help with damageTile

Posted: Thu Sep 13, 2012 9:42 am
by Shadowfied
So I'm learning a bit of scripting and using the "Number guess game" from the modding tutorial, which I can't seem to find again..Anyway, I got it to work fine and messed with it a bit so that I understand how it works, and I looked up the script references to find a way to damage the party if the wrong number is guessed. I found the damageTile function and decided to try it. It damages my party, but there is no indication of being damaged, other than the red splats on the health-bars, and it doesn't matter which damageType I choose, it's always the same.

Code: Select all

counter = 0
function awesomeGame()
	counter = counter + 1
	local randomNumber = math.random(5)
	if randomNumber == 3 then
		print ("CORRECT!", counter, "TRIES!")
	else
		print ("FAIL DUDE!")
		damageTile(1, 16, 14, 0, 0, "fire", 5)
	end
end
The script works and there are no errors, there's just no indication of what damages you, no sound, no particles etc.

Also, I'm a bit confused with the flags, like "bit 0" and what they would be used for, but I guess that's irrelevant for this issue.

Thanks in advance.

Re: Need help with damageTile

Posted: Thu Sep 13, 2012 9:59 am
by antti
The lack of visual or audio indications is intentional: this enables the modders to make the damaging event feel whatever they like by letting them dress it up themselves. You can play sounds using the playSound function: you can add playSound("fireball_hit") into the script for example. Particles can also be played back with an FX entity and some scripting.

The bit field questions have come up before. I think I should write a small clarification of it into the guide somewhere.

Re: Need help with damageTile

Posted: Thu Sep 13, 2012 10:01 am
by petri
A simpler way to punish the party would be to use the spawn() function to spawn, let's say, a "fireburst" in the tile :twisted:

Re: Need help with damageTile

Posted: Thu Sep 13, 2012 10:02 am
by Shadowfied
Thanks for the reply.

Sounds good, but what is the damageType option for then?

Re: Need help with damageTile

Posted: Thu Sep 13, 2012 10:04 am
by petri
damageType is used for determining damage resistances. E.g. damageType "fire" would use target's fire resistance to reduce the damage of the attack.

Re: Need help with damageTile

Posted: Thu Sep 13, 2012 10:07 am
by Shadowfied
Ah, makes sense.

Thank you very much!

And if you didn't already petri, please read my last post here.