New hooks?
New hooks?
We are preparing for a new beta build and I could throw in some new hooks if you have any requests.. Simple to implement hooks and generally useful hooks have higher chance of being implemented than complex and rarely needed hooks.
Now's your chance to speak up!
Now's your chance to speak up!
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: New hooks?
onDrawGui please if the "graphics context" object is still available and won't require too much work for you! Just having it in the party definition again would be great, but if it could be a hook that objects can use as/when they need - that would be even better (I could write the notebook plugin without modders having to then integrate the code into their own onDrawGui call). Although, I'm not too sure if connectors are really intended to be called every frame (performance wise).
Last edited by JohnWordsworth on Tue Nov 04, 2014 11:10 am, edited 1 time in total.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: New hooks?
Something in the Teleporter to see when it's about to teleport the party, so you can block it.
Also, an onDamage hook on the HealthComponent would be nice.
Also, an onDamage hook on the HealthComponent would be nice.
Last edited by Prozail on Tue Nov 04, 2014 11:15 am, edited 1 time in total.
Links to my YouTube playlist of "tutorials" and to my forum thread.
Re: New hooks?
Being able to return false with the onEquipItem hook would be nice! 

Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: New hooks?
onDrawGui +1 please
I´d like again to have possibility to create Gui with some clickable options in it...
I´d like again to have possibility to create Gui with some clickable options in it...
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: New hooks?
I've not spent all that long playing with scripting yet (spending all my time with the GMT2 at the moment), so these might already be possible... But some ideas:
- AnimationComponent.onFinish(), ParticleComponent.onFinish(), SoundComponent.onFinish() - So that it's easier to string together events and effects without worrying about specific timings.
- Being able to return a damage value in "onDamage" kinds of hooks (when defined in the mod's init.lua file) so that you can easily alter how much damage a monster takes from a specific hit without then having to cancel the damage and fake all of the hit effects.
- I don't want to derail the thread with other ideas (I'll save those for a Glogg coding session!), but something that is related to the hook system that would be useful is a "removeConnector(action, target, name)" method so that you can remove an item that might end up being destroyed from an object's connector list.
- AnimationComponent.onFinish(), ParticleComponent.onFinish(), SoundComponent.onFinish() - So that it's easier to string together events and effects without worrying about specific timings.
- Being able to return a damage value in "onDamage" kinds of hooks (when defined in the mod's init.lua file) so that you can easily alter how much damage a monster takes from a specific hit without then having to cancel the damage and fake all of the hit effects.
- I don't want to derail the thread with other ideas (I'll save those for a Glogg coding session!), but something that is related to the hook system that would be useful is a "removeConnector(action, target, name)" method so that you can remove an item that might end up being destroyed from an object's connector list.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: New hooks?
Rather than an old 'party.onDrawGui' I preffer smth like:
onBeginDrawGui - so I can return false to prevent whole Gui Drawing (to have the same effect like freelok has, or for a cutscene --> hope I can use camera component atached to the animated object/projectile and)
onEndDrawGui to draw custom GUI button OVER existing Gui Controls
Does not matter where the hook is (party, GameMode...), if we can use these two statements.
onBeginDrawGui - so I can return false to prevent whole Gui Drawing (to have the same effect like freelok has, or for a cutscene --> hope I can use camera component atached to the animated object/projectile and)
onEndDrawGui to draw custom GUI button OVER existing Gui Controls
Does not matter where the hook is (party, GameMode...), if we can use these two statements.
Last edited by Leki on Tue Nov 04, 2014 12:03 pm, edited 1 time in total.
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
Re: New hooks?
Taking a look at the updated scripting reference...you guys have excellent modding support. That you're planning to make it even better is just downright awesome, and frankly makes me want to throw more money at you.
- An onHitMonster or onProjectileHit hook for FirearmAttackComponent, like the ones for MeleeAttackComponent and ProjectileComponent, would be nice.
- I want to second the SoundComponent.onFinish() suggestion. When I tried implementing basic dynamic music in LoG1, I could never get past the timing issues, and ended up mostly scrapping it. I'd love to be able to try again in LoG2.
- An onHitMonster or onProjectileHit hook for FirearmAttackComponent, like the ones for MeleeAttackComponent and ProjectileComponent, would be nice.
- I want to second the SoundComponent.onFinish() suggestion. When I tried implementing basic dynamic music in LoG1, I could never get past the timing issues, and ended up mostly scrapping it. I'd love to be able to try again in LoG2.
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: New hooks?
Not hooks, really, but I would like to see:

- A Champion:getPortrait method.. so that portraits can be used in GUI
(Makes things like this a looooot easier!)
- A Champion:getExp method (so far it can be done by adding exp, waiting on the onLevelUp hook... a mess)
- getConnector and removeConnector methods (this makes easier to create complex things by allowing runtime code to rewire entities)
- I didn't recheck for Log2, but free-looking didn't trigger onTurn
- Party.onInjuredChampion, unless injuries are already handled in onReceiveCondition [didn't check]
- onFinish/onExpire on sound, spells like shields/light/darkness, conditions

Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
Re: New hooks?
I think these probably fall in the "rarely needed" category, but in case you get bored with nothing to do
:
I'd love a hook for something like "onEnter" and "onExit" for maps when the party enters or exits from arbitrary positions. That sounds like it could be complex, though, in terms of actually modifying the hook? I don't know. I know it's possible to get this effect in a lot of different ways, but it would make some things much easier.
And for something REALLY unnecessary
: A counterpart to onMove for when the party actually arrives in a given tile would make life easier for keeping better track of when the party's position actually changes. Things like teleporters, moving obstacles, etc. make this difficult with just onMove.
Anyway, sorry for the stupid suggestions, but I figure it doesn't hurt to throw one or two on the pile, since you can ignore the really dumb ones.
+1 for John's suggestions (onFinish, removeConnector, etc.), too!
Thanks so much for continuing the effort for the modders!


I'd love a hook for something like "onEnter" and "onExit" for maps when the party enters or exits from arbitrary positions. That sounds like it could be complex, though, in terms of actually modifying the hook? I don't know. I know it's possible to get this effect in a lot of different ways, but it would make some things much easier.
And for something REALLY unnecessary

Anyway, sorry for the stupid suggestions, but I figure it doesn't hurt to throw one or two on the pile, since you can ignore the really dumb ones.

+1 for John's suggestions (onFinish, removeConnector, etc.), too!
Thanks so much for continuing the effort for the modders!