How do you make a trigger activate only when the player shou

Post » Sun Feb 17, 2013 9:34 am

I'm trying to create a puzzle where the player must perform the Unrelenting Force thuum in order to continue the dungeon. But the problem is that I can't figure out a papyrus script which works 100%.

I can make a script which does activate when the player performs a unrelenting force shout at a trigger but the problem is that everything that enters said trigger will activate the script and if I put a conditional statement which checks if the ActionRef is a shout it will just return with a error.

Heres the script that I got right now:


Scriptname wdpAttackTestScript extends ObjectReferenceshout property ForceShout autoEvent OnTriggerEnter(ObjectReference akActionRef)if (akActionRef == ForceShout)debug.MessageBox("it wurkd lol")endIfendEvent

This is the error that I get:


Starting 1 compile threads for 1 files...Compiling "wdpAttackTestScript"...C:\steamgames\steamapps\common\skyrim\Data\Scripts\Source\wdpAttackTestScript.psc(6,16): [u][b]cannot compare a objectreference to a shout (cast missing or types unrelated)[/b][/u]No output generated for C:\steamgames\steamapps\common\skyrim\Data\Scripts\Source\wdpAttackTestScript.psc, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on C:\steamgames\steamapps\common\skyrim\Data\Scripts\Source\wdpAttackTestScript.pscC:\steamgames\steamapps\common\skyrim\Data\Scripts\Source&--#62;pausePress any key to continue . . .[Finished in 1.5s]


But removing the conditional statement works just fine but of course then everything that enters the trigger that is considered an objectreference will activate the script.


EDIT:

I just tired this:


Scriptname wdpAttackTestScript extends ObjectReference MagicEffect property ForceShout auto Event OnMagicEffectApply(ObjectReference akCaster, MagicEffect akEffect)if (akEffect == ForceShout)debug.MessageBox("it wurkd lol")endIfendEvent

Did not work
User avatar
scorpion972
 
Posts: 3515
Joined: Fri Mar 16, 2007 11:20 am

Post » Sun Feb 17, 2013 4:03 am

You need to declare that the akCaster is the player.

Actor property playerRef auto

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'll point you to a vanilla script: MQShoutTrigger

I've tried to deconstruct that script to the simplest form, but it didn't work.
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Sun Feb 17, 2013 9:28 am

Instead of having a trigger box have the script applied to, I tried a furniture object and it worked. Doesn't work for statics though.
User avatar
Queen of Spades
 
Posts: 3383
Joined: Fri Dec 08, 2006 12:06 pm

Post » Sun Feb 17, 2013 9:20 am

I would use the "OnHit" event. Attached to the trigger object, place the following script or something like it:

scriptName YourScript extends objectReferenceformlist property UnlockList autoEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)    if akAggressor == game.getPlayer()           if UnlockList.hasForm(akSource)                      ;Whatever it is you want your script to do        endif    endifendEvent

In the formlist, put all three tiers of Unrelenting Force or whatever else you'd like to be able to trigger the puzzle with. You can use this for arrows, weapons, whatever.
User avatar
JeSsy ArEllano
 
Posts: 3369
Joined: Fri Oct 20, 2006 10:51 am


Return to V - Skyrim