Display Message on Casting

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Duncan_B
Posts: 31
Joined: Wed Dec 19, 2012 8:43 pm
Location: Santa Cruz, Calif.-- USA

Display Message on Casting

Post 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?
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Display Message on Casting

Post 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
Finished Dungeons - complete mods to play
User avatar
Duncan_B
Posts: 31
Joined: Wed Dec 19, 2012 8:43 pm
Location: Santa Cruz, Calif.-- USA

Re: Display Message on Casting

Post 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?
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: Display Message on Casting

Post by Diarmuid »

Hi Duncan_B,

Post your whole code, we'll probably be able to point the problem!
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Display Message on Casting

Post 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
Finished Dungeons - complete mods to play
Post Reply