Page 1 of 1

Potion Recipe

Posted: Mon Aug 01, 2016 10:00 am
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.

Re: Potion Recipe

Posted: Mon Aug 01, 2016 11:01 am
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?

Re: Potion Recipe

Posted: Mon Aug 01, 2016 12:29 pm
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 :(

Re: Potion Recipe

Posted: Tue Aug 02, 2016 7:12 pm
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/?

Re: Potion Recipe

Posted: Wed Aug 03, 2016 5:29 pm
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

Re: Potion Recipe

Posted: Wed Aug 03, 2016 6:27 pm
by bongobeat
ah true!

I forgot Andakrainor alchemy stuff! Appologises!

I only remember his mod because of the water consumption stuff :roll: