Jump to content

Need Scripting Help


apocalypse1138

Recommended Posts

I also have a few new problems...

Re-equipping in water stacks +100 change

No matter what, my speed is 0 upon load

 

script, as usual

scn SwiftSwimItem
short worn
short origValue
short origval2
Begin OnEquip Player
set origvalue to player.GetActorValue speed
set origval2 to origValue + 100
Message "You can now swim faster!", 5
set worn to 1
end
begin gamemode
If PLayer.IsSwimming == 1
Player.SetActorValue speed origval2
Elseif player.ISSwimming == 0
Player.SetActorValue speed origValue
EndIf
End

Begin OnUnEquip Player
if worn == 1
Player.SetActorValue speed orifvalue
Message "You can no longer swim as fast...", 5
set worn to 0
endif
End
Begin OnDrop Player
if worn == 1
Player.SetActorValue speed oigvalue
set worn to 0
endif
end

 

You got a couple spelling mistakes on variables, that might be the reason it's stacking (not reverting to the original value). Also, you don't necessarily need the elseif in the gamemode block, an else statement would work better (less code to right). That part would look something like this:

 

If player.IsSwimming == 1

Player.SetActorValue speed origval2

Else

Player.SetActorValue speed origValue

EndIf

Link to comment
Share on other sites

Well the spelling mistakes that I made were due to fast typing, and if I made those same mistakes in the script, it won't save it. (know from experience). It seems to work backwards now... when unequipped, it speeds up, when equipped, it slows down...
Link to comment
Share on other sites

Try this....

 

scn SwiftSwimItem

short worn
short origValue
short origval2
ref tempref

Begin OnEquip Player
If worn == 0
set tempref to player
set origvalue to player.GetActorValue speed
set origval2 to origValue + 100
Message "You can now swim faster!", 5
set worn to 1
endif
end

begin gamemode
If worn == 1
If PLayer.IsSwimming == 1
	Player.SetActorValue speed origval2
Else
	set tempRef to GetContainer
	tempRef.unequipitem  ( Your Item without the )and( )
Endif
Endif
End

Begin OnUnEquip Player
if worn == 1
Player.SetActorValue speed origvalue
Message "You can no longer swim as fast...", 5
set worn to 0
endif
End

Begin OnDrop Player
if worn == 1
Player.SetActorValue speed origvalue
set worn to 0
endif
end

Link to comment
Share on other sites

On the title question, your can change it a custom title in the user control panel....but not until you have reached 500 posts.

 

Buddah

Link to comment
Share on other sites

About the unequip outside of the water...I though you wanted it to be ?

 

At least that seemed to be the intention?

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

Nevermind ;)

Link to comment
Share on other sites

On the title question, your can change it a custom title in the user control panel....but not until you have reached 500 posts.

 

Buddah

Thanks buddah! Looks like we finally got it figured out here...On our very own TESNexus forums! The item and all of the scripting works without a hitch, here is the final script...

scn SwiftSwimItem
short worn
float origValue
float origval2
ref tempref

Begin OnEquip Player
If worn == 0
set origValue to player.GetActorValue speed
set origval2 to origValue + 100
Message "You can now swim faster!", 5
set worn to 1
endif
end

begin gamemode
If worn == 1
If Player.IsSwimming == 1
 Player.SetActorValue speed origValue2
Else
Player.SetActorValue speed origValue
EndIf
EndIF
End

Begin OnUnEquip Player
If worn == 1
 Player.SetActorValue speed origValue
 Message "You can no longer swim as fast...", 5
 set worn to 0
EndIf
end

Begin OnDrop Player
if worn == 1
Player.SetActorValue speed origValue
set worn to 0
endif 
end

Thank you everyone who helped me on this, as there are quite a few of you who contributed greatly.

Hopefully everyone who reads this learns something.

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...