Script help request -- The right emote at the right place

Hey folks,

Is it possible to have scripts trigger when a player performs (preferably only when completing the entire animation) an emote?

I would want a regular spell with a custom name and an until-death duration to be placed upon a player who performed certain emotes at certain places.

If I seem vague it’s because it’s kind of an easter egg and I’d want people to have to find out ingame. :stuck_out_tongue:

hm. I don’t think the scripts for the radial menu emotes are accessible to builders; at least, not in 1.69. I have no idea if NWNCX would allow for doing this directly.

You could set up your own custom emotes as feats and grant them to all players on character creation. Then, you’d have a script that’s triggering on use of the emote feat, in which you can check for the presence of a flag denoting a time frame during which using the emote would do something special. Set the flag when the time frame starts, delete the flag when it ends.

For going that route, investigate spells.2da, feat.2da, and the race_feat_*.2das.

Far as completing the animation goes… hm. :thinking:

You could set up an “abort check” function that’s called repeatedly at delays once the animation starts, and checks for whether the PC is doing anything else, using GetCurrentAction, and signals that the animation has been aborted if they are.

1 Like

I really hope I wont need to do that. The idea is that if people “show respect” (use worship, pray, meditate, or bow emote) they are rewarded at a certain point. Unless feat-granted emotes are added to the emote radial menu and can replace some of the existing ones it is not a viable solution since it will be too obvious as well as too unintuitive. And unless you can have unlimited custom feats it also seems like a waste of those. :slight_smile:

I couldn’t find anything relating the emotes when searching through the compiler either and moved onto something else initially (that is, before even posting the thread), but you just made me think of searching for animations as well and it came up with these;

ANIMATION_LOOPING_WORSHIP
ANIMATION_FIREANDFORGET_BOW
ANIMATION_LOOPING_MEDITATE

Assuming these are the animations that are called when emoting, would it be possible to have something happen when they are played? Perhaps a script on the area, module or a trigger painted to designate the area wherein I want such emotes to have an effect?

Picture what’d have to be going on behind the scenes if the area or module had to constantly check whether any PC in it is currently playing a specific animation - that’d have to be happening once or more per second, checking every object in the area or every PC in the module. Compare that to a PC using a feat, which checks for a flag on the area and executes a few extra lines of code if the flag is set.

The former is “lots of things happening over and over again regardless of whether or not the important thing is happening”, while the latter is “one thing happening that causes another few things to happen and then is done”. It’s one of those approaches in scripting/coding that leads to CRASHDEATHS OF LAGGINESS AND DOOM. Avoid at all costs.

The other crucial problem with going at it from that direction is that there are (AFAIK) no functions for checking which animation somebody is currently playing. GetCurrentAction doesn’t even have an “ACTION_PLAYANIMATION” listed; we can’t even check whether they’re playing any animation, much less a specific one.

:thinking:

A workaround might be expanding the ActionPlayAnimation and PlayAnimation functions themselves so that they check for a flag on the area of the caller and execute a script if the flag is set (and hoping that whatever hidden things are happening in those emotes are making use of those functions), but I’m pretty sure those are hardcoded. Might be one more thing we don’t have access to as scripters.

Maybe somebody else has more ideas; the NWNCX folks might be called for here. :-/ Fingers crossed. For what it’s worth, I’m pretty sure there’s space for several thousand extra feats and spells, so waste of spell-and-feat-space needn’t be a concern.

You could try bugging Beamdog about unlocking the radial menu emotes for builders, too. That might work; they want to softcode stuff for the EE anyway.

1 Like

I do not know of a way to detect when emotes are done through the radial menu.

This could definitely be done if you script emotes (such as with an “emote wand” or chat bar commands)…but the special bits would only activate when PCs use that particular method to emote. Scripted emotes can have the PCs do animations, speak standard voice sounds…and you could always lock them in cutscene mode for a moment while the animation plays out. You’d just have to go out of your way to encourage players to use the new method rather than just the radial menu.

1 Like

Thanks for the replies.

I wanted people to be blessed if they paid respect to the DM of DMs by emoting, but it really does need to be able to be done in the “normal” way or it is no secret at all.

Maybe I’ll have it bless you if you speak a certain word or string of words instead, or something… Or even better, spend 2 minutes in front of the shrine without saying a word.

It was an idea I really liked, but I don’t think it’s important enough to use tons of time on or begin buggering developers about.

1 Like

Firing a script event on an animation is doable with NWNX (No need for NWNCX). We were recently discussing adding that to the EE version of NWNX. I had similar perf concerns as TheBarbarian mentioned, but if you only subscribe to changes for a single animation and/or a single PC, it would be much smoother.

3 Likes

If I use the NWNX plugin to build my module and then host it on a server, will people need to download NWNX in order to play on it properly?

Nope. NWNX is server-side.

1 Like

Sweet! Will certainly check that out! Thanks!