Scriptname Portal_OnLoadFillAlias extends ObjectReferenceFormList Property DamnNearEverything autoReferenceAlias Property Thrown autoGlobalVariable Property ShouldThrow autoObjectReference Pulledevent OnLoad()if Thrown.GetReference()==NONE Pulled = Game.FindClosestReferenceOfAnyTypeInListFromRef(DamnNearEverything, self, 45.0) Debug.Notification(Pulled.GetBaseObject().GetName()) ;if Pulled as ObjectReference ShouldThrow.SetValue(1) Debug.Notification("executed if statement") Thrown.ForceRefIfEmpty(Pulled) ;Thrown.GetReference().disable() Debug.Notification(Thrown.GetReference().GetBaseObject().GetName()) Thrown.GetReference().SplineTranslateTo(Thrown.GetReference().GetPositionX(), Thrown.GetReference().GetPositionY(), (Thrown.GetReference().GetPOsitionZ() + 64.0), 0.0, 0.0, 0.0, 1.0, 100.0, 30.0) Utility.Wait(5) ;endIFendIfself.disable()Utility.Wait(1)self.delete()endEvent
The first notification correctly identifies the object that you point the spell at by name. So, that's working. It's about the only working line of code though. If I uncomment the first if statement, the "executed if statement" doesn't appear. It's as if it has forgotten what Pulled is already. So I commented it out to look at the rest of the code. Here's where things go completely sideways. The notification to get Thrown's reference's name (should be the same as the first notification) doesn't execute at all. Furthermore, I don't get anything in my debug log about it, implying that it isn't doing a "cannot call function getbaseobject on a NONE object", the error that would be thrown if the alias was empty. It simply does nothing at all. However, if I uncomment the line about disabling the reference, that works fine. So I know that the alias is filling properly. The real crux of the problem though is that the translation event doesn't occur. I need that darn translation to happen, it's half the purpose of this script. But, nothing.
Why are some functions executing on the alias property and not others? I'm SO confused.
The alias is flagged as reuseable and optional. No other flags, but the alias does have a script attached. Here's that too if it helps.
Scriptname PCKP_Script_GravThrownAlias extends ReferenceAlias GlobalVariable Property ShouldThrow autoReferenceAlias Property HitActor autoActor Property PlayerREF autoint DealDamage=0 ;could use a bool i guess, but maybe i'll need to set this to a non 1 or 0 value someday. I dunno.event OnTranslationComplete()if ShouldThrow.GetValue() as int==1 ;1 is actually the false condition, as long as the player remains casting the spell;ShouldThrow will be 1 due to the previous script. This means that the object in question will continue to track with the;player's hand. In other words, 1 means don't throw it.GetReference().SplineTranslateToRefNode(PlayerRef, "NPC R Hand [RHnd]", 1, 1024)elseIf ShouldThrow.GetValue() as int==0 && HitActor.GetReference()!=NONE && DealDamage==0 ;now, once the player;has hit an actor with the projectile (which puts him in HitActor alias) and has the item tracking and the object has not;tracked to the hitactor yet, it now will fly at the hitactor's head and set dealdamage to true (the player needs also have;let go of the spell to trigger the OnEffectFinish event, which sets the ShouldThrow to 0)GetReference().SplineTranslateToRefNode(HitActor.GetReference(), "NPC Head [Head]", 1, 1280)DealDamage=1elseIf ShouldThrow.GetValue() as int==0 && HitActor.GetReference()!=NONE && DealDamage==1float DamageDealt = (GetReference().GetMass() * 20) ;the third step, once the translation to the hitactor has been taken;care of, is to deal damage to the hitactor, so now I need this to execute and then clear out the aliases(HitActor.GetReference() as Actor).DamageActorValue("Health", DamageDealt)HitActor.Clear();ShouldThrow.SetValue(0)Clear()else ;this is basically a catch all for if, for example, the player lets go of the spell, and there is no hitactor selected or;whatever. Should make whatever you're manipulating fall to the ground. I only want a direct clear statement if all of the;above if statements have failed, not the moment that the hitactor alias is filled.Clear()endIfendEventevent OnUpdate() ;this is an experiment I tried. I realized that while I can't seem to get Thrown.GetReference() to translate;properly from the other script, I could update (tested with a PlayerREF.KillSilent(), which executed.) the alias. This too,;however, did not execute.GetReference().TranslateTo(GetReference().GetPositionX(), GetReference().GetPositionY(), (GetReference().GetPositionZ() + 64), 0, 0, 0, 10, 128)endEvent