Jump to content

Item Auto-level script


Galiphile

Recommended Posts

Hello again, all:

 

I'm working on a mod for myself, featuring recycled textures from other mods that I wanted to put together. Now, I have created all the various weapon levels, and created a leveled item list. I'm using the following script to get the various items to level:

 

 

scn BItemUpdate

short LVL
short NotPerform

Begin GameMode

if ( LVL != player.getlevel )
	set LVL to player.getlevel
	set NotPerform to 0
endif

if ( player.IsRidingHorse == 0 && NotPerform == 0 )
	if ( player.getitemcount BMHScimitar01 > 0 && LVL >= 3 )
		if ( player.getequipped BMHScimitar01 == 1 )
			player.unequipitem BMHScimitar01
			player.removeitem BMHScimitar01 1
			player.additem BMHScimitarLeveled 1
			player.equipitem BMHScimitar03
			player.equipitem BMHScimitar06
			player.equipitem BMHScimitar09
			player.equipitem BMHScimitar12
			player.equipitem BMHScimitar15
			player.equipitem BMHScimitar20
			player.equipitem BMHScimitar30
			player.unequipitem BOHScimitar01
			player.removeitem BOHScimitar01 1
			player.additem BOHScimitarLeveled 1
			player.equipitem BOHScimitar03
			player.equipitem BOHScimitar06
			player.equipitem BOHScimitar09
			player.equipitem BOHScimitar12
			player.equipitem BOHScimitar15
			player.equipitem BOHScimitar20
			player.equipitem BOHScimitar30
			player.unequipitem BClothing01
			player.removeitem BClothing01 1
			player.additem BClothingLeveled 1
			player.equipitem BClothing03
			player.equipitem BClothing06
			player.equipitem BClothing09
			player.equipitem BClothing12
			player.equipitem BClothing15
			player.equipitem BClothing20
			player.equipitem BClothing30
			player.unequipitem BHat01
			player.removeitem BHat01 1
			player.additem BHatLeveled 1
			player.equipitem BHat03
			player.equipitem BHat06
			player.equipitem BHat09
			player.equipitem BHat12
			player.equipitem BHat15
			player.equipitem BHat20
			player.equipitem BHat30
			player.unequipitem BHandgun01
			player.removeitem BHandgun01 1
			player.additem BHandgunLeveled 1				
		else
			player.removeitem BMHScimitar01 1
			player.additem BMHScimitarLeveled 1
		endif
	elseif ( player.getitemcount BMHScimitar03 > 0 && LVL >= 6 )
		if ( player.getequipped BMHScimitar03 == 1 )
			player.unequipitem BMHScimitar03
			player.removeitem BMHScimitar03 1
			player.additem BMHScimitarLeveled 1
			player.equipitem BMHScimitar06
			player.equipitem BMHScimitar09
			player.equipitem BMHScimitar12
			player.equipitem BMHScimitar15
			player.equipitem BMHScimitar20
			player.equipitem BMHScimitar30
			player.unequipitem BOHScimitar03
			player.removeitem BOHScimitar03 1
			player.additem BOHScimitarLeveled 1
			player.equipitem BOHScimitar06
			player.equipitem BOHScimitar09
			player.equipitem BOHScimitar12
			player.equipitem BOHScimitar15
			player.equipitem BOHScimitar20
			player.equipitem BOHScimitar30
			player.unequipitem BClothing03
			player.removeitem BClothing03 1
			player.additem BClothingLeveled 1
			player.equipitem BClothing06
			player.equipitem BClothing09
			player.equipitem BClothing12
			player.equipitem BClothing15
			player.equipitem BClothing20
			player.equipitem BClothing30
			player.unequipitem BHat03
			player.removeitem BHat03 1
			player.additem BHatLeveled 1
			player.equipitem BHat06
			player.equipitem BHat09
			player.equipitem BHat12
			player.equipitem BHat15
			player.equipitem BHat20
			player.equipitem BHat30
			player.unequipitem BHandgun03
			player.removeitem BHandgun03 1
			player.additem BHandgunLeveled 1				
		else
			player.removeitem BMHScimitar03 1
			player.additem BMHScimitarLeveled 1
		endif
	elseif ( player.getitemcount BMHScimitar06 > 0 && LVL >= 9 )
		if ( player.getequipped BMHScimitar06 == 1 )
			player.unequipitem BMHScimitar06
			player.removeitem BMHScimitar06 1
			player.additem BMHScimitarLeveled 1
			player.equipitem BMHScimitar09
			player.equipitem BMHScimitar12
			player.equipitem BMHScimitar15
			player.equipitem BMHScimitar20
			player.equipitem BMHScimitar30
			player.unequipitem BOHScimitar06
			player.removeitem BOHScimitar06 1
			player.additem BOHScimitarLeveled 1
			player.equipitem BOHScimitar09
			player.equipitem BOHScimitar12
			player.equipitem BOHScimitar15
			player.equipitem BOHScimitar20
			player.equipitem BOHScimitar30
			player.unequipitem BClothing06
			player.removeitem BClothing06 1
			player.additem BClothingLeveled 1
			player.equipitem BClothing09
			player.equipitem BClothing12
			player.equipitem BClothing15
			player.equipitem BClothing20
			player.equipitem BClothing30
			player.unequipitem BHat06
			player.removeitem BHat06 1
			player.additem BHatLeveled 1
			player.equipitem BHat09
			player.equipitem BHat12
			player.equipitem BHat15
			player.equipitem BHat20
			player.equipitem BHat30
			player.unequipitem BHandgun06
			player.removeitem BHandgun06 1
			player.additem BHandgunLeveled 1				
		else
			player.removeitem BMHScimitar06 1
			player.additem BMHScimitarLeveled 1
		endif
	elseif ( player.getitemcount BRing01 > 0 && LVL >= 10 )
		if ( player.getequipped BRing01 == 1 )
			player.unequipitem BRing01
			player.removeitem BRing01 1
			player.additem BRingLeveled 1
			player.equipitem BRing10
			player.equipitem BRing20
			player.equipitem BRing30			
		else
			player.removeitem BRing01 1
			player.additem BRingLeveled 1
		endif
	elseif ( player.getitemcount BMHScimitar09 > 0 && LVL >= 12 )
		if ( player.getequipped BMHScimitar09 == 1 )
			player.unequipitem BMHScimitar09
			player.removeitem BMHScimitar09 1
			player.additem BMHScimitarLeveled 1
			player.equipitem BMHScimitar12
			player.equipitem BMHScimitar15
			player.equipitem BMHScimitar20
			player.equipitem BMHScimitar30
			player.unequipitem BOHScimitar09
			player.removeitem BOHScimitar09 1
			player.additem BOHScimitarLeveled 1
			player.equipitem BOHScimitar12
			player.equipitem BOHScimitar15
			player.equipitem BOHScimitar20
			player.equipitem BOHScimitar30
			player.unequipitem BClothing09
			player.removeitem BClothing09 1
			player.additem BClothingLeveled 1
			player.equipitem BClothing12
			player.equipitem BClothing15
			player.equipitem BClothing20
			player.equipitem BClothing30
			player.unequipitem BHat09
			player.removeitem BHat09 1
			player.additem BHatLeveled 1
			player.equipitem BHat12
			player.equipitem BHat15
			player.equipitem BHat20
			player.equipitem BHat30
			player.unequipitem BHandgun09
			player.removeitem BHandgun09 1
			player.additem BHandgunLeveled 1				
		else
			player.removeitem BMHScimitar09 1
			player.additem BMHScimitarLeveled 1
		endif
	elseif ( player.getitemcount BMHScimitar12 > 0 && LVL >= 15 )
		if ( player.getequipped BMHScimitar12 == 1 )
			player.unequipitem BMHScimitar12
			player.removeitem BMHScimitar12 1
			player.additem BMHScimitarLeveled 1
			player.equipitem BMHScimitar15
			player.equipitem BMHScimitar20
			player.equipitem BMHScimitar30
			player.unequipitem BOHScimitar12
			player.removeitem BOHScimitar12 1
			player.additem BOHScimitarLeveled 1
			player.equipitem BOHScimitar15
			player.equipitem BOHScimitar20
			player.equipitem BOHScimitar30
			player.unequipitem BClothing12
			player.removeitem BClothing12 1
			player.additem BClothingLeveled 1
			player.equipitem BClothing15
			player.equipitem BClothing20
			player.equipitem BClothing30
			player.unequipitem BHat12
			player.removeitem BHat12 1
			player.additem BHatLeveled 1
			player.equipitem BHat15
			player.equipitem BHat20
			player.equipitem BHat30
			player.unequipitem BHandgun12
			player.removeitem BHandgun12 1
			player.additem BHandgunLeveled 1				
		else
			player.removeitem BMHScimitar12 1
			player.additem BMHScimitarLeveled 1
		endif
	elseif ( player.getitemcount BMHScimitar15 > 0 && LVL >= 20 )
		if ( player.getequipped BMHScimitar15 == 1 )
			player.unequipitem BMHScimitar15
			player.removeitem BMHScimitar15 1
			player.additem BMHScimitarLeveled 1
			player.equipitem BMHScimitar20
			player.equipitem BMHScimitar30
			player.unequipitem BOHScimitar15
			player.removeitem BOHScimitar15 1
			player.additem BOHScimitarLeveled 1
			player.equipitem BOHScimitar20
			player.equipitem BOHScimitar30
			player.unequipitem BClothing15
			player.removeitem BClothing15 1
			player.additem BClothingLeveled 1
			player.equipitem BClothing20
			player.equipitem BClothing30
			player.unequipitem BHat15
			player.removeitem BHat15 1
			player.additem BHatLeveled 1
			player.equipitem BHat20
			player.equipitem BHat30
			player.unequipitem BHandgun15
			player.removeitem BHandgun15 1
			player.additem BHandgunLeveled 1
			player.unequipitem BRing10
			player.removeitem BRing10 1
			player.additem BRingLeveled 1
			player.equipitem BRing20
			player.equipitem BRing30						
		else
			player.removeitem BMHScimitar15 1
			player.additem BMHScimitarLeveled 1
		endif
	elseif ( player.getitemcount BMHScimitar20 > 0 && LVL >= 30 )
		if ( player.getequipped BMHScimitar20 == 1 )
			player.unequipitem BMHScimitar20
			player.removeitem BMHScimitar20 1
			player.additem BMHScimitarLeveled 1
			player.equipitem BMHScimitar30
			player.unequipitem BOHScimitar20
			player.removeitem BOHScimitar20 1
			player.additem BOHScimitarLeveled 1
			player.equipitem BOHScimitar30
			player.unequipitem BClothing20
			player.removeitem BClothing20 1
			player.additem BClothingLeveled 1
			player.equipitem BClothing30
			player.unequipitem BHat20
			player.removeitem BHat20 1
			player.additem BHatLeveled 1
			player.equipitem BHat30
			player.unequipitem BHandgun20
			player.removeitem BHandgun20 1
			player.additem BHandgunLeveled 1
			player.unequipitem BRing20
			player.removeitem BRing20 1
			player.additem BRingLeveled 1
			player.equipitem BRing30						
		else
			player.removeitem BMHScimitar20 1
			player.additem BMHScimitarLeveled 1
		endif
	else
		set NotPerform to 1
	endif
