Help - Search - Members - Calendar
Full Version: Armor set bonus
The Nexus Forums > Specific Games > Morrowind > Morrowind Plug-Ins > TES Construction Set
paulmag
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.
Marxist ßastard
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:

CODE
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.
paulmag
Wow! Thank you! I'll try it thanks.gif
paulmag
I tried it out now and it almost worked... rolleyes.gif

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.gif
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.gif
I fixed it myself! I just added:
CODE
if ARMUR_OF_TEH_GODZ_GLOB < 1
    set ARMUR_OF_TEH_GODZ_GLOB to 0
endif


So the full script now looks like this:
CODE
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.gif
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.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.