Page 1 of 4

New hooks?

Posted: Tue Nov 04, 2014 10:58 am
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!

Re: New hooks?

Posted: Tue Nov 04, 2014 11:09 am
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).

Re: New hooks?

Posted: Tue Nov 04, 2014 11:10 am
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.

Re: New hooks?

Posted: Tue Nov 04, 2014 11:15 am
by akroma222
Being able to return false with the onEquipItem hook would be nice! ;)

Re: New hooks?

Posted: Tue Nov 04, 2014 11:16 am
by Drakkan
onDrawGui +1 please
I´d like again to have possibility to create Gui with some clickable options in it...

Re: New hooks?

Posted: Tue Nov 04, 2014 11:31 am
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.

Re: New hooks?

Posted: Tue Nov 04, 2014 11:48 am
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.

Re: New hooks?

Posted: Tue Nov 04, 2014 11:55 am
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.

Re: New hooks?

Posted: Tue Nov 04, 2014 11:57 am
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:

Re: New hooks?

Posted: Tue Nov 04, 2014 12:18 pm
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!