Desired object dont return true on gettarget for me, unfortunately. Now, I'm trying to make full-transparent creature (I've picked lorkhan's heart because of static model), but I don't have any idea how to hide it completely...
Yeah, sorry. Shortly after I wrote my post I've realized GetTarget only works between two
actors for some reason. It cannot be used to check for the player targeting an item or container.
That said, I've since tried making something similar to my suggestion above using xGetPCTarget instead of GetTarget. It requires MWSE but it works. And there's no invisible creature or NPC involved.
What I did was add a barrel (container) to the Balmora Guild of Mages, and add this script to it:
Begin adul_test_lookatme_b_scrshort doOnceif ( MenuMode == 1 ) Returnendifif ( "player"->GetSoundPlaying, "Weapon Swish" == 1 ) if ( doOnce == 0 ) StartScript, "adul_test_lookatme_scr" set doOnce to 1 endifelseif ( doOnce == 1 ) set doOnce to 0endifEnd
This script checks every frame whether the player is swishing his weapon, and if he does, it runs the global script "adul_test_lookatme_scr". Right now it does not work with bows or crossbows but making changes to it to allow that wouldn't be too hard. The adul_test_lookatme_scr script is as follows:
Begin adul_test_lookatme_scrshort doOnceshort stemplong pcreflong tempif ( MenuMode == 1 ) Returnendifif ( doOnce == 0 ) "player"->AddSpell, "adul_test_lookatme_sp" set doOnce to 1 Returnendifsetx pcref to xGetRef, "player"xSetRef, pcrefset stemp to GetSpellEffects, "adul_test_lookatme_sp"if ( stemp == 0 ) Returnendifsetx temp to xGetPCTarget"player"->RemoveSpell, "adul_test_lookatme_sp"set doOnce to 0StopScript, "adul_test_lookatme_scr"if ( temp == 0 ) Returnendifsetx temp to temp->xGetBaseIDsetx temp to xStringCompare, temp, "adul_test_lookatme"if ( temp != 0 ) ReturnendifMessageBox, "Ouch!"End
The spell "adul_test_lookatme_sp" is a 1000 point telekinesis spell that has the ability checkbox checked. Every time you swing your weapon, the spell gets added to you for 1 frame, and if you're looking in the direction of the barrel, the barrel will say "Ouch!"