Advertisement
Matthiaswagg

For Tobias (Difficult)

May 2nd, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. Scriptname JaxonzArrowsGlowEffect extends activemagiceffect
  2.  
  3. EffectShader Property efsGlow Auto
  4. VisualEffect Property vfxLight Auto
  5. ObjectReference Property objPlayer Auto
  6. int kBowRelease = 6
  7. int kProjectile = 50
  8.  
  9. Event OnInit()
  10. RegisterForActorAction(kBowRelease)
  11. EndEvent
  12.  
  13. Event OnActorAction(int actionType, Actor akActor, Form source, int slot)
  14. ;the projectile shot is reliably the last projectile in the cell
  15. Cell kCell = objPlayer.GetParentCell()
  16. If (akActor == objPlayer)
  17. int iTries = 15
  18.  
  19. ;it may take a moment for the projectile shot to come into existence
  20. int iProjectilesInCell = kCell.GetNumRefs(kProjectile)
  21. Utility.Wait(0.01)
  22. While (iProjectilesInCell == kCell.GetNumRefs(kProjectile)) && iTries
  23. iTries -= 1
  24. Utility.Wait(0.01)
  25. EndWhile
  26. ;NB: if there are tons of projectiles being shot, we can't guarantee that this is the player's projectile
  27.  
  28. ObjectReference objProjectile = kCell.GetNthRef(kCell.GetNumRefs(kProjectile) - 1, kProjectile)
  29.  
  30. ;make it glow and light it up!
  31. efsGlow.Play(objProjectile)
  32. vfxLight.Play(objProjectile)
  33.  
  34. ;track it while in motion
  35. Float fDist = objPlayer.GetDistance(objProjectile)
  36. While objPlayer.GetDistance(objProjectile) != fDist
  37. fDist = objPlayer.GetDistance(objProjectile)
  38. Utility.Wait(0.05)
  39. EndWhile
  40. ;kill the light when motion stops
  41. vfxLight.Stop(objProjectile)
  42. EndIf
  43. EndEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement