Alchemy Hook?
Alchemy Hook?
Is there any way to have the system call a function when a character creates a potion?
Re: Alchemy Hook?
Havn't found a way to do this yet. There is no existing hook, and i have tried modifying the mortar, and had a look at tracking what items party receives. None triggers.
Links to my YouTube playlist of "tutorials" and to my forum thread.
Re: Alchemy Hook?
Hmm. I wonder if the following pseudo code would suffice:
No, that won't work. What if the user picks up a potion from the floor?
Bugger. Guess I'll have to think about this some more...
Code: Select all
mortar.onUseItem()
count all potions in all inventories and save the result in currentPotionCount
end
<all potions>.onUseItem()
decrement currentPotionCount
end
<all potions>.onPickUpItem()
count all potions in all inventories
if count > currentPotionCount then
-- potion created!
initialPotionCount = count
end
end
Bugger. Guess I'll have to think about this some more...
Re: Alchemy Hook?
Try this: redefine all recipes to produce "dummy" potions that are copies of the regular potions but with different names. Check getMouseItem() every frame in the PartyComponent.onDrawGui hook. If it's one of the dummy potions, change it into the corresponding regular potion and run your alchemy hook.
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.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Alchemy Hook?
Now that's lateral thinking!
Thanks, I'll give that a go.
Thanks, I'll give that a go.