Jump to content

onHit() and InterruptCast()


Hangman4358

Recommended Posts

ok, so i am building a part of a dungeun where the player has to clear the way for a magic beam to hit a magic barrier and this will then remove the barrier and stop the beam from going.

 

Here is the script I have come up with. It is engineered off of the scripts for the beams in the one Deadric Prince quest where you go into the temple and guide the beam.

 

 

Scriptname OAQ01ValuungrannBarrierColSCRIPT extends ObjectReference  
import Debug
import Utility

spell Property beamSpell Auto 
{BASEOBJECT: pointer to beam spell}



objectReference Property beamSource Auto
{source of the light beam}

objectReference Property beamTarget Auto
{what you want the beam to shoot at}

objectReference Property barrierActivator Auto
{activates the barriers to drop}

float Property waitTimeBeam = 1.5 Auto
{Delay after translation to fire the beam effect DEFAULT = 1.5}


Sound Property soundStart  Auto
{beam Start sound}

Sound Property soundEnd  Auto
{beam Start sound}


event onCellLoad()
fireBeam()
endEvent

Event onHit(ObjectReference akAgressor, Form beamSpell, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack,  bool abBashAttack, bool abHitBlocked)
	shakeCamera()
	wait(waitTimeBeam)
	BarrierActivator.activate(game.GetPlayer())
	endBeam()
	self.delete()
endEvent

function fireBeam()
beamSpell.cast(BeamSource, beamTarget)
SoundStart.play(self)  
endFunction

function shakeCamera()
Game.ShakeCamera(afStrength = 0.1, afDuration = 1.8)
endFunction

function endBeam()
;beamSpell.InterruptCast()
SoundEnd.play(self)
endFunction

 

 

I have two problems. The onHit() will compile, but when I make it so that the beam does hit the barrier, it actually does not do anything. the event does not trigger. The second thing is, I want the beam to stop once barrier is hit but when i use the InterruptCast() like I did the cast() the script will not compile. So what am I doing wrong here?

Edited by Hangman4358
Link to comment
Share on other sites

For interuptCast, the spell isn't an Object Reference, so you can't use it. Instead of beamSpell.InterruptCast(), try BeamSource.InterruptCast().

 

As for OnHit(), I guess it depends on what you have this script attached to. The object that has this script isn't being hit, so the OnHit() isn't triggering.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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