Page 1 of 2

casting underwater [SOLVED - with item]

Posted: Wed Feb 04, 2015 5:05 pm
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

Re: casting underwater

Posted: Wed Feb 04, 2015 6:36 pm
by Ixnatifual
Perhaps it could be a reusable item rather than a spell?

Re: casting underwater

Posted: Wed Feb 04, 2015 8:07 pm
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?

Re: casting underwater

Posted: Wed Feb 04, 2015 8:13 pm
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.

Re: casting underwater

Posted: Thu Feb 05, 2015 5:47 am
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.

Re: casting underwater

Posted: Thu Feb 05, 2015 6:30 am
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.

Re: casting underwater

Posted: Thu Feb 05, 2015 11:05 am
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.

Re: casting underwater

Posted: Thu Feb 05, 2015 12:28 pm
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 },
},

Re: casting underwater

Posted: Thu Feb 05, 2015 1:08 pm
by Granamir
Thank you Drakkan, btw what changens in my item if i add runepanel component?

Re: casting underwater

Posted: Thu Feb 05, 2015 3:16 pm
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 :)