Page 397 of 400

Re: Ask a simple question, get a simple answer

Posted: Wed Dec 11, 2024 8:52 am
by Slava
Eleven Warrior wrote: Wed Dec 11, 2024 6:30 am Hi guys. I need a weapon that attacks under water. I think I saw one here in the forums. Thank you for help
Any spear can be used underwater. If you want to make your own weapon that can be used underwater. Add the line “undervater” to its traits table. Unfortunately, the developer has not made sure that such weapons are visually different from normal ones. So you can check it only by trying to attack underwater.

Re: Ask a simple question, get a simple answer

Posted: Wed Dec 11, 2024 10:31 am
by THOM
Eleven Warrior wrote: Wed Dec 11, 2024 6:30 am Hi guys. I need a weapon that attacks under water. I think I saw one here in the forums. Thank you for help
I have invented a range weappon called Watershooter.

You can find it in the recource pack of my mod:
https://www.nexusmods.com/legendofgrimr ... ?tab=files

Re: Ask a simple question, get a simple answer

Posted: Wed Dec 11, 2024 2:32 pm
by Zo Kath Ra
Eleven Warrior wrote: Wed Dec 11, 2024 6:30 am Hi guys. I need a weapon that attacks under water. I think I saw one here in the forums. Thank you for help
Hi Eleven Warrior :D
Could you be more specific, e.g. by explaining why you don't just add the "aquatic" trait to the Item component?

Re: Ask a simple question, get a simple answer

Posted: Wed Dec 11, 2024 11:13 pm
by minmay
Slava wrote: Wed Dec 11, 2024 8:48 amAside from that, I know that you hardly reply here now and are more on discord. But unfortunately I don't have the ability to use discord. Is there any other way to contact you? I would like to clarify some things you wrote about as well some time ago.
I reply to scripting questions more often here than I do on DIscord. If you feel your question isn't simple enough for this thread, I suggest you make a new thread asking it.

Re: Ask a simple question, get a simple answer

Posted: Thu Dec 12, 2024 7:38 am
by Slava
minmay wrote: Wed Dec 11, 2024 11:13 pm I reply to scripting questions more often here than I do on DIscord. If you feel your question isn't simple enough for this thread, I suggest you make a new thread asking it.
How well you are getting away with answering Minmay! :D I'm actually interested in the fate of your mod
viewtopic.php?f=23&t=9130
Even if you're not going to finish it, could you please tell me how you redesigned the skills? I understand that you turned off import standart assets, import skills. And importing standart assets manually. That's not what I'm interested in. I'm more interested in what's in your onDrawSkills hook. Can I take a look at it to see how you did it? :?

Re: Ask a simple question, get a simple answer

Posted: Thu Dec 12, 2024 10:36 am
by Slava
I don't know how simple a question that is. But does anyone know how GraphicsContext.translate() works? I haven't found a description of this function anywhere.

Re: Ask a simple question, get a simple answer

Posted: Thu Dec 12, 2024 10:26 pm
by minmay
Slava wrote: Thu Dec 12, 2024 7:38 amI'm more interested in what's in your onDrawSkills hook. Can I take a look at it to see how you did it? :?
There was nothing fancy or even interesting in that onDrawSkills hook, any programmer that read the GraphicsContext documentation could write it in a few minutes even if they didn't know anything else about Grimrock (and from the untidiness you can see I wrote it in a few minutes too):
SpoilerShow

Code: Select all

function draw(p, context, champion)
	for t = 1, #SKILL_TREES do
		for s = 1, #SKILL_TREES[t] do
			local butt = buttons[t][s]
			local x = STARTX*context.width+butt.x*context.height
			local y = butt.y*context.height
			local size = BUTTON_SIZE*context.height
			if context.mouseX >= x and context.mouseX <= x+size
				and context.mouseY >= y and context.mouseY <= y+size then
-- context.button is currently broken in onDrawSkills. TODO.
--				if context.button("skillbutton",context.mouseX-1,context.mouseY-1,size,size) then
				if context.mouseDown(0) then
					skillButtonClicked(champion,t,s)
				end
--				end
				drawTooltip(p,context,champion,t,s)
			end
			local known = skills[champion:getOrdinal()][t][s]
			local unlocked = true
			if not known then unlocked = meetsReqs(champion,t,s) end
			context.drawImage2(unlocked and IMG_TRAITS or IMG_TRAITS_LOCKED,x,y,(SKILL_TREES[t][s].icon%10)*75,(math.floor(SKILL_TREES[t][s].icon/10))*75,IMG_FRAME_SIZE,IMG_FRAME_SIZE,size,size)
			local frameimg = known and IMG_FRAME_KNOWN or unlocked and IMG_FRAME_UNLOCKED or IMG_FRAME_LOCKED
			context.drawImage2(frameimg,x,y,0,0,IMG_FRAME_SIZE,IMG_FRAME_SIZE,size,size)
		end
	end
end
As for the mod itself, most of it was narratively meaningless and I stopped wanting to make meaningless stuff, so I subsumed everything interesting from it (there wasn't much interesting in it) into other projects.
Slava wrote: Thu Dec 12, 2024 10:36 amI don't know how simple a question that is. But does anyone know how GraphicsContext.translate() works? I haven't found a description of this function anywhere.
Think of it as moving the origin point of the GraphicsContext on the screen. drawImage() and such add the context's translation to the x and y values you pass to them to determine where on the screen the image/whatever is drawn. One of the drawing hooks, onDrawAttackPanel, gives you a GraphicsContext that's already translated.

Re: Ask a simple question, get a simple answer

Posted: Fri Dec 13, 2024 6:07 am
by Eleven Warrior
Does anyone have a potion of water breathing or a spell with the same effect thank you :)

Re: Ask a simple question, get a simple answer

Posted: Fri Dec 13, 2024 7:23 am
by Slava
Eleven Warrior wrote: Fri Dec 13, 2024 6:07 am Does anyone have a potion of water breathing or a spell with the same effect thank you :)
The potion is in Final Adwenture. The spell can be found in the Spellpack

Re: Ask a simple question, get a simple answer

Posted: Fri Dec 13, 2024 12:29 pm
by Eleven Warrior
What mod is the potion in? Thank you.