Jump to content

Teleport combat script


morismark

Recommended Posts

I need help to find issues that causes skyrim crash.

with pyrotx Sky Ai Teleporting NPCs at Skyrim Nexus - Mods and Community permission, I used him script to an NPC.

This script is for NPC to use teleport in combat.

I have two problems:

 

1) The script works well, but it, than after minutes of combat, crash the game. I'm sure of it, because without spel scripted base, the game doesn'tcrash.

I've tried to set minium telport activation, but nothing.

 

this is him script:

Scriptname teleportability extends activeMagicEffect

import Game
Import Utility

;=========================================================================================
; PROPERTIES
;============================

Activator property teleportActivator Auto
{The activator that will be placed and teleported to}
Activator property TeleportFXStart Auto
{The Fx that will be placed before teleporting}
Activator property TeleportFXFinish Auto
{The Fx that will be placed after teleporting}

Int Property TeleportChance = 20 Auto
{The Chance that an NPC will be able to use this ability (Default 20) + 2/3's of the NPC's Level}
Int Property TeleportChanceHit = 60 Auto
{If allowed to teleport at all, this is the chance to be allowed to teleport by being hit (Default 60)}
Int Property TeleportChanceTimed = 60 Auto
{If allowed to teleport at all, this is the chance to be allowed to teleport on a timer (Default 60)}

Int Property CountMin = 3 Auto
{Minimum number of times the script updates before teleporting (Default 3)}
Int Property CountMax = 7 Auto
{Maximum number of times the script updates before teleporting (Default 7)}

Int Property HitCountMin = 2 Auto
{Minimum number of hits until teleport (Default 3)}
Int Property HitCountMax = 7 Auto
{Maximum number of hits until teleport (Default 7)}
Float Property UpdateTime = 2.5 Auto
{How often the script updates (Default 2.5 seconds)}
Float Property fRadius = 2048.0 Auto
{Radius to search for a teleport point (2048.0 Auto)}

Bool Property bTimebased = True Auto
{Allows user to teleport after the script updates a certain number of times. (Default True)}
Bool Property bHitbased = True Auto
{Allows user to teleport after being hit a certain number of times. (Default True)}

;=========================================================================================
; VARIABLES
;============================

ObjectReference ActivatorRef
ObjectReference casterRef
ObjectReference FXStartLoc
ObjectReference FXFinishLoc
ObjectReference targetLoc
actor caster

int RandTeleport
int RandTeleportHit
int RandTeleportTimed
int hitCount
int updateCounter
int teleportTimed
int teleportHit
int level

;=========================================================================================
; EVENTS
;============================

Event OnEffectStart(Actor akTarget, Actor akCaster)
caster = akCaster
casterRef = (caster as ObjectReference)
level = (caster.getLevel() * 2/3)
RandTeleport = Utility.RandomInt(0,100)
if RandTeleport <=(TeleportChance + (level as Int))
ActivatorRef = casterRef.placeAtMe(teleportActivator)
RandTeleportHit = Utility.RandomInt(0,100)
RandTeleportTimed = Utility.RandomInt(0,100)

if RandTeleportHit <= TeleportChanceHit
bHitBased = true
elseIf RandTeleportHit > TeleportChanceHit
bHitBased = false
endIf

if RandTeleportTimed <= TeleportChanceTimed
bTimeBased = true
elseIf RandTeleportTimed > TeleportChanceTimed
bTimeBased = false
endIf

if bTimeBased == true
updateCounter = 0
teleportTimed = Utility.RandomInt(CountMin, CountMax)
endIf
if bHitBased == true
hitCount = 0
teleportHit = Utility.RandomInt(HitCountMin, HitCountMax)
endIf
if bHitBased == True || bTimeBased == True
registerForSingleUpdate(0.5)
endIf
endIf
EndEvent

