SphereCommunity
[Resolved]Impossible open a dialog on an HIT event - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: [Resolved]Impossible open a dialog on an HIT event (/Thread-Resolved-Impossible-open-a-dialog-on-an-HIT-event)



[Resolved]Impossible open a dialog on an HIT event - Jhobean - 11-25-2019 12:45 PM

It's normal i'm not able to open a dialog in this situation?

Code:
[EVENTS e_paladin_sword]
ON=@HIT

dialog d_test

I tried i.dialog and src.dialog too

I want update my XP bar this way... But it seem impossible to open a dialog on the @hit trigger...

I tried to call a function, call a new trigger and on this trigger open the dialog... Nothing to do. Since it pass throught the @hit, nothing work....

Any idea?


RE: Impossible open a dialog on an HIT event - darksun84 - 11-25-2019 06:33 PM

Dialogs are always sent to the SRC and in @Hit the SRC is defender Big Grin, so i think you need to use the trysrc command
trysrc <uid> dialog d_test


RE: Impossible open a dialog on an HIT event - Coruja - 11-26-2019 07:33 AM

The @Hit trigger is only used on chars (its called on the attacker when it hit the target), there's no @Hit trigger on items. So instead use @Hit on the weapon, try using @Hit on the char

But anyway in this case you can optimize the code using @GetHit instead @Hit, because @Hit is only called on physical combat (I think it's not called for spells, etc) and you will also need to add this @Hit trigger on all players, NPCs, etc. But using a single @GetHit on char will make it always call @GetHit when it got any damage from any source, so it makes more sense use @GetHit instead @Hit


RE: Impossible open a dialog on an HIT event - Jhobean - 11-26-2019 10:06 AM

Thx coruja for this optimisation explanations. I'll try this.

Dark, thx your idea work well!!