Page 1 of 1
Display Message on Casting
Posted: Wed Dec 19, 2012 10:28 pm
by Duncan_B
I have successfully blocked the Light spell, but I'd like to produce a little message when casting so the player knows it's been blocked intentionally. I gather I should use hudPrint() to do this (maybe not?) in the onCast section of the new spell definition, but I'm not sure where to insert it. I've tried a few times and got error messages ("nil value") when trying to load up my dungeon. Suggestions?
Re: Display Message on Casting
Posted: Wed Dec 19, 2012 11:15 pm
by Komag
if casting light is always going to fail, you can just add another line before your return false with hudPrint("spell failed") or whatever you want
Re: Display Message on Casting
Posted: Thu Dec 20, 2012 1:14 am
by Duncan_B
I haven't used a return false, but just changed the spell effect to darkness and made it cost 0 energy. I still seem to be getting a "nil value" error when I put a hudPrint("fail") into the "onCast" section, so I'm guessing that's not where it goes?
Re: Display Message on Casting
Posted: Thu Dec 20, 2012 1:20 am
by Diarmuid
Hi Duncan_B,
Post your whole code, we'll probably be able to point the problem!
Re: Display Message on Casting
Posted: Thu Dec 20, 2012 1:27 am
by Komag
Ah, see my message in your other thread, better to use the party onCast hook instead of messing with the spell itself, I think