Event OnUpdate()
ActivatorRef = casterRef.placeAtMe(teleportActivator)
if caster.isInCombat() && caster.isDead() == false
if bTimeBased == True
updateCounter+= 1
If updateCounter >= teleportTimed
Teleport()
updateCounter = 0
teleportTimed = Utility.RandomInt(CountMin, CountMax)
endif
endIf
ActivatorRef
registerForSingleUpdate(UpdateTime)
endIf
EndEvent

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
if bHitbased == True
HitCount += 1
if HitCount >= TeleportHit
Teleport()
HitCount = 0
if updateCounter != 0
updateCounter -= 1
endIf
teleportHit = Utility.RandomInt(HitCountMin, HitCountMax)
endIf
endIf
EndEvent

Function Teleport()
targetLoc = Game. FindRandomReferenceOfTypeFromRef(TeleportActivator, casterRef, fRadius)
FXStartLoc = casterRef.placeAtMe(TeleportFXStart)
FXFinishLoc = targetLoc.placeAtMe(TeleportFXFinish)
FXStartLoc
targetLoc
FXFinishLoc
casterRef.moveTo(targetLoc)
EndFunction


 


2) The ability effect works only if NPC have few spell/shout. I don't know how is possible Because it doesnt' dependent from number of spell simply because it is an ability.

 

 

How can I solve?

Edited by morismark
Link to comment
Share on other sites

For the first point, CTD game, this is papyrus log:

 


stack:
[None].MannequinActivatorSCRIPT.Is3DLoaded() - "" Line ?
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Warning: Assigning None to a non-object variable named "::temp15"
stack:
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] FNIS aa SetAnimGroup mod: CombatFatigue actor: [ActorBase < (1F2BEDAA)>] group: _bowidle base: 1 number: 0
[01/02/2021 - 06:44:15PM] Error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect type
stack:
[None].MannequinActivatorSCRIPT.Is3DLoaded() - "" Line ?
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Warning: Assigning None to a non-object variable named "::temp15"
stack:
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect type
stack:
[None].MannequinActivatorSCRIPT.Is3DLoaded() - "" Line ?
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Warning: Assigning None to a non-object variable named "::temp15"
stack:
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Error: Failed to setup moving reference because it has no parent cell or no 3D
stack:
[ (FF0008CC)].ObjectReference.TranslateTo() - "" Line ?
[ (FF0008CC)].ObjectReference.TranslateToRef() - "ObjectReference.psc" Line 583
[ (5700F644)].kata_TimeAndSpace_TrialMaster.OnUpdate() - "kata_TimeAndSpace_TrialMaster.psc" Line 192
[01/02/2021 - 06:44:15PM] Error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect type
stack:
[None].MannequinActivatorSCRIPT.Is3DLoaded() - "" Line ?
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Warning: Assigning None to a non-object variable named "::temp15"
stack:
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect type
stack:
[None].MannequinActivatorSCRIPT.Is3DLoaded() - "" Line ?
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Warning: Assigning None to a non-object variable named "::temp15"
stack:
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Warning: (FF0008CC): Ref is in an unloaded cell, so it cannot cast spells..
stack:
[ (00045F9D)].SPELL.Cast() - "" Line ?
[ (5700F644)].kata_TimeAndSpace_TrialMaster.OnUpdate() - "kata_TimeAndSpace_TrialMaster.psc" Line 194
[01/02/2021 - 06:44:15PM] Error: Unable to call Is3DLoaded - no native object bound to the script object, or object is of incorrect type
stack:
[None].MannequinActivatorSCRIPT.Is3DLoaded() - "" Line ?
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108
[01/02/2021 - 06:44:15PM] Warning: Assigning None to a non-object variable named "::temp15"
stack:
[None].MannequinActivatorSCRIPT.ResetPosition() - "MannequinActivatorSCRIPT.psc" Line 184
[None].MannequinActivatorSCRIPT.OnCellLoad() - "MannequinActivatorSCRIPT.psc" Line 108

 

Edited by morismark
Link to comment
Share on other sites

  • Recently Browsing   0 members

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