Potion Recipe

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!
Post Reply
vieuxchat
Posts: 48
Joined: Wed Mar 02, 2016 3:14 pm

Potion Recipe

Post by vieuxchat »

I've added new potions (a fire/earth/cold/shock shield)
I created a gfxAtlas thanks to an external software "gfx atlas toolkit" : http://www.johnwordsworth.com/legend-of ... s-toolkit/
I used it beacause I don't have photoshop (I use GIMP). It created a dds file with the 4 icons for my potions.
The potions can be used in game, they render well as game objects and as item in the inventory.

So the next step was to create a recipe. I added that

Code: Select all

defineRecipe{
	potion = "potion_shock_shield",
	level = 2,
	ingredients = 234,
}

defineRecipe{
	potion = "potion_fire_shield",
	level = 2,
	ingredients = 231,
}

defineRecipe{
	potion = "potion_ice_shield",
	level = 2,
	ingredients = 232,
}

defineRecipe{
	potion = "potion_earth_shield",
	level = 2,
	ingredients = 233,
}
(Do the order of ingredients matter ? Is 231 the same as 123 ?)

It seems to work well until... I tried to create a potion : I got an exception saying "bad argument #1 to 'drawImage' (renderableTexture expected, got string)
The exception is thrown at the moment I put the ingredients and the game try to show which potion will be created. But the 'preview" of the potion throws that exception.

What can I do ?

PS: I explained all the steps I did to be sure I didn't do something stupid when exporting the png file into dds.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Potion Recipe

Post by Isaac »

It does this for each potion type?
Does this not happen if you set the potion icons [all] to one of the official icons in the game?

First thing I would check is for case sensitive spelling errors in the atlas path.

Can you post the potion definitions and the actual (full context) error as a screenshot or log excerpt?
vieuxchat
Posts: 48
Joined: Wed Mar 02, 2016 3:14 pm

Re: Potion Recipe

Post by vieuxchat »

It does this for all my 4 potions.
I don't think it's a case sensitive error as the item can be added in the editor picked up/thrown/put in the inventory/used in the inventory/used in the hand. So the right icon is already known by the engine.

I commented the line with the custom gfxAtlas and the potion had the icon of a mace and I was able to create it with the mortar.
So I think it's an engine limitation that don't recognize custom gfxAtlas when creating potions :(

Anyway here is the code of potions :

Code: Select all

defineObject{
	name = "potion_shock_shield",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/flask.fbx",
		},
		{
			class = "Item",
			uiName = "Shock Shield Potion",
			gfxAtlas = "mod_assets/textures/gui/EarthFireIceShock_Shield_Potions.dds",
			gfxIndex = 3,
			weight = 0.3,
			stackable = true,
			traits = { "potion" },
		},
		{
			class = "UsableItem",
			sound = "consume_potion",
			onUseItem = function(self, champion)
				champion:setCondition("shock_shield")
			end,
		},
	},
	tags = { "custom_vieuxchat" },
}

defineObject{
	name = "potion_ice_shield",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/flask.fbx",
		},
		{
			class = "Item",
			uiName = "Ice Shield Potion",
			gfxAtlas = "mod_assets/textures/gui/EarthFireIceShock_Shield_Potions.dds",
			gfxIndex = 2,
			weight = 0.3,
			stackable = true,
			traits = { "potion" },
		},
		{
			class = "UsableItem",
			sound = "consume_potion",
			onUseItem = function(self, champion)
				champion:setCondition("frost_shield")
			end,
		},
	},
	tags = { "custom_vieuxchat" },
}

defineObject{
	name = "potion_fire_shield",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/flask.fbx",
		},
		{
			class = "Item",
			uiName = "Fire Shield Potion",
			gfxAtlas = "mod_assets/textures/gui/EarthFireIceShock_Shield_Potions.dds",
			gfxIndex = 1,
			weight = 0.3,
			stackable = true,
			traits = { "potion" },
		},
		{
			class = "UsableItem",
			sound = "consume_potion",
			onUseItem = function(self, champion)
				champion:setCondition("fire_shield")
			end,
		},
	},
	tags = { "custom_vieuxchat" },
}

defineObject{
	name = "potion_earth_shield",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/flask.fbx",
		},
		{
			class = "Item",
			uiName = "Earth Shield Potion",
			gfxAtlas = "mod_assets/textures/gui/EarthFireIceShock_Shield_Potions.dds",
			gfxIndex = 0,
			weight = 0.3,
			stackable = true,
			traits = { "potion" },
		},
		{
			class = "UsableItem",
			sound = "consume_potion",
			onUseItem = function(self, champion)
				champion:setCondition("poison_shield")
			end,
		},
	},
	tags = { "custom_vieuxchat" },
}
EDIT: And the error :
Image

EDIT2 :
Owww.... I found this : viewtopic.php?f=21&t=9778
It seems it's the same error and it lasts for a year long. It's not encouraging :(
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Potion Recipe

Post by bongobeat »

yes, you can't actually make new recipes based on the same structure of the asset definitions but you can do it with an external mod of AdrTru:

http://www.nexusmods.com/legendofgrimrock2/mods/24/?

or

http://www.nexusmods.com/legendofgrimrock2/mods/66/?
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Potion Recipe

Post by akroma222 »

Yes it will crash if you throw a custom icon into you alchemy recipes.

Here is an Alchemy thread I posted that ArdTru and AndrakRainor have contributed heavily to

viewtopic.php?f=22&t=13931&start=30

which will lead you to AndrakRainor's custom GUI Alchemy system, allowing custom icons (and includes the use of water flasks)
It will be updated fairly soon with Recipes and some new flasks from ArdTru

Hope this helps
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Potion Recipe

Post by bongobeat »

ah true!

I forgot Andakrainor alchemy stuff! Appologises!

I only remember his mod because of the water consumption stuff :roll:
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Post Reply