Jump to content

Magic scripting problem


the_j_1986

Recommended Posts

Ok, this has me stumped. The script compiles, all of the debug messages appear, but nothing seems to happen. I double checked everything, and it should work. It's supposed to create an activator in a random spot around the place the spell was cast, then make another activator 1000 units above that one, and have the top activator cast a spell at the bottom activator. It is supposed to do this once, then do it again between 0 and .5 seconds later. Anyway, here's the script:

 

scn MySpell

short xpos
short ypos
short zpos

short xmod
short ymod
short zmod

int NorP; negitive or positive

short time
short do

ref bottom
ref top

int debug1
int debug2
int debug3

Begin ScriptEffectStart

if isInInterior == 1
	Message "This spell does not work in interiors"
	set do to 1
else
	set xpos to player.getPos x
	set ypos to player.getPos y
	set zpos to player.getPos z
	set zmod to zpos + 1000
	set time to 0
	set do to 0
endif

End

Begin ScriptEffectUpdate

if do == 1
	return
else
	if time > 0
		set time to time - getSecondsPassed

	else
		set NorP to 0.02 * GetRandomPercent
		set xmod to 2133/99 * GetRandomPercent
		if NorP == 1
			set xmod to xmod * -1
		endif

		set NorP to 0.02 * GetRandomPercent
		set ymod to 2133/99 * GetRandomPercent
		if NorP == 1
			set ymod to ymod * -1
		endif

		if debug1 == 0
			Message "Debug 1"
			set debug1 to 1
		endif

		set xmod to xpos + xmod
		set ymod to ypos + ymod

		set bottom to player.placeatme MCANull 1, 0, 0
		bottom.setPos x, xmod
		bottom.setPos y, ymod
		bottom.setPos z, zpos

		set top to bottom.placeatme MCANull 1, 0, 0
		top.setPos z, zmod

		top.cast MyOtherSpell bottom

		if debug2 == 0
			Message "Debug 2"
			set debug2 to 1
		endif

		top.removeme
		top.disable
		top.deletefullactorcopy
		bottom.removeme
		bottom.disable
		bottom.deletefullactorcopy
		set time to .5 * GetRandomPercent

		if debug3 == 0
			Message "Debug 3"
			set debug3 to 1
		endif

	endif
endif

End

 

Anyone have any ideas?

 

Omegano

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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