endif

End

 

 

I realize the script is unnecessarily convoluted, but I'm new to scripting. Any help would be greatly appreciated. Also, I tried to put it in a spoiler code to hide it all, but I couldn't figure it out. Sorry.

 

Regards,

 

-Galiphile

Edited by xxkielioxx
Link to comment
Share on other sites

The spoiler tag is just that, <spoiler></spoiler> with brackets though. You can also add it through the "other styles" drop down.

 

As far as your script goes, you could look at Quest Award Leveler to get an idea of how auto-leveled items can be achieved. I'm not much of a scripter, though I find the best learning tool is a similar, known-working, script.

Edited by MShoap13
Link to comment
Share on other sites

Only problem with the way leveled quest item mod does it is, that keeps checking your level to your items and when your level is as high as the next better version of the item it replaces them.

 

If this is a mod just for you, you could make your scripted weapon powers scale based off your stats so the weapon would never need to be removed/replaced, and you wouldn't need extra script checking if its time to swap the item.

 

Such as its attack power could be fire dmg multiplied by your destruction or whatever desired stat.

 

I'm not much into scripting myself, but you may need OBSE to achieve that.

Link to comment
Share on other sites

I actually tried the spoiler/spoiler with brackets and it didn't work (or at least it didn't register in the preview. Could be user error on my end.

 

I actually did peruse the QAL scripts, and they cross referenced each other a lot, which threw me off. It was a little bit more than I could handle.

 

Thank you for your input.

 

-Galiphile

 

EdIt: @Ash

 

That's an interesting thought. I could actually just make the weapons scale rather than upgrade, though I don't know how. I will investigate this tomorrow; it's a little late for anything in depth now.

 

Thanks for the assistance.

Edited by xxkielioxx
Link to comment
Share on other sites

If the spoiler tags aren't working for you, it might be because you need to put them outside of the code tags. Scripting the auto-switching of leveled items isn't that hard... Here is an example:

 

 

scn ExampleScript

Begin MenuMode 1027	;the level-up menu, it won't run if someone just changes their level using SetLevel

Player.RemoveItem BMHScimitar01
Player.RemoveItem BMHScimitar03
Player.RemoveItem BMHScimitar06
Player.RemoveItem BMHScimitar09
Player.RemoveItem BMHScimitar12
Player.RemoveItem BMHScimitar15
Player.RemoveItem BMHScimitar20
Player.RemoveItem BMHScimitar30

if (Player.GetLevel >= 30)
	Player.AddItem BMHScimitar30 1
elseif (Player.GetLevel >= 20)
	Player.AddItem BMHScimitar20 1
elseif (Player.GetLevel >= 15)
	Player.AddItem BMHScimitar15 1
elseif (Player.GetLevel >= 12)
	Player.AddItem BMHScimitar12 1
elseif (Player.GetLevel >= 09)
	Player.AddItem BMHScimitar09 1
elseif (Player.GetLevel >= 06)
	Player.AddItem BMHScimitar06 1
elseif (Player.GetLevel >= 03)
	Player.AddItem BMHScimitar03 1
else
	Player.AddItem BMHScimitar01 1
endif

End

 

 

The script would change out the weapon to the appropriate one every time the player levels up, regardless of whether or not a new one is available. If you wanted to add anything fancy (ie checking to see if the item is equipped first, only switching when a new one is available), that would require making the script much longer, or the use of OBSE functions.

 

Scripting the weapon stats would be quite easy, but yes it would require OBSE functions. Here is an example:

 

 

scn ExampleScript

short level

Begin MenuMode 1027	;the level-up menu, it won't run if someone just changes their level using SetLevel

set level to Player.GetLevel

SetAttackDamage level BMHScimitar01	;changes BMHScimitar01 so that its base damage is always equal to player level

End

 

 

Again, it will be a lot longer and more complicated if you wanted to do something more (ie changing the enchantment effects on the weapon).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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