Ask a simple question, get a simple answer

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!
Slava
Posts: 37
Joined: Sun Aug 30, 2015 2:10 pm

Re: Ask a simple question, get a simple answer

Post 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.
User avatar
THOM
Posts: 1277
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post 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
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Zo Kath Ra
Posts: 939
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post 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?
minmay
Posts: 2785
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post 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.
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.
Slava
Posts: 37
Joined: Sun Aug 30, 2015 2:10 pm

Re: Ask a simple question, get a simple answer

Post 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? :?
Slava
Posts: 37
Joined: Sun Aug 30, 2015 2:10 pm

Re: Ask a simple question, get a simple answer

Post 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.
minmay
Posts: 2785
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post 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.
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.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Does anyone have a potion of water breathing or a spell with the same effect thank you :)
Slava
Posts: 37
Joined: Sun Aug 30, 2015 2:10 pm

Re: Ask a simple question, get a simple answer

Post 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
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

What mod is the potion in? Thank you.
Post Reply