How to detect player Shouting?

Post » Fri May 16, 2014 6:37 am

Here's the story: the player meets a NPC who's searching for the Dragonborn, however she doesn't believe the player when they confess to being Dragonborn, and require some more convincing. Of course the best means of convincing is using a Shout, and this is where the problems begin.

There's an optional quest in MQ104 when the player is given an optional objective of using their freshly obtained Shout. This is how the script looks like:

Scriptname MQ104PlayerScript extends ReferenceAlias{used to detect player shouting}Event OnSpellCast(Form akSpell);     debug.trace(self + ": player cast " + akSpell)    Spell castSpell = akSpell as Spell;     debug.trace(self + ": player cast " + castSpell)    if castSpell && castSpell == ForcePushSpell;         debug.trace(self + ": " + castSpell + "==" + forcepushspell + ": setting stage 100")        GetOwningQuest().SetStage(100)    else;         debug.trace(self + ": " + castSpell + "<>" + forcepushspell + ": do nothing")    endifendevent

This looks simple. It's the very beginning of the game, the player knows just the first word of Unrelenting Force, and this is exactly what the script is looking for. In my case, I want the script to catch any and all of the shouts the player might know. How do I go about it, without having to define each and every shout at every stage as a separate property and set up a neverending OR condition. I guess I could set up some kind of array and have the script check every shout in this array, but I have no idea how to go about that. Any help would be appreciated.

User avatar
Jordan Fletcher
 
Posts: 3355
Joined: Tue Oct 16, 2007 5:27 am

Post » Thu May 15, 2014 11:29 pm

You can use the SKSE http://www.creationkit.com/OnActorAction_-_Form event for that.

User avatar
Brad Johnson
 
Posts: 3361
Joined: Thu May 24, 2007 7:19 pm

Post » Fri May 16, 2014 2:36 pm

Thanks, this is handy, however is there a native method to achieve this? I'd rather not have my mod depend on SKSE unless it's absolutely necessary.

User avatar
Jennifer Munroe
 
Posts: 3411
Joined: Sun Aug 26, 2007 12:57 am

Post » Fri May 16, 2014 4:41 am

Create a quest whose sole purpose it is to start, set your stage, then complete, and start it using story manager.

http://www.creationkit.com/Cast_Magic_Event
User avatar
Jonathan Montero
 
Posts: 3487
Joined: Tue Aug 14, 2007 3:22 am

Post » Fri May 16, 2014 10:12 am

You could try using the keyword MagicShout which is attached to Shouts. Whether it is attached to all shouts the player uses, i haven't checked. I use this method myself for a custom upgrade spell.

Keyword Property MagicShout AutoEvent OnSpellCast(Form akSpell)    if (akSpell.HasKeyword(MagicShout))        Do Stuff   endifEndEvent

@BigBadDaddy - I seem to recall having an issue with the CastMagic event in the story manager not working when in combat, however it would be unlikely to cause issues in this case.

User avatar
Causon-Chambers
 
Posts: 3503
Joined: Sun Oct 15, 2006 11:47 pm

Post » Fri May 16, 2014 12:27 am

Awesome! Thank you so much for your help, guys.

User avatar
Jaylene Brower
 
Posts: 3347
Joined: Tue Aug 15, 2006 12:24 pm

Post » Fri May 16, 2014 4:44 am

I've never used that event myself but if you have any issues let us know and we'll think of something else :)
User avatar
TRIsha FEnnesse
 
Posts: 3369
Joined: Sun Feb 04, 2007 5:59 am


Return to V - Skyrim