Jump to content

Armor set bonus


paulmag

Recommended Posts

If anyone has played World of Warcraft or similar games they know what I'm talking about. I want there to be a reason to wear full sets other than just looking good, so I want the player to receive a bonus when wearing all parts of a set, for example +50 strength.

 

 

I don't know much about scripting, but I guess I need a function that is set to 0 by standard, and increases by 1 for every part of the set you equip. When the function becomes 8 the player should receive some sort of bonus (A full armor set excluded the shield has 8 parts).

 

It's also very important that when you disequip the parts the function decreases so you can't keep the bonus without wearing the full armor.

 

So my guess is that every of the 8 parts needs a script that makes function X increase by 1 when they are equipped and decrease by 1 when they are disequipped. And when function X is 8, strength is increased by 50, when X drops below 8, strength is reduced by 50 again. (And maybe strength can increase by 25 when X is 6.)

 

 

This is my plan and how I think it could be executed. Now I would appreciate some help in how to translate this into commands that the CS will understand.

Link to comment
Share on other sites

It's been a while since I've done Morrowind scripting, but I know the first thing you need to do is make a global short, than add a new ability (using the spells window) with the effects you want. Then put this script on every piece of armor:

 

Begin ARMUR_OF_TEH_GODZ

Short onpcequip; maintained by engine - 1 if item equipped, 0 if unequipped
Short doonce
Short dotwice

if ( onpcequip )
 if ( doonce < 1 )
Set ARMUR_OF_TEH_GODZ_GLOB to ( ARMUR_OF_TEH_GODZ_GLOB + 1 )
if ( ARMUR_OF_TEH_GODZ_GLOB >= 8 )
  player->Addspell ARMUR_OF_TEH_GODZ_ABILITY
endif

Set doonce to 1
Set dotwice to 0
 endif
elseif ( dotwice < 1 )
 Set ARMUR_OF_TEH_GODZ_GLOB to ( ARMUR_OF_TEH_GODZ_GLOB - 1 )
 if ( ARMUR_OF_TEH_GODZ_GLOB < 8 )
player->Removespell ARMUR_OF_TEH_GODZ_ABILITY
 endif

 Set doonce to 0
 Set dotwice to 1
endif

End with great haste

 

Let me know if this works. Something to test would be how the script holds up when a piece of armor is Removeitem'd from the player.

Link to comment
Share on other sites

  • 1 month later...

I tried it out now and it almost worked... :rolleyes:

 

When I equipped the 8 pieces with the script nothing happened. Then I set ARMUR_OF_TEH_GODZ_GLOB to 0 manually via the console and then equipped the 8 pieces. Then it worked! I don't see why it didn't work at the beginning, because ARMUR_OF_TEH_GODZ_GLOB is supposed to start at 0.

 

So so far this mod would work if the player wrote "set ARMUR_OF_TEH_GODZ_GLOB to 0" in the console the first time he played with the mod, but that's not good enough!

 

Do you know what went wrong and how to fix it?

 

 

EDIT: :blink:

I think I found the problem. I think that globals aren't activated before they are actually set to something, even though it looks like they start as 0 in the CS. So probably the script needs a slight change that sets ARMUR_OF_TEH_GODZ_GLOB to 0 in addition to the rest the first time you equip one of the pieces. Eventually you could set ARMUR_OF_TEH_GODZ_GLOB directly to 1 the first time instead of the rest the first time, I'm not sure which one's the easiest.

 

I might actually know enough about scripting to do this myself, but I'm not sure. Help would still be appreciated. I will write again soon to tell whether I made it or not.

 

 

EDIT again: :thumbsup:

I fixed it myself! I just added:

if ARMUR_OF_TEH_GODZ_GLOB < 1
set ARMUR_OF_TEH_GODZ_GLOB to 0
endif

 

So the full script now looks like this:

Begin ARMUR_OF_TEH_GODZ

if ARMUR_OF_TEH_GODZ_GLOB < 1
set ARMUR_OF_TEH_GODZ_GLOB to 0
endif

Short onpcequip; maintained by engine - 1 if item equipped, 0 if unequipped
Short doonce
Short dotwice

if ( onpcequip )
if ( doonce < 1 )
	Set ARMUR_OF_TEH_GODZ_GLOB to ( ARMUR_OF_TEH_GODZ_GLOB + 1 )
	if ( ARMUR_OF_TEH_GODZ_GLOB >= 8 )
		player->Addspell ARMUR_OF_TEH_GODZ_ABILITY
	endif

	Set doonce to 1
	Set dotwice to 0
endif
elseif ( dotwice < 1 )
Set ARMUR_OF_TEH_GODZ_GLOB to ( ARMUR_OF_TEH_GODZ_GLOB - 1 )
if ( ARMUR_OF_TEH_GODZ_GLOB < 8 )
	player->Removespell ARMUR_OF_TEH_GODZ_ABILITY
endif

Set doonce to 0
Set dotwice to 1
endif

End with great haste

 

It now works perfectly! :biggrin:

I'm really proud over fixing it just by my own head and really thankfull to Marxist ßastard for doing most of the work for me. :thanks:

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