View Full Version : Sound Sets and Lua Pattern
banesorka
May 11th, 2024, 10:59
I am trying to get some sound working for particular NPCs, like dogs, mutant hounds, and feral ghouls. Problem is that some of them have attack names that are just the same, like bit or unarmed. So I thought why not add their npc name to the lua regex, but that does not seem to be working.
For example, feral ghoul, in the chat window, we get
Feral Ghoul:
[ATTACK] Unarmed (vs. TN 8)
[LOCATION: Right Arm]
[SUCCESSES: 1]
The following individual regex works (one example per line):
(Unarmed)(.*)(SUCCESS)
(Unarmed)(.*)
But, any unarmed attack then gets the feral ghoul sound effect, even if it is an unarmed from a PC or a npc raider. So I tried this: (Feral Ghoul)(.*)(Unarmed)(.*)
This combined a working regex, with an addition at the front to look for the type of npc. No dice, I even tried just the feral ghoul part: (Feral Ghoul)(.*)
Still, no dice.
Anyone got any ideas? At the moment, it would seem like the regex is completely ignoring the first line of the chat box output.
For context, all my sound sets for weapons work, since all of those are just in the second line on of the chatbox output.
Zacchaeus
May 11th, 2024, 15:10
I think what you'd need to do here is create an item - called Ghoulclaws or something similar and then create a sound set for that item. You would also need to edit the attack action in the Ghoul to Ghoulclaws (or whatever you called it).
The trigger doesn't look for the name of the creature that is making the attack - only what action the creature made (attack, damage, cast) and what the result of that attack was (hit, miss, damage type, spell).
banesorka
May 11th, 2024, 18:05
I was afraid of that. I did that for a dog companion one of my players has. I was hoping to avoid that with NPCs, will end up with a custom copy of the ghouls, or any others I do this for, that wont get updated if new updates come out. Oh well..
Thanks for the reply!
Any idea why the trigger does not look at the line that has the name of the character?
Zacchaeus
May 11th, 2024, 18:08
I was afraid of that. I did that for a dog companion one of my players has. I was hoping to avoid that with NPCs, will end up with a custom copy of the ghouls, or any others I do this for, that wont get updated if new updates come out. Oh well..
Thanks for the reply!
Any idea why the trigger does not look at the line that has the name of the character?
I dunno. Might have something to do with the fact that you can have things like Ghoul 1, Ghoul 2 etc.
Pathicc
May 25th, 2024, 10:43
In lua I've used something like this for sounds, e.g. .-ATTACK.-MINIGUN.- I haven't tried with names like ghoul, but if you put a name in front it might work
banesorka
May 27th, 2024, 14:26
In lua I've used something like this for sounds, e.g. .-ATTACK.-MINIGUN.- I haven't tried with names like ghoul, but if you put a name in front it might work
Unfortunately even the most basic attempt to get a sound to go off if the word Ghoul shows up in the chat window is failing. So I would have to rename the weapons on all creatures that have some kind of unarmed attack, which I just don't want to do.
Edit: For clarification.
When I looked for the word Ghoul in any context, no sound ever played, the final conclusion I have made at this point is similar to what Zacchaeus said, the line that has the name of the NPC is never read by any sound set lua. The reason for it is totally unknown to me though.
Feral Ghoul: Lua ignores this
[ATTACK] Unarmed (vs. TN 8) Lua reads from here
[LOCATION: Right Arm] -----
[SUCCESSES: 1] To here
Trenloe
May 27th, 2024, 17:33
Edit: For clarification.
When I looked for the word Ghoul in any context, no sound ever played, the final conclusion I have made at this point is similar to what Zacchaeus said, the line that has the name of the NPC is never read by any sound set lua. The reason for it is totally unknown to me though.
Feral Ghoul: Lua ignores this
[ATTACK] Unarmed (vs. TN 8) Lua reads from here
[LOCATION: Right Arm] -----
[SUCCESSES: 1] To here
That's correct, the NPC name is not part of the pattern matching. The main FG dev, Moon Wizard, discussed this in a thread here: https://www.fantasygrounds.com/forums/showthread.php?79008-Sound-Triggers-works-for-chat-but-doesn-t-work-for-dice-rolls&p=697112&viewfull=1#post697112
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.