Compiles but doesn't work in game

Post » Sun Jul 28, 2013 1:19 am

Hi, I wrote the following script:

Scriptname aatestYield extends ReferenceAlias{Yield test}Event OnActivate(ObjectReference akActionRef)	Actor Target = PlayerRef.GetCombatTarget() As Actor 	akActionRef = Target 	If(!Target.IsBleedingOut() || !Target.HasKeyword(ActorTypeNPC))		return	Else		if(PlayerRef.IsWeaponDrawn())			if(PlayerRef.GetEquippedItemType(1) == 1 || PlayerRef.GetEquippedItemType(1) == 4) 				PlayerRef.PlayIdleWithTarget(pa_1HMKillMoveBleedOutKill, Target)			elseif(PlayerRef.GetEquippedItemType(1) == 3 || PlayerRef.GetEquippedItemType(1) == 6)				PlayerRef.PlayIdleWithTarget(pa_1HMKillMoveDecapBleedOut, Target)			endif		endif	endifEndEvent	 Actor Property PlayerRef  Auto  Keyword Property ActorTypeNPC AutoIdle Property pa_1HMKillMoveBleedOutKill  AutoIdle Property pa_1HMKillMoveDecapBleedOut Auto  

The idea is the following:

If an actor of type NPC is playing the bleedout animation and the player activates such NPC at that moment, then the player will perform a finishing move on the NPC. Which finishing move depends on the weapon the player has equipped in his right hand.

This script is given to the player through a quest alias.

Does anybody spot anything wrong with the script?

Thanks for any help.

User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Sun Jul 28, 2013 8:13 am

You've got the OnActivate event the wrong way round. If the script is attached to the player then the OnActivate event will only fire if something activates the player, not when the player activates something.

You'll need to dynamically attach the script to the target actor using a cloak effect. With this in mind you'll need to rethink the logic slightly. I'm browsing on my phone at the moment, currently 1700 miles away from my PC and the CK so I cannot really help much further (my Englishman brain is melting in this sun :P), but judging by your scripting, I'm sure you'll be able to figure the rest out :)

- Hypno
User avatar
Spencey!
 
Posts: 3221
Joined: Thu Aug 17, 2006 12:18 am


Return to V - Skyrim