Jump to content

ughfhhyg4555786

Premium Member
  • Posts

    52
  • Joined

  • Last visited

Everything posted by ughfhhyg4555786

  1. I'm so glad finally get some help with it. I do really appreciate maxarturo and dylbill both of your help. I will try them to see if they will work.
  2. I have to mention this before getting to the topic. I referred Beyond Reach ( https://www.nexusmods.com/skyrim/mods/48467 ) and VIGILANT ( https://www.nexusmods.com/skyrim/mods/67103 ) to make my new script, so the style and variable name were same as the author used in their script. As my topic, the turret sometimes won't fire, or fire in wrong time (I set to fire for every 1 seconds while the magic effect is activated, but it sometimes takes 3 - 5 seconds). I assumed this was because the enemies were not in searching area, so I tried to increase the search radius and made enemies as close as possible to the turret. However, the turret sometimes cast spell on enemy, but sometimes not..... I tried to use CasterActor.GetCombatTarget() instead using FindRandomActorFromRef. I tried to put CasterActor.GetCombatTarget() in Event OnEffectStart. This only worked for one enemy. If the magic effect have already started, the turret will not change target even if my front sight cross is pointing another enemy. In addition, if the enemy target is not being pointed by front sight cross before magic effect begin, then the turret will cast spell somewhere else rather than enemy target even if you later then point out the front sight cross to a enemy target. (I guess the direction of magic projectile depend on how I set the angle of the turret, but I have no clue of this even if I have read the Creation Kit wiki) I also tried to put CasterActor.GetCombatTarget() in Event OnUpdate. And then I have to keep my front sight cross to be pointed to a one of enemy target. If there is no actor that is being pointed during the magic effect, the turret will cast spell somewhere else............ I think the FindRandomActorFromRef is better than CasterActor.GetCombatTarget() only the time issue can be fixed...... (Therefore, I do need help with this and I do really appreciate you take time to read this long post and your advices). Below is the script: import weatherimport utilityimport game;======================================================================================;; PROPERTIES /;=============/Float Property CastHeight = 256.0 autoFloat Property fBaseRandom = 512.0 autoFloat Property fBaseTime = 1.0 autoFloat Property SpellRadius = 2000.0 auto activator property PlacedActivator auto Spell property SpellRef auto ;======================================================================================;; VARIABLES /;=============/ objectReference ActivatorRef3 bool KeepUpdating = trueActor CasterActorActor TargetActorFloat PosX Float PosY Float PosZ Float TPosX Float TPosY Float TPosZ Actor playerActor Enemy ;======================================================================================;; EVENTS /;=============/ Event OnEffectStart(Actor Target, Actor Caster)CasterActor = CasterTargetActor = Target ActivatorRef3 = TargetActor.placeAtMe(PlacedActivator)PosX = TargetActor.GetPositionX()PosY = TargetActor.GetPositionY()PosZ = TargetActor.GetPositionZ()ActivatorRef3.SetPosition(PosX,PosY,PosZ) PosZ = (PosZ + CastHeight)ActivatorRef3.SetPosition(PosX,PosY,PosZ)ActivatorRef3.SetAngle(0,0,0) RegisterForSingleUpdate(0.5)EndEvent Event OnUpdate()Enemy = CasterActor.GetCombatTarget()If Enemy == none elseIf Enemy != CasterActor && Enemy.Ishostiletoactor(CasterActor) && Enemy.Isdead() != 1 && ActivatorRef3.isdisabled() != 1SpellRef.remotecast(ActivatorRef3, CasterActor, Enemy)endif RegisterForSingleUpdate(fBaseTime)endEvent Event OnEffectFinish(Actor Target, Actor Caster)if ActivatorRef3 != noneActivatorRef3.disable()ActivatorRef3.delete()endifEndEvent
×
×
  • Create New...