Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Casting a spell upon weapon swing?


b133d_4_u
 Share

Recommended Posts

I'm trying to create a mod where the weapon i made fires 1-3 spells i made upon swinging. here's what ive got so far from the bethesda tutorial wiki: import Utility Actor Property PlayerREF Auto Float Property xOffset Auto Float Property yOffset Auto Float Property zOffset Auto Float Property RandomOffsetX Auto Float Property RandomOffsetY Auto Float Property RandomOffsetZ Auto Float Property PulseRate = 1.0 Auto Float Property RandomRate Auto Activator Property TargetType Auto ObjectReference Property CurrentTarget Auto Bool Property SpawnNode Auto Spell Property TierHarribelCortandoSpell Auto FormList Property TargetTypeList Auto Float Property SeekRange = 1000.0 Auto Event OnInit() if CurrentTarget elseIf SpawnNode float newXOffset = XOffSet + RandomFloat(-RandomOffsetX, RandomOffsetX) float newYOffset = YOffSet + RandomFloat(-RandomOffsetY, RandomOffsetY) float newZOffset = ZOffSet + RandomFloat(-RandomOffsetZ, RandomOffsetZ) CurrentTarget = PlaceAtme(TargetType) CurrentTarget.MoveTo(Self, newXOffSet, newYOffSet, newZOffSet) endif RegisterForSingleUpdate(PulseRate) EndEvent Event OnUpdate() if !SpawnNode && !TargetTypeList && GetDistance(PlayerREF) < SeekRange CurrentTarget = PlayerREF elseif TargetTypeList CurrentTarget = Game.FindClosestReferenceOfAnyTypeInListfromRef(TargetTypeList, Self, SeekRange) endif if CurrentTarget TierHarribelCortandoSpell.Cast(Self,CurrentTarget) endif RegisterForSingleUpdate(PulseRate + RandomFloat(0.0, RandomRate)) EndEvent it wont work,so can someone tell me whats wrong?TierHarribelCortandoSpell is the editor id of the spell

Link to comment
Share on other sites

I'm trying to create a mod where the weapon i made fires 1-3 spells i made upon swinging. here's what ive got so far from the bethesda tutorial wiki: import Utility Actor Property PlayerREF Auto Float Property xOffset Auto Float Property yOffset Auto Float Property zOffset Auto Float Property RandomOffsetX Auto Float Property RandomOffsetY Auto Float Property RandomOffsetZ Auto Float Property PulseRate = 1.0 Auto Float Property RandomRate Auto Activator Property TargetType Auto ObjectReference Property CurrentTarget Auto Bool Property SpawnNode Auto Spell Property TierHarribelCortandoSpell Auto FormList Property TargetTypeList Auto Float Property SeekRange = 1000.0 Auto Event OnInit() if CurrentTarget elseIf SpawnNode float newXOffset = XOffSet + RandomFloat(-RandomOffsetX, RandomOffsetX) float newYOffset = YOffSet + RandomFloat(-RandomOffsetY, RandomOffsetY) float newZOffset = ZOffSet + RandomFloat(-RandomOffsetZ, RandomOffsetZ) CurrentTarget = PlaceAtme(TargetType) CurrentTarget.MoveTo(Self, newXOffSet, newYOffSet, newZOffSet) endif RegisterForSingleUpdate(PulseRate) EndEvent Event OnUpdate() if !SpawnNode && !TargetTypeList && GetDistance(PlayerREF) < SeekRange CurrentTarget = PlayerREF elseif TargetTypeList CurrentTarget = Game.FindClosestReferenceOfAnyTypeInListfromRef(TargetTypeList, Self, SeekRange) endif if CurrentTarget TierHarribelCortandoSpell.Cast(Self,CurrentTarget) endif RegisterForSingleUpdate(PulseRate + RandomFloat(0.0, RandomRate)) EndEvent it wont work,so can someone tell me whats wrong?TierHarribelCortandoSpell is the editor id of the spell

Could you reorganize that script and put it in a code box?

Link to comment
Share on other sites

How's this?

 

Scriptname TierHarribelSpellScript extends ObjectReference
 
import Utility
Actor Property PlayerREF Auto
Float Property xOffset Auto
Float Property yOffset Auto
Float Property zOffset Auto
Float Property RandomOffsetX Auto
Float Property RandomOffsetY Auto
Float Property RandomOffsetZ Auto
Float Property PulseRate = 1.0 Auto
Float Property RandomRate Auto
Activator Property TargetType Auto
ObjectReference Property CurrentTarget Auto
Bool Property SpawnNode Auto
Spell Property TierHarribelCortandoSpell Auto
FormList Property TargetTypeList Auto
Float Property SeekRange = 1000.0 Auto
 
Event OnInit()
if CurrentTarget ;!= None
elseIf SpawnNode
float newXOffset = XOffSet + RandomFloat(-RandomOffsetX, RandomOffsetX)
float newYOffset = YOffSet + RandomFloat(-RandomOffsetY, RandomOffsetY)
float newZOffset = ZOffSet + RandomFloat(-RandomOffsetZ, RandomOffsetZ)
CurrentTarget = PlaceAtme(TargetType)
CurrentTarget.MoveTo(Self, newXOffSet, newYOffSet, newZOffSet)
endif
RegisterForSingleUpdate(PulseRate)
EndEvent
 
Event OnUpdate()
if !SpawnNode && !TargetTypeList && GetDistance(PlayerREF) < SeekRange
    CurrentTarget = PlayerREF
elseif TargetTypeList
CurrentTarget = Game.FindClosestReferenceOfAnyTypeInListfromRef(TargetTypeList, Self, SeekRange)
endif
if CurrentTarget
TierHarribelCortandoSpell.Cast(Self,CurrentTarget)
endif
RegisterForSingleUpdate(PulseRate + RandomFloat(0.0, RandomRate))
EndEvent

Edited by b133d_4_u
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...