New hooks?

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
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

New hooks?

Post by petri »

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!
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: New hooks?

Post by JohnWordsworth »

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.
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: New hooks?

Post by Prozail »

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.
Last edited by Prozail on Tue Nov 04, 2014 11:15 am, edited 1 time in total.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: New hooks?

Post by akroma222 »

Being able to return false with the onEquipItem hook would be nice! ;)
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: New hooks?

Post by Drakkan »

onDrawGui +1 please
I´d like again to have possibility to create Gui with some clickable options in it...
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: New hooks?

Post by JohnWordsworth »

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.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Leki
Posts: 550
Joined: Wed Sep 12, 2012 3:49 pm

Re: New hooks?

Post by Leki »

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.
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
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: New hooks?

Post by minmay »

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.
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
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: New hooks?

Post by Xanathar »

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)
As for hooks:
  • 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
All of these are based on my experience with Log1 modding, I didn't have time to experiment with Log2 so much, so feel free to ignore them if they don't really apply! :mrgreen:
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
User avatar
jxjxjf
Posts: 33
Joined: Fri Oct 24, 2014 6:26 am

Re: New hooks?

Post by jxjxjf »

I think these probably fall in the "rarely needed" category, but in case you get bored with nothing to do ;) :lol::

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 :D: 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. :lol:

+1 for John's suggestions (onFinish, removeConnector, etc.), too!

Thanks so much for continuing the effort for the modders!
Post Reply