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

Re: Ask a simple question, get a simple answer

Post by THOM »

But I think especially the mine tileset hasn't that problem Isaac is mentioning.

But try out what is possible if you add a heightmapMaterial to the Tileset definition.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat »

I m wondering about epic items count: I want to upgrade a few epic items (parts of an armor set) with crafting, but whatabout the epic items counter in the statistics?

Will it be unrecommanded if I detroy an epic items, and make a new one?
I plan to upgrade 3 or 4 times each pieces of the armor set.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Is there a published list of those statistic names? I can only find the few from Grimrock 1.
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

bongobeat wrote:I m wondering about epic items count: I want to upgrade a few epic items (parts of an armor set) with crafting, but whatabout the epic items counter in the statistics?

Will it be unrecommanded if I detroy an epic items, and make a new one?
I plan to upgrade 3 or 4 times each pieces of the armor set.

AFAIK every item, which is defined for the game with traits = { "epic" }, will be in count of the epic item statistic. So, yes: If you remove this item from the item definition file it will not be in count.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2789
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Epic items are counted when the dungeon begins to get the maximum number. If this count is incorrect because you want to spawn an additional epic item, you can just use GameMode.setMaxStatistic() to fix 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.
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: Ask a simple question, get a simple answer

Post by Duncan1246 »

I have seen here and there that the only way to call GraphicContexts.DrawText() or DrawImage() is to use onDrawGui party hook (with fw hooks). But I don't see any example of use for now. Any lead or example to follow?
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Duncan1246 wrote:I have seen here and there that the only way to call GraphicContexts.DrawText() or DrawImage() is to use onDrawGui party hook (with fw hooks). But I don't see any example of use for now. Any lead or example to follow?
There are other hooks that have the graphic context besides onDrawGUI.

The example is the same one for any party hook. What's important are the arguments available to the hook. You use the context object for the graphics functions

Code: Select all


--[[  Other hooks with context
PartyComponent.onDrawAttackPanel(self, champion, context, x, y) Beta 2.2.4
PartyComponent.onDrawGui(self, context)
PartyComponent.onDrawInventory(self, context, champion)
PartyComponent.onDrawStats(self, context, champion)
PartyComponent.onDrawSkills(self, context, champion)
PartyComponent.onDrawTraits(self, context, champion)
--]]

defineObject{
	name = "party",
	baseObject = "party",
	components = {
		{
			class = "Party",
			onDrawAttackPanel = function(self, champion, context, x, y) 				
						local text = tostring(GameMode.getStatistic("play_time"))
						local text3 = "Game Playtime:"
						local offset = (context.width - (context.width/#text3))*.5 --quick centering on-screen

						context.font("large")  --Set Font size ; ("tiny", "small", "medium", "large")
				
--GraphicsContext.drawText(text, x, y)						
						if champion:getOrdinal() == 2 then
								local text2 = champion:getName().." Health: "..champion:getHealth()
								context.drawText(text2, offset, context.height/2.14)
						end
						context.drawText(text3, offset, context.height/2.07)
						context.drawText(text, offset, context.height/2)
					  end
		},
		
	},
}
https://github.com/JKos/log2doc/wiki/Ob ... icscontext
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: Ask a simple question, get a simple answer

Post by Duncan1246 »

Isaac wrote:
Duncan1246 wrote:I have seen here and there that the only way to call GraphicContexts.DrawText() or DrawImage() is to use onDrawGui party hook (with fw hooks). But I don't see any example of use for now. Any lead or example to follow?
There are other hooks that have the graphic context besides onDrawGUI.

The example is the same one for any party hook. What's important are the arguments available to the hook. You use the context object for the graphics functions
Thanks Isaac! I have just found viewtopic.php?f=22&t=8250#p83546 from J Wordsworth and the JKos site, and I do this:
SpoilerShow

Code: Select all

party.party:addConnector("onDrawGui", self.go.id, "newsheet")

function newsheet()
	textlist()
      context.drawImage2("mod_assets/textures/dc_octog3_panel.tga",5,5,0,0,1024, 693, 2550, 1430)  --------------------------------------------to be modified with context width and height
      context.drawRect(90, 890, 90, 30)   --------------------------------------------to be modified with context width and height
      context.color(0,0,0,255)
      context.drawText("CLOSE", 100, 910)
      if ( context.button("CLOSE", 100, 900, 90, 90) ) then
   print("CLOSED")
  end
      
      context.font("large")
      local width = context.width
      context.drawParagraph(bufferpage, 100,200,width-100)

end
Now, how can I reverse context to close the image?
And something bad is happening when I test it in the editor: the command to toggle fullscreen don't work anymore after the image is drown and the editor become irresponsive... Image size is involved, I suppose? (issue is linked to the keyboard key, I can still close the project but using this key causes crash)
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Duncan1246 wrote:And something bad is happening when I test it in the editor: the command to toggle fullscreen don't work anymore after the image is drown and the editor become irresponsive... Image size is involved, I suppose? (issue is linked to the keyboard key, I can still close the project but using this key causes crash)
I've never encountered this before [before today :shock: ].

I've since found out that one of my own projects that uses showImage(), hangs the editor if the 'Esc' key is pressed during the slideshow. But this doesn't happen in the regular game... So it might be a bug in the editor. Normally (in the game) the Esc key displays the game menu, but in the editor it instead exits fullscreen in the preview.
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: Ask a simple question, get a simple answer

Post by Duncan1246 »

"So it might be a bug in the editor. Normally (in the game) the Esc key displays the game menu, but in the editor it instead exits fullscreen in the preview."
I hope so! But it happens only when I use the context commands.
Here is the script at this point:
SpoilerShow

Code: Select all

function newsheet(self, context)
	textlist()
	 local width = context.width
	 local height = context.height
	 local offset = context.width * .1
      context.drawImage2("mod_assets/textures/dc_octog4_panel.tga",5,5,0,0,640, 480, width, height)
      context.drawRect(offset, (0.8 * height), 90, 30)
      context.color(0,0,0,255)
      context.drawText("CLOSE", offset+10, (0.8 * height)+20)
      if ( context.button("CLOSE", offset+10, (0.8 * height)+10, 90, 90) ) then
   print("CLOSED")
   party.party:removeConnector("onDrawGui", self.go.id, "newsheet")
  end
      
      context.font("large")
     
      context.drawParagraph(bufferpage, offset, context.height*.1, width*.8)

end
More important question: how I close the drawn image?
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
Post Reply