erratichippo Posted January 25, 2016 Share Posted January 25, 2016 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 More sharing options...
IsharaMeradin Posted January 26, 2016 Share Posted January 26, 2016 OnTranslationComplete() is a member of the ObjectReference script. This means that Object References (and child types i.e. Actor, Weapon, MiscObject) can use the event. ActiveMagicEffect is not a child of ObjectReference and as a result does not recognize and will not run the event. Link to comment Share on other sites More sharing options...
erratichippo Posted January 26, 2016 Author Share Posted January 26, 2016 (edited) 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 January 26, 2016 by erratichippo Link to comment Share on other sites More sharing options...
skinnytecboy Posted January 26, 2016 Share Posted January 26, 2016 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 stuffEndEvent Link to comment Share on other sites More sharing options...
erratichippo Posted January 27, 2016 Author Share Posted January 27, 2016 Is there an existing quest in the CK that I can reference on how to do this? I cannot seem to figure it out based on the information the wiki has given me. Link to comment Share on other sites More sharing options...
erratichippo Posted January 27, 2016 Author Share Posted January 27, 2016 One other thing that is bothering me about what isharameradin said. If ontranslationcomplete is not a recognized event in a magic effect script then why does my script compile? Link to comment Share on other sites More sharing options...
Someone1 Posted January 27, 2016 Share Posted January 27, 2016 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 insteadI 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 More sharing options...
Recommended Posts