Jump to content

ontranslationcomplete papyrus script


erratichippo

Recommended Posts

Trying to write code that uses the event ontranslationcomplete. When I use this code the event is never called. Did I use the function improperly? Do I need to attach the script with this function call directly to the object that is being translated?

scriptName WeaponThrow extends ActiveMagicEffect
import game
import debug
formlist property WeaponList auto 
objectreference WeaponFound 
referencealias property WeaponFoundRef auto
Actor Target
float RadiusToFindWeapon = 2000.0

Event Oneffectstart(Actor akTarget, Actor akCaster)
    Target=akTarget
    WeaponFound = game.FindClosestReferenceOfAnyTypeInListFromRef(WeaponList, akCaster, RadiusToFindWeapon) 
    WeaponFound.SetMotionType(4)
    WeaponFound.SplineTranslateToRefNode(akTarget, "NPC Head [Head]", 1, 5000) 
Endevent

Event ontranslationcomplete()
    debug.Notification("Target "+Target+".")
    debug.SendAnimationEvent(Target,"StaggerStart")
    WeaponFound.SetMotionType(1)
Endevent
Link to comment
Share on other sites

So I will need to create a reference alias for the object called WeaponFound. I need to make a dummy quest with a reference alias which has the ontranslationcomplete script attached to it. Then I need to point the reference alias to the object weaponfound. I can then create a global variable which I can use to communicate to the magic script that the reference script completed the translation. So the real question is how do I do everything I just mentioned?

Edited by erratichippo
Link to comment
Share on other sites

You need an activate parent so that you can run the OnActivate function. So in your magic effect script you could have an object reference property that points to your object and activates it.

 

And on the object itself (which needs to be an activator or a movable static) you can have a script using the

 

Event OnActivate()

Do stuff

EndEvent

Link to comment
Share on other sites

Quite odd as I have had luck with OnTranslationComplete() in an activemagiceffect (actually currently working on one that uses it)

 

Out of curiosity could you try this instead

I know it's not the same but just for testing purposes

scriptName WeaponThrow extends ActiveMagicEffect
import game
import debug
formlist property WeaponList auto
objectreference WeaponFound
referencealias property WeaponFoundRef auto
Actor Target
float RadiusToFindWeapon = 2000.0

Event Oneffectstart(Actor akTarget, Actor akCaster)
    Target=akTarget
    WeaponFound = game.FindClosestReferenceOfAnyTypeInListFromRef(WeaponList, akCaster, RadiusToFindWeapon)
    WeaponFound.SetMotionType(4)
    WeaponFound.TranslateTo(akTarget.GetPositionX(), akTarget.GetPositionY(), akTarget.GetPositionZ()+20.0, 0, 0, 0, 50.0, 3000.0)
Endevent

Event OnTranslationComplete()
    debug.Notification("Target "+Target+".")
    debug.MessageBox("Target "+Target+".")
    debug.SendAnimationEvent(Target,"StaggerStart")
    WeaponFound.SetMotionType(1)
Endevent

I just want to know if it's due to it being a splinetranslateto as opposed to a normal one (which I'm using atm)

 

My script also works and complies fine

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...