casting underwater [SOLVED - with item]

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

casting underwater [SOLVED - with item]

Post by Granamir »

Hi everyone,
i'm trying to make an underwater map and i need water breathing.
I found the spell from sps999 (viewtopic.php?f=22&t=8183) and it works fine, but i need to cast this spell again while i'm underwater, before it endes obviously.
Anyone has any idea? Possibly not too comlex; i know very little about java and, if possible, even less about lua.
Thanks
Last edited by Granamir on Fri Feb 06, 2015 12:59 pm, edited 1 time in total.
Ixnatifual

Re: casting underwater

Post by Ixnatifual »

Perhaps it could be a reusable item rather than a spell?
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: casting underwater

Post by Granamir »

yea it can work too
but has to be an item with charges, not water breathing effect always active
do u have a solution?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: casting underwater

Post by minmay »

To allow underwater attacks with an item, give it the "aquatic" trait. If you want players to be able to cast spells underwater, giving this trait to all items with RunePanelComponent should work. Unfortunately, that obviously won't work for bare-hand casting.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Eburt
Posts: 69
Joined: Thu Feb 05, 2015 5:44 am

Re: casting underwater

Post by Eburt »

minmay wrote:To allow underwater attacks with an item, give it the "aquatic" trait. If you want players to be able to cast spells underwater, giving this trait to all items with RunePanelComponent should work. Unfortunately, that obviously won't work for bare-hand casting.
The RunePanelComponent itself does not function underwater. To the best of my knowledge, this isn't something easy to modify. However, giving the "aquatic" trait to an item which casts the water breathing spell should work fine.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: casting underwater

Post by minmay »

Ugh, you're right. I guess you could implement your own spellcasting interface, since Champion:castSpell() still works underwater. But you couldn't get it to look quite the same as the built-in one, so hiding the problem by some other means is probably better.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: casting underwater

Post by Granamir »

Thank you.
I guess i'm going to try with item customization.
Btw what is runepanel component? How it works? I didn't find any explanation in scripting reference nor in Jkos wiki.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: casting underwater

Post by Drakkan »

Granamir wrote:Thank you.
I guess i'm going to try with item customization.
Btw what is runepanel component? How it works? I didn't find any explanation in scripting reference nor in Jkos wiki.
you can easily add it as item component like following
{
class = "RunePanel",
requirements = { "concentration", 1 },
},
Breath from the unpromising waters.
Eye of the Atlantis
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: casting underwater

Post by Granamir »

Thank you Drakkan, btw what changens in my item if i add runepanel component?
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: casting underwater

Post by Drakkan »

Granamir wrote:Thank you Drakkan, btw what changens in my item if i add runepanel component?
if you rightclick on it, you open the runepanel :)
Breath from the unpromising waters.
Eye of the Atlantis
Post Reply