Jump to content

Same Script, New Problems


Launius

Recommended Posts

At least I'm not crashing the game anymore with my lame scripting capabilities, but I still can't get this script to do what I want it to.

The plan is: as the timer gets higher, the spells get stronger, until the spells are strongest, in which case they will stop until a certain spell is cast, then the process repeats.

What is happening: the spells are not being added at all.

Anyone care to look over this and share their thoughts?

 

Scriptname CursedArmor002Script

float timer
float graverot

Begin OnEquip player
While (timer)
	Set timer to 0
	Set timer to getsecondspassed
		if (timer >= 120)
			Set timer to 0
		endif
Loop
End

---------------------------------------------------------------------------------------------------------------------------------------------

Begin OnEquip player

player.AddSpell AbCursedArmor
player.AddItemNS SkeletonHead 1
player.EquipItemNS SkeletonHead 1
player.SetFactionRank 0009DB1F 0
player.SetFactionRank 0009DB1F -1
player.SetFactionRank 0009DB1F 0
MessageBox "The strange curse takes hold of your body."	

While (timer)
if (timer <= 20)
	Set GraveRot to 1
elseif (timer <= 40) && (timer >= 20)
	Set GraveRot to 2
elseif (timer <= 60) && (timer >= 40)
	Set GraveRot to 3
elseif (timer <= 80) && (timer >= 60)
	Set GraveRot to 4
elseif (timer <= 100) && (timer >= 80)
	Set GraveRot to 5
elseif (timer <= 120) && (timer >=100)
	Set GraveRot to 6
endif
Loop

While (GraveRot)
if ( GraveRot <= 1 )
	if (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor001
	endif
elseif ( GraveRot >= 1 )
	if (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor002
		player.addspell CursedArmorSpell002
	endif
elseif ( GraveRot == 2 )
	if (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor002
		player.addspell CursedArmorSpell002
	endif
elseif ( GraveRot == 3 )
	if (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor003
		player.addspell CursedArmorSpell003
	endif
elseif ( GraveRot == 4 )
	if (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor004
		player.addspell CursedArmorSpell004
	endif
elseif ( GraveRot == 5 )
	if (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor005
		player.addspell CursedArmorSpell005
	endif
elseif ( GraveRot == 6 )
	if (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor006
		player.addspell CursedArmorSpell006
	endif
endif
Loop
End

---------------------------------------------------------------------------------------------------------------------------------------------

Begin OnUnequip player

player.RemoveSpell CursedArmorSpell006
player.RemoveSpell CursedArmorSpell005
player.RemoveSpell CursedArmorSpell004
player.RemoveSpell CursedArmorSpell003
player.RemoveSpell CursedArmorSpell002
player.RemoveSpell AbCursedArmor
player.UnequipItemNS SkeletonHead
player.RemoveItemNS SkeletonHead 1
player.SetFactionRank 0009DB1F 0
player.SetFactionRank 0009DB1F -1

End

Link to comment
Share on other sites

I believe the problem is the Begin OnEquip block. Begin OnEquip runs once when the object is equipped. You'll need to use a GameMode block with a timer if you want the script to continually update. It will also need to check if the Player has the cursed armor equipped.
Link to comment
Share on other sites

I've got it to add the spell once, but I couldn't get the effect to loop. This is how it looked when I started with GameMode.

 

Scriptname CursedArmor002Script

float timer

Begin GameMode

While (timer)
if (player.GetEquipped CursedArmor001 == 1)
	Set timer to 0
	Set timer to getsecondspassed
	if (timer <= 20) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor001
	elseif (timer <= 40) && (timer >= 20) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor002
		player.addspell CursedArmorSpell002
	elseif (timer <= 60) && (timer >= 40) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor003
		player.addspell CursedArmorSpell003
	elseif (timer <= 80) && (timer >= 60) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor004
		player.addspell CursedArmorSpell004
	elseif (timer <= 100) && (timer >= 80) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor005
		player.addspell CursedArmorSpell005
	elseif (timer <= 120) && (timer >=100) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor006
		player.addspell CursedArmorSpell006
		Set timer to 0
	endif
endif
Loop

End

---------------------------------------------------------------------------------------------------------------------------------------------

Begin OnEquip player

player.AddSpell AbCursedArmor
player.AddItemNS SkeletonHead 1
player.EquipItemNS SkeletonHead 1
player.SetFactionRank 0009DB1F 0
player.SetFactionRank 0009DB1F -1
player.SetFactionRank 0009DB1F 0
MessageBox "The strange curse takes hold of your body."	

End

---------------------------------------------------------------------------------------------------------------------------------------------

Begin OnUnequip player

player.RemoveSpell CursedArmorSpell006
player.RemoveSpell CursedArmorSpell005
player.RemoveSpell CursedArmorSpell004
player.RemoveSpell CursedArmorSpell003
player.RemoveSpell CursedArmorSpell002
player.RemoveSpell AbCursedArmor
player.UnequipItemNS SkeletonHead
player.RemoveItemNS SkeletonHead 1
player.SetFactionRank 0009DB1F 0
player.SetFactionRank 0009DB1F -1

End

Edited by Launius
Link to comment
Share on other sites

There are a couple of things wrong that I can see right off the bat.

 

1. You should not be using a loop for this.

 

2. The way you're trying to set the timer is wrong.

 

Change your GameMode block to this:

 

Begin GameMode

if (player.GetEquipped CursedArmor001 == 1)
	set timer to timer + getsecondspassed
	if (timer <= 20) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor001
	elseif (timer <= 40) && (timer >= 20) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor002
		player.addspell CursedArmorSpell002
	elseif (timer <= 60) && (timer >= 40) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor003
		player.addspell CursedArmorSpell003
	elseif (timer <= 80) && (timer >= 60) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor004
		player.addspell CursedArmorSpell004
	elseif (timer <= 100) && (timer >= 80) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor005
		player.addspell CursedArmorSpell005
	elseif (timer <= 120) && (timer >=100) && (player.IsSpellTarget CursedArmorSpell006 != 1)
		player.addspell DisCursedArmor006
		player.addspell CursedArmorSpell006
		Set timer to 0
	endif
endif

End

Link to comment
Share on other sites

  • Recently Browsing   0 members

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