You are on page 1of 119

MORROWIND

SCRIPT LIBRARY

Created by the Community

Compiled and Edited by Nedius


Contents
Version 0.3

SECTION

Activators…………………………………………… Contents Section


Creatures……………………………….……………. Contents Section
Display Cases………………………………………. Contents Section
Doors …………………………………………………… Contents Section
Inventories ………………………….……………. Contents Section
Items …………………………………………………… Contents Section
Journals………………………………….……………. Contents Section
Locks ……………………………………….………….. Contents Section
Magic …………………………………………………… Contents Section
Misc ……………………………………………………… Contents Section
Movers ………………………………………………… Contents Section
Music ……………………………………………………. Contents Section
NPCs (including mannequins) …………… Contents Section
Scale …………………………………………..………. Contents Section
Timer …………………………………………..………. Contents Section

Thanks:

This resource has been created by a whole host of modders working hard and then offering their
work freely to the modding community. Below are the list of modders who have contributed to this
resource. Thanks to them all.

Darknut, Chia, Zer010, Nikki, Melian, Enmesharra, cyran0, http://www.morrowind-mod.com,


Fliggerty, Midgetalien, Trey Leavens, Pokeapoke, Qarl, Lurlock, Princess_stomper, Baratheon79,
ixidorsbane, Aridale, Rocket, Boblen 1982, Kir, Thamior Amakiir, Stuporstar, Regaez, The Pixie,
Symon69, abot

If you recognise an un-named (or, heaven forbid, named) script that you are the author of,
please let me know so I can put it in place!

Contact:
nedius@yahoo.com
Activators
Beds
Buttons
Button Activator 2
Flushing Toilet
Hurting Actor on contact
Hurt actor on contact 2
Invisible Activator
Light Switch
Reset Activator
Teleporting the player
Weather Controller (static)

Creatures
Appearing skeletons trapped chest
Making creatures appear by invisible activator
Summon Creature on activating an item
Visual effect on death

Display Cases
DISPLAY CASES TYPE - Lady E's which have the glass lids that lower when
activated.
DISPLAY CASE TYPE - Indigo Rage's Display Cases w/the red fabric
interior
DISPLAY CASE TYPE - Dongle's Green Glass Display Cabinet

Doors
Air Lock Script
Auto Closing Doors
Auto-Locking doors
Door Lock and Alternative Door Lock script
Trapped Rug “door”
Trapped Rug 2
Tribunal’s dark hole script – option to pass through

Inventories
Adding items after death
Items
Making an item ‘unpickupable’
Teleport Amulet
Teleport Ring
Teleport Ring 2
Teleport Ring 3
‘Throbbing’ items
Making objects appear only when an item is in the inventory
Sword in the stone
Sword in the stone 2
Sword in the stone alternative
Weather Controller (carryable)

Journal
Adding journal entries
Using the Journal to make items ‘appear’

Locks
Briefcase Lock
Door Lock and Alternative Door Lock script
Auto-Locking doors
Keypad Lock

Magic
Magic regenerate

Misc
Detecting Player’s Birthsign
Detecting Players Facing
Interiors Like Exteriors
Keg Script
Trash Can

Movers
Activator Wall move
Closing a door
Moving wall 1
Moving wall 2
Moving wall 3
Rotating Objects constantly.
Up and Down constant movement

Music
Over-riding battle music

NPCs
Chaning NPCs clothes daily
Disposition
Enforced clothing for a companion (abuse possible)
Guard Script
Making them fight
Making them fight 2
Making them fight two NPCs
Making followers warp to you
Mannequins
Simple Mannequin
Armour Mannequin
Armour Mannequin place holder
Pacifying NPCs

Scale
Scale Script 1, 2 & 3

Timers
Timer 1

0.2 http://rapidshare.com/files/49624924/Morrowind_Script_Library.rtf.html
0.3 http://rapidshare.com/files/61453313/Morrowind_Script_Library_0.3.rtf.html
ACTIVATORS TOP

Bed Script

Script by Bethesda

CODE
begin Bed_Standard

;used for standard beds the player can activate and sleep in

if ( MenuMode == 0)

if ( OnActivate == 1 )

ShowRestMenu

endif

endif

end
Buttons TOP

Script by Nikki

"Activate script"; which would be placed on a button of some sort. You need to make a global
variable first, I'll call it "var01", you should name it something with your initials.

CODE
begin button01

short State
float xpos
float ypos
float zpos

if ( MenuMode == 1 )
return
endif

if ( OnActivate ==1 )
if ( State == 0 )
set var01 to 1;your global variable
set xpos to ( GetPos, X )
set ypos to ( GetPos, Y )
set zpos to ( GetPos, Z )
PlaySound "cent spider roar"
set State to 1
endif
endif

end

NOTE: For the mover, use Activator Wall move script.


Button Activator 2 (a-la Ghostgate)
TOP
Submitted by Zer010, by Bethesda (?)

Here's the classic button/lever leads to wall/gate/whatever moving script: the MW ghostgate
script.

this part is put on the activator:

CODE
Begin GG_OpenGate1

;opens first gate as Ghostgate (say that 5 times)


;put on button

float timer
short state

if ( MenuMode == 1 )
return
endif

if ( OnActivate == 1 )

if ( GG_Gate1_State == 0 )
PlaySound "Open Lock"
"ex_gg_portcullis_01"->Playsound3DVP "Dwemer Door Open" 1.0 1.0
set GG_Gate1_State to 10
set state to 10
endif
endif

if ( State >= 10 )

set timer to ( timer + GetSecondsPassed )

;move gate up (210 units)


if ( timer < 3 )
"ex_gg_portcullis_01"->MoveWorld z 70

;set back to start


elseif ( timer > 21 )
"ex_gg_portcullis_01"->SetAtStart
set State to 0 ;can now press button again
set GG_Gate1_State to 0
set timer to 0
;move gate down (210 units)
elseif ( timer > 18 )

;use state so sound only plays once


if ( State == 10 )
"ex_gg_portcullis_01"->Playsound3DVP "Dwemer Door Open" 1.0 1.0
Set State to 20
endif

"ex_gg_portcullis_01"->MoveWorld z -70

endif
endif

end GG_OpenGate1

It uses a global variable, GG_Gate1_State

Also, the moved bit needs to have this "script":

begin state
short state
end

which adds a variable to track, although actually I've never seen it being used.
Flushing Toilet TOP

Script by Pokeapoke

CODE
begin flush_script

short state
float timer

if ( MenuMode == 1 )
return
;don't run time in Menu Mode. Very bad.
endif
if ( state == 0 ); flush is off
if ( onActivate == 1 )
 PlaySound3D "Dwemer Door Open"
set state to 1
set timer to 1; will rotate for 1 second while opening
endif
elseif ( state == 1 ); flush is turning
 Rotate X -60; rotates 60 deg/sec
 set timer to ( timer - GetSecondsPassed )
if ( timer <= 0 )
set state to 2
endif
elseif ( state == 2 ); flush is on
PlaySound3D "Dwemer Door Open"
set state to 3
set timer to 1; will rotate for 1 second while closing
endif
elseif ( state == 3 ); flush is turning off
 Rotate X 60; rotates 60 deg/sec
 set timer to ( timer - GetSecondsPassed )
if ( timer <= 0 )
 set state to 0
 endif
endif

end flush_script
Hurting actor on contact 1 TOP

CODE
begin Collide_damage_100

;hurts and standing actor 100 pts per sec when colliding with this object

HurtCollidingActor 100

End

Hurt actor on contact 2 TOP


Script by Regaez

The most basic of all scripts!

CODE
Begin Rz_stake

if( MenuMode == 1)
    Return
Endif

HurtCollidingActor 10;when actor walks into the stake it takes off 10 points of health

End Rz_stake
TOP
Invisible activator

Now heres a different version of the above script which will make the wall rise when you get near
an invisible marker, the "trigger script". I recommend using the activator mesh with the sound
effect scripts on them. You can use the same global variable as the above script but you should not
use them both in the same cell.

Create your own “var01” using the gameplay > Globals menu and selecting new and giving your global a
unique id. Replace var01 with this ID.

CODE
begin trigger01_script

short doonce

if ( MenuMode == 1 )
return
endif

If ( GetDistance, Player <= 128 )


if ( doonce == 0 )
set var01 to 1;your global variable
set doonce to 1
endif
endif

end

NOTE: For the mover, use Activator Wall move script.


Light Switch TOP

Script by Regaez

The lightswitch script – attach this to your switch object. Rz_light is a global variable
(Short).

CODE
Begin Rz_lights

short MessageOn
short button

if( MenuMode == 1)
    Return
endif

if( OnActivate == 1)
    Set MessageOn to 2
endif    

if( MessageOn == 2)
    MessageBox "Which light would you like on?" "Normal" "Green" "Blue" "Red" "Off";asks which
lights to turn on
    Set MessageOn to 1
endif

if( MessageOn == 0)
    Return
endif

if( MessageOn == 1)
    set button to GetButtonPressed
        if( button == 0)
            Set MessageOn to 0
            Set Rz_light to 1
            Return
        endif
        if( button == 1)
            Set MessageOn to 0
            Set Rz_light to 2
            Return
        endif
        if( button == 2)
            Set MessageOn to 0
            Set Rz_light to 3
            Return
        endif
        if( button == 3)
            Set MessageOn to 0
            Set Rz_light to 4
            Return
        endif
        if( button == 4)
            Set MessageOn to 0
            Set Rz_light to 5
            Return
        endif
endif

End Rz_lights

This next script is what you place on the individual lights. This is for the “normal” lighting. Copy this
and place it on your other coloured lights – you will just need to change the enable/disable to their
corresponding variable value. I'll list it for you.

Norm, enable if( Rz_light == 1)


Green, enable if( Rz_light == 2)
Blue, enable if( Rz_light == 3)
Red, enable if( Rz_light == 4)
All lights, disable if ( Rz_light == 5)

CODE
Begin Rz_lights_norm

if( MenuMode == 1)
    Return
endif

if( Rz_light == 0)
    Disable
endif

if( Rz_light == 1)
    Enable
endif

if( Rz_light == 2)
    Disable
endif

if( Rz_light == 3)
    Disable
endif

if( Rz_light == 4)
    Disable
endif

if( Rz_light == 5)
    Disable
endif

End Rz_lights_norm
TOP
Reset Activator

Script by Nikki

Now heres a script you should place on another invisible activator in the room to reset the global
variable when you leave the cell so you can use the script over and over.

CODE
begin var_reset01

if ( MenuMode == 1 )
return
endif

if ( CellChanged == 1 )
set var01 to 0;the name of your global variable
endif

end
Teleporting the Player TOP

Script by Zer010

Here's a script that makes an object teleport the player somewhere upon activation.
It's supposed to look better in game than a more simple teleportation because it uses fades.
I haven't actually used it myself yet.
You need to create 3 new global float variables for it: My_PC_X, My_PC_Y, My_PC_Z (replace "my"
with something unique)

CODE
Begin player_placement
;Global Float My_PC_X
;Global Float My_PC_Y
;Global Float My_PC_Z
Float xpos
Float ypos
Float zpos
Float timer
Short step
If ( OnActivate == 1 )
Set step to 1
Endif
If ( step == 1 )
FadeOut 0.1
ToggleMenus
Set step to 2
Return
Elseif ( step == 2 )
Set timer to ( timer + GetSecondsPassed )
If ( timer > 0.2 )
Set timer to 0
Set step to 3
Endif
Return
Elseif ( step == 3 )
Set step to 0
Player->COE 0 0
Set xpos to My_PC_X
Set ypos to My_PC_Y
Set zpos to My_PC_Z
ToggleMenus
MenuTest
MenuTest
Player->SetPos x xpos
Player->SetPos y ypos
Player->SetPos z zpos
FixMe
Player->SetPos x xpos
Player->SetPos y ypos
Player->SetPos z zpos
FadeIn 0.1
Endif
End
Weather Controller (static) TOP

Script by Regaez

Here is a script I just recently wrote – and it works! It randomly changes the weather when you
activate it. It is static, so you can’t pick it up. I attached it to the dwemer puzzle box – it seemed
to fit the script nicely!

CODE
Begin Rz_weatherbox_script

short change
short state
short misc

if( MenuMode == 1)
    Return
endif

if( OnActivate == 1)
    set state to 10
    set misc to Random, 8
endif

if( state == 10)


    if( misc == 0)
        ChangeWeather, "West Gash Region", 0
        ChangeWeather, "Bitter Coast Region", 0
        ChangeWeather, "Azura's Coast Region", 0
        ChangeWeather, "Ashlands Region", 0
        ChangeWeather, "Ascadian Isles Region", 0
        ChangeWeather, "Sheogorad", 0
        ChangeWeather, "Molag Mar Region", 0
        ChangeWeather, "Red Mountain Region", 0
        ChangeWeather, "Grazelands Region", 0
        MessageBox, "You fiddle around some...and the weather becomes clear!"
        set state to 0
    endif

    if( misc == 1)
        ChangeWeather, "West Gash Region", 1
        ChangeWeather, "Bitter Coast Region", 1
        ChangeWeather, "Azura's Coast Region", 1
        ChangeWeather, "Ashlands Region", 1
        ChangeWeather, "Ascadian Isles Region", 1
        ChangeWeather, "Sheogorad", 1
        ChangeWeather, "Molag Mar Region", 1
        ChangeWeather, "Red Mountain Region", 1
        ChangeWeather, "Grazelands Region", 1
        MessageBox, "You fiddle around some...and the weather becomes cloudy!"
        set state to 0
    endif

    if( misc == 2)
        ChangeWeather, "West Gash Region", 2
        ChangeWeather, "Bitter Coast Region", 2
        ChangeWeather, "Azura's Coast Region", 2
        ChangeWeather, "Ashlands Region", 2
        ChangeWeather, "Ascadian Isles Region", 2
        ChangeWeather, "Sheogorad", 2
        ChangeWeather, "Molag Mar Region", 2
        ChangeWeather, "Red Mountain Region", 2
        ChangeWeather, "Grazelands Region", 2
        MessageBox, "You fiddle around some...and the weather becomes foggy!"
        set state to 0
    endif

    if( misc == 3)
        ChangeWeather, "West Gash Region", 3
        ChangeWeather, "Bitter Coast Region", 3
        ChangeWeather, "Azura's Coast Region", 3
        ChangeWeather, "Ashlands Region", 3
        ChangeWeather, "Ascadian Isles Region", 3
        ChangeWeather, "Sheogorad", 3
        ChangeWeather, "Molag Mar Region", 3
        ChangeWeather, "Red Mountain Region", 3
        ChangeWeather, "Grazelands Region", 3
        MessageBox, "You fiddle around some...and the weather becomes overcast!"
        set state to 0
    endif

    if( misc == 4)
        ChangeWeather, "West Gash Region", 4
        ChangeWeather, "Bitter Coast Region", 4
        ChangeWeather, "Azura's Coast Region", 4
        ChangeWeather, "Ashlands Region", 4
        ChangeWeather, "Ascadian Isles Region", 4
        ChangeWeather, "Sheogorad", 4
        ChangeWeather, "Molag Mar Region", 4
        ChangeWeather, "Red Mountain Region", 4
        ChangeWeather, "Grazelands Region", 4
        MessageBox, "You fiddle around some...and the weather becomes rainy!"
        set state to 0
    endif

    if( misc == 5)
        ChangeWeather, "West Gash Region", 5
        ChangeWeather, "Bitter Coast Region", 5
        ChangeWeather, "Azura's Coast Region", 5
        ChangeWeather, "Ashlands Region", 5
        ChangeWeather, "Ascadian Isles Region", 5
        ChangeWeather, "Sheogorad", 5
        ChangeWeather, "Molag Mar Region", 5
        ChangeWeather, "Red Mountain Region", 5
        ChangeWeather, "Grazelands Region", 5
        MessageBox, "You fiddle around some...and the weather thunderous!"
        set state to 0
    endif

    if( misc == 6)
        ChangeWeather, "West Gash Region", 6
        ChangeWeather, "Bitter Coast Region", 6
        ChangeWeather, "Azura's Coast Region", 6
        ChangeWeather, "Ashlands Region", 6
        ChangeWeather, "Ascadian Isles Region", 6
        ChangeWeather, "Sheogorad", 6
        ChangeWeather, "Molag Mar Region", 6
        ChangeWeather, "Red Mountain Region", 6
        ChangeWeather, "Grazelands Region", 6
        MessageBox, "You fiddle around some...and the weather becomes ash-filled!"
        set state to 0
    endif

    if( misc == 7)
        ChangeWeather, "West Gash Region", 7
        ChangeWeather, "Bitter Coast Region", 7
        ChangeWeather, "Azura's Coast Region", 7
        ChangeWeather, "Ashlands Region", 7
        ChangeWeather, "Ascadian Isles Region", 7
        ChangeWeather, "Sheogorad", 7
        ChangeWeather, "Molag Mar Region", 7
        ChangeWeather, "Red Mountain Region", 7
        ChangeWeather, "Grazelands Region", 7
        MessageBox, "You fiddle around some...and the weather becomes blighted!"
        set state to 0
    endif
endif

End Rz_weatherbox_script
TOP
CREATURES
Appearing Skeleton Traped chest

Script bt _BILL_ of Bethesda

Script 1 (on chest)


CODE
begin _Cursed_Chest
short doOnce

if ( OnActivate == 1 )
if ( doOnce == 1 )
Activate
return
else
MessageBox "You suddenly feel quite cold..."

"contain_corpse_XXX1"->Disable
"skeleton champ_XXX1"->Enable
set "skeleton champ_XXX1".getimBoy to 1

"contain_corpse_XXX2"->Disable
"skeleton champ_XXX2"->Enable
set "skeleton champ_XXX2".getimBoy to 1

Set doOnce to 1
endif
endif

End

Script 2 (on all skeletons)


CODE
begin BILL_GTs_Skeletal_Guardians
short getimBoy

if ( CellChanged == 1 )
Disable
endif

if ( MenuMode == 1 )
return
endif

if ( getimBoy == 1 )
if ( GetTarget "Player" == 0 )
StartCombat Player
endif
endif

End
Making creatures appear by invisible activator TOP

Script by Nikki

This one however makes monsters or NPCs warp into existance when you get near a certain invisible
marker.

First make a global variable. Call it something like "warp var01".

Now attach this script to the enemy you want to do the warping:

CODE
begin warpCreat01_script

short state
short playonce
short doonce
float timer
float xpos
float ypos
float zpos

if ( MenuMode == 1 )
    return
;don't run time in Menu Mode. Very bad.
endif

if ( GetDisabled == 0 )
If (state==0)
Disable
set state to 1
endif
endif

if ( warp var01 == 1 )
If ( doonce == 0 )
set xpos to ( GetPos, X )
set ypos to ( GetPos, Y )
set zpos to ( GetPos, Z )
set zpos to ( zpos +30 )
Placeitem "sprigganup" xpos ypos zpos 0
Enable
set doonce to 1
set playonce to 1
endif
endif

If ( playonce == 1 )

set timer to ( timer + GetSecondsPassed )    

If ( timer >= 0.50 )


SetFight 100
Startcombat Player
Set playonce to 2
endif
endif

end

And of course the good ol' trigger script to cause the warp to take effect when you get near the
invisible marker. I reccomend using the activator mesh with the sound effect scripts on them. You
can use the same global variable as the above script but you should not use them both in the same
cell.

CODE
begin WarpTrig01_script

short doonce

if ( MenuMode == 1 )
return
endif

If ( GetDistance, Player <= 128 )


if ( doonce == 0 )
set warp var01 to 1
set doonce to 1
endif
endif

end

Just place the scripted enemy in the cell wherever you want them to appear. You can use as many of
them as you want, so you could have ten of them appear to surround the player when they get near
an important item. They dont just appear out of thin air either, they appear with a flash of light
and pause for a split second before attacking which makes the effect seem more intresting. Oh,
make sure to set their fight AI to 0 otherwise the pause will be negated.
Again, like the scripts in the above post, you must reset the variable when you leave the cell; see
the reset script. That way the script can be used again and again.
Summon Creature on activating an item TOP

Script by BILL of Bethesda

CODE
begin BILL_MarksDaedraSummon
; Summon an Daedra when an item is removed from altar
;
; script location: should be placed upon an object on a Daedric Altar

; variables
short done

if ( OnActivate == 1 )
if ( done == 1 )
Activate
return
else
Set done to 1
PlaceAtPC "Dremora_lord" 1 128 1
;1 of them, 256 units away, in back (1) of the player
Activate
endif
endif

End
Visual effect on death TOP

Submitted by Midgetalien

Heres one which places a special effect when a creature dies. It also disables the creature i.e
making look like it diseapered in the magical vortex , just removed the disabled part if you want
the creatures corpse to still be there.

CODE
If ( OnDeath == 1 )
    PlaceAtMe sprigganup 1 1 1; Visual effect
    Disable    
endif
TOP
DISPLAY CASES
Scripts from http://www.morrowind-mod.com

DISPLAY CASES TYPE - Lady E's which have the glass lids that lower
when activated.

; Activates the display case lid (_SA_dispcaselid) to slide up/down.


; Creator of this script is Viking_ Lord from Anastasio The Great's Hideout

begin SA_displaycaselid
float Timer
short State

if ( MenuMode == 1 )
return
endif

if ( OnActivate ==1 )
if ( State == 0 )
PlaySound "Door Stone Open"
set State to 245
endif
endif

if ( State >= 245 )

set timer to ( timer + GetSecondsPassed )

;slide lid down


if ( Timer < 3 )
MoveWorld Z, -21

;set back to start


elseif ( Timer > 19 )
SetAtStart
set State to 0 ;can now press button again
set Timer to 0

elseif ( Timer > 16 )


if ( State == 245 )
PlaySound "Door Stone Close"
set State to 246
endif
MoveWorld Z, 21
endif
endif

end

DISPLAY CASE TYPE - Indigo Rage's Display Cases w/the red fabric
interior TOP
;This script is from IndigoRage it operates the cases that have the red fabric on the
bottom.

begin SA_Ind_displaycase
short state
short first
short open
short close
float timer

If (MenuMode == 1)
Return
endif

If (OnActivate == 1)
Set state to 1
endif

If (state == 1)
If (first == 0)
playgroup, idle2, 0
set open to 1
endif
endif

if (open == 1)
set timer to ( timer + GetSecondsPassed )
if ( timer < 0.5 )
Return
endif
set timer to 0
playgroup, idle3
set first to 1
set state to 0
set open to 0
endif

if (state == 1)
if (first == 1)
playgroup, idle4, 0
set close to 1
endif
endif

if (close == 1)
set timer to ( timer + GetSecondsPassed )
if ( timer < 0.5 )
Return
endif
set timer to 0
playgroup, idle
set first to 0
set state to 0
set close to 0
endif
TOP
end SA_Ind_displaycase

DISPLAY CASE TYPE - Dongle's Green Glass Display Cabinet


;This script is from Dongle for use with the Green Glass Display Cases.

Begin, SA_GlassDisplayScript

Short State
Short First
Short Open
Short Close
Float Timer

If ( MenuMode == 1 )
Return
EndIf

If ( OnActivate == 1 )
Set State to 1
EndIf

If ( State == 1 )
If ( First == 0 )
PlayGroup, Idle2, 0
PlaySound3D, "Door Creaky Open"
Set Open to 1
EndIf
EndIf

If ( Open == 1 )
Set Timer to ( Timer + GetSecondsPassed )
If ( Timer < 0.5 )
Return
EndIf
Set Timer to 0
PlayGroup, Idle3
Set First to 1
Set State to 0
Set Open to 0
EndIf

If ( State == 1 )
If ( First == 1 )
PlayGroup, Idle4, 0
PlaySound3D, "Door Creaky Close"
Set Close to 1
EndIf
EndIf

If ( Close == 1 )
Set Timer to ( Timer + GetSecondsPassed )
If ( Timer < 0.5 )
Return
EndIf
Set Timer to 0
PlayGroup, Idle
Set First to 0
Set State to 0
Set Close to 0
EndIf

End, SA_GlassDisplayScript
DOORS TOP

Air Lock Script


Script by Regaez

This is the airlock script. Place this on the desired switch. Waterlev and waterstate are global variables
(short).

CODE
Begin Rz_airlock_switch

if( OnActivate == 1)
    set waterlev to (waterstate + 300)
    set waterstate to (waterstate + 600)
endif

if( waterstate > 0)


    ModWaterLevel, -0.5
    set waterstate to (waterstate - 1)
endif

if( MenuMode == 1)
    return
endif

End Rz_airlock_switch

Place this script on the door that you exit from – to the flooded area (you usually enter from this
door).

CODE
Begin Rz_airlock_exitdoor

short height

if( MenuMode == 1)
    return
endif

if( OnActivate == 1)
    set height to waterlev
    ModWaterLevel, height;this resets the water level when you leave the airlock
    Activate
endif
End Rz_airlock_exitdoor

Place this script on the door which leads to the rest of the cell – the area which is not flooded. You
may need to play around with values depending on what the original waterlevel was – I think I set
mine to 15000.

CODE
Begin Rz_airlock_flooddoor

if( MenuMode == 1)
    return
endif

if( OnActivate == 1)
    if( GetWaterLevel > 14750)
        MessageBox "You need to drain the room of water first, before opening this door."
    elseif (GetWaterLevel < 14750)
        Activate
    endif
endif

End Rz_airlock_flooddoor
Auto Closing Doors TOP

Script by Enmesharra

I hate having doors opened all over the place about as much as I hate having to always stop and
close the door. So I created this simple but useful script for my house mod.

Put this on a door and the door will close by itself 5 seconds after being opened.

CODE
Begin ZZA_Door_close_script

Short ContVar
float timer

  ;if the door should happen to get messed up or if the player leaves the cell while a door is not
finished
  ;closing itself this resets everything whenever the player enters the cell
If ( cellchanged > 0 )  
    SetAtStart
    Set ContVar to 0
endif

If ( ContVar == 0 )
    If ( OnActivate )
        Activate
        set ContVar to 1
        set timer to 0
    Endif
Elseif ( ContVar == 1 )
    If ( OnActivate )       ;if the player closes the door by hand
        set timer to 6
    Endif
    set timer to timer + GetSecondsPassed
    If timer > 5
        Activate
        set ContVar to 0
    Endif
Endif

End
TOP
Door Lock script.

Script by Pokeapoke

CODE
Begin Door_lock

If ( OnActivate == 1 )
If ( Player -> GetItemCount, "Door_key" >= 1 )
 Activate
Else; Either You have a Key, Or you don't
 MessageBox, "You need a key to open this door."
EndIf
EndIf

End

TOP
Alternate Door Lock Script

Script by Qarl

CODE
Begin Door_lock

If ( OnActivate )
 If ( Player->GetItemCount "Door_key" < 1 )
     playSound lockedDoor
     messageBox, "You need a key to open this door."
     return
 endif
 Activate
EndIf

End
Auto-Lock Doors TOP

Script by Baratheon79

CODE
begin auto-relock_door_script

short activate_count
float relock_timer

DontSaveObject

if ( menumode == 1 )
   return
endif

;This part allows the player to open the door if they pick the lock or have
;the key in their inventory.
if ( GetLocked == 0 )
   if ( OnActivate == 1 )
        if ( activate_count < 2 )
             set activate_count to ( activate_count + 1 )
        endif
        Activate
   endif
else
   if ( OnActivate == 1 )
        if ( Player->GetItemCount, "door_key" >= 1 )
             Activate
             set activate_count to ( activate_count + 1 )
        else
             Activate
        endif
   endif
endif

;This section relocks the door once it's closed


if ( activate_count == 2 )
   if ( relock_timer < 2 )
        set relock_timer to ( relock_timer + GetSecondsPassed )
   elseif ( relock_timer >= 2 )
        Lock, 100
        PlaySound3D, "Open Lock"
        set activate_count to 0
        set relock_timer to 0
   endif
endif

end
Trapped Rug TOP

Script by Rocket

Use a different spell for this one, you might have to create one.

CODE
begin Script_Trapped_Rug

short state

if ( menuMode == 1 )
  return
endif

if ( onActivate == 1 )
  return
endif

if ( state == 2 )
  return
else
  if ( getStandingPC == 1 )
      if ( state == 0 )
          cast sp_trap_fire_5x50 player

; Place code here to raise


; alarm, summon guards etc ...

          set state to 1
      endif
  else
      set state to 0
  endif
endif

if ( getSoundPlaying "Disarm Trap" == 1 )


  set state to 2
endif

end

Create a door using a rug model like f\Furn_rug_01.nif. Give it a name like "Handwoven Rug" and
attach this script. Set the reference data to locked, level 0, with any trap spell.
Trapped Rug 2 TOP

I’m not sure if this is a door, static or activator script…

CODE
begin BILL_common_trapped_rug
; hits the player with a glyph of weakness when he walks on the rug.
; trap resets 15 seconds later.
;
; script location: should be called from ac_furn_rug_big_04_dren

; variables
short onMe ; is the Player on me?
short wait
float timer

if ( MenuMode == 1 )
return
endif

if ( wait == 1 )
set timer to ( timer + GetSecondsPassed )
if ( timer < 15 )
return
else
set timer to 0
set wait to 0
endif
endif

set onMe to ( GetStandingPC )


if ( onMe == 1 )
MessageBox, "You have triggered a trap..."
Cast, "sp_glyphofweakness", Player
set wait to 1
endif

end BILL_common_trapped_rug
Tribunal’s dark hole script – TOP
a door with an option to pass through

CODE
Begin DoorScript
short button
short messageOn
; this part gives you your choice on activating the Door
if ( OnActivate == 1 )
MessageBox "Do you wish pass through the door?" "Yes" "No"
set messageOn to 1
endif
if ( messageOn == 1 )
set button to GetButtonPressed
;resets the variable so you can use the door multiple times
if ( button >= 0 )
set messageOn to 0
endif
;should send you through the door normally
if ( button == 0 )
Activate
; should just reset the script, allowing you to do it again
elseif ( button == 1 )
set button to 0
return
endif
endif
End DoorScript
INVENTORY TOP

Making items arrive post-death:

CODE
Begin XX_Death_Script

If ( GetHealth <= 0 )
AddItem "item ID" #
AddItem "item ID" #
EndIf

End
ITEMS TOP

Making an item ‘unpickupable’


Scripts from http://www.morrowind-mod.com

MAKING A MISCELLANEOUS OBJECT "UNPICKUPABLE".


Script by Vorwoda_the_Black
I had to change the trees in Abu Manor dining room from Static to
Miscellaneous Objects so they wouldn't have collision walls, but I didn't
want people to be able to pick them up like Miscellaneous Objects. Just
replace the SA_MiscTreeScript with the id of the object in question.
;Script to prevent Dining Room trees from being
;moved, written by Vorwoda_the_Black

Begin SA_MiscTreeScript

if ( OnActivate == 1 )
return
endif

End SA_MiscTreeScript
Teleport Amulet TOP

Make sure you alter the LOCATION, and inset x/y/z here values.

CODE
Begin amuletScript

short button
short messageOn
short reset
short OnPcEquip

;if ( MenuMode == 1 )
; Return
;endif

if ( OnPCEquip == 0 )
set reset to 0
endif

if ( reset == 1 )
return
endif

if ( OnPCEquip == 1 )
if ( reset == 0 )
Set OnPCEquip to 0
MessageBox "Would you like to return to LOCATION?" "Yes" "No"
set messageOn to 1
endif
endif
endif

if ( messageOn == 1)

set button to GetButtonPressed

if ( button >= 0 )
set messageOn to 0
endif

if ( button == 0 )
Player->PositionCell, insert x here, insert y here, insert z here, 180, "LOCATION"
set reset to 1
elseif ( button == 1 )
set reset to 1
return
endif
endif

End
TOP
Teleport Ring

Scripts from http://www.morrowind-mod.com

HOME TELEPORT RING

;This script is for the home teleport ring, don't know who wrote this.

Begin SA_AbuManor_TeleportRing

short OnPCEquip
if ( OnPCEquip == 1 )
Player->PositionCell, 2178 2610 1122 0 "Abu Manor"
endif
set OnPCEquip to 0

End SA_AbuManor_TeleportRing
Teleport Ring 2 TOP

Script by Thamior Amakiir

Change locations to where you want it to take you.

CODE
Begin da_tb_teleportring

short button
short messageOn
short reset
short OnPcEquip

;if ( MenuMode == 1 )
; Return
;endif

if ( OnPCEquip == 0 )
set reset to 0
endif

if ( reset == 1 )
return
endif

if ( OnPCEquip == 1 )
if ( reset == 0 )
Set OnPCEquip to 0
MessageBox "Where would you like to go?" "Balmora" "Vivec" "Sadrith Mora" "Tel Fyr" "Nowhere"
 set messageOn to 1
endif
endif
endif

if ( messageOn == 1 )

set button to GetButtonPressed

if ( button >= 0 )
set messageOn to 0
endif

;Balmora
if ( button == 0 )
playsound "conjuration hit"
Player->PositionCell 4288, 4384, 15300, 90 "Balmora, Temple"
set reset to 1  

;Vivec
elseif ( button == 1 )
playsound "conjuration hit"
Player->PositionCell 5248, 6336, 12850, 180 "Vivec, Hall of Wisdom"
set reset to 1  

;Sadrith Mora
elseif ( button == 2 )
playsound "conjuration hit"
Player->PositionCell 3952, 4344, 1138, 0 "Sadrith Mora, Telvanni Council House, Entry"
set reset to 1
return

;Tel Fyr
elseif ( button == 3 )
playsound "conjuration hit"
Player->PositionCell 108, 102, 54, 0 "Tower of Tel Fyr, Onyx Hall"
set reset to 1
return

elseif ( button == 4 )
set reset to 1
return

endif

endif

End
Teleport Ring 3 TOP

Script by Regaez

This is the teleporting ring script. Attach it to a ring (duh). It is currently set to teleport you to
Balmora Square. It requires you to make a mark ability and a recall ability. And if you don't want to
teleport to Balmora Square you'll just have to change the position cell info.

CODE
Begin Rz_teleport_ring

short OnPCEquip
short button

if ( MenuMode == 1 )
    return
endif

if ( OnPCEquip == 1 )
    MessageBox "How would you like to teleport?" "Balmora Square" "Mark and go to Balmora
Square" "Recall" "Nevermind"
    set OnPCEquip to 2
endif

if ( OnPCEquip == 2 )
    set button to GetButtonPressed
        if ( button == -1 )
                return
    endif
        if ( button == 0 )
                player->PositionCell -23503 -15885 574 74 “Balmora -3,-2”
               set OnPCEquip to 0
    endif
    if ( button == 1 )
                player->AddSpell Your_mark_abil_id
                set OnPCEquip to 3
    endif
        if ( button == 2 )
                player->AddSpell Your_recall_abil_id
                set OnPCEquip to 3
    endif
       if ( button == 3 )
                set OnPCEquip to 0
        endif
endif
if ( OnPCEquip == 3 )
    if ( player->GetEffect sEffectMark == 1 )
        player->RemoveSpell Your_mark_abil_id
        player->PositionCell -23503 -15885 574 74 “Balmora -3,-2”
        set OnPCEquip to 0
    elseif ( player->GetEffect sEffectRecall == 1 )
        player->RemoveSpell Your_recall_abil_id
        set OnPCEquip to 0
    endif
endif

End Rz_teleport_ring
‘Throbbing’ Items TOP

Script by Fliggerty

It makes an object grow and shrink a little bit to simulate a "throbbing" effect.

CODE
begin throb_script

  float timer
  short state
  float temp
  short delay

  if ( MenuMode )
      return
  endif

  set timer to ( timer + getsecondspassed )


  if ( timer >= 3 );change this for delay between grow n shrink
      if ( state == 0 )
          set state to 1
      else
          set state to 0
      endif
      set timer to 0
  endif

  set delay to ( delay + 1 )


  if ( delay < 5 );change this for growth speed
      Return
  endif
  set delay to 0

  if ( state == 0 )
      set temp to GetScale
      set temp to ( temp + 0.015 );tweak these values for size
      SetScale temp
  else
      set temp to GetScale
      set temp to ( temp - 0.015 )
      SetScale temp
  endif

end
Making objects appear only if the player TOP
has an item in their inventory

Script by Zer010

This one makes the object it's attached to only appear if the player has a certain item in inventory.
It would be pretty cool if you checked for a spell instead of an item, say one which you only got
from a faction, since that's not obvious the object appearing would appear to be connected with
belonging to said faction.
It's from Trey Leavens at the forums

CODE
begin scriptname

short variable

if ( variable == 0 )
if ( GetDisabled == 0 )
disable
endif
elseif ( variable == 1 )
if ( getdisabled == 1 )
enable
endif
endif

if ( player->GetItemCount, "objectID" >= 1 )


set variable to 1
endif

end
Sword in the Stone TOP
Script by Regaez

Ah, well here's a little "Sword in the Stone" sort of script. Basically you could put it on a sword
stuck in the ground. It's pretty basic, but hey!
Note: Comment from author: “Oh, I'm writing it from memory, as I am not actually on my
Morrowind-playing computer at the moment, so it may not be 100% the correct (I sometimes get
muddled up with the greater than/less than signs).”

CODE
Begin R_strength_test

if( MenuMode == 1)
     Return
endif

if( OnActivate == 1)

     if( player-> GetStrength < 50)


             MessageBox, "You are too weak. You cannot hope to pull this sword out.";or change the
sword to whatever you want
     endif

     if( player-> GetStrength > 49)


            if( player-> GetStrength < 60)
                  MessageBox, "You tug but your hands just slip off the hilt. More strength is need to pull
out this sword."
            endif
     endif

     if( player-> GetStrength > 59)


            if( player-> GetStrength < 70)
                  MessageBox, "You imagine a budge, but do not be fooled! You are still not strong
enough."
            endif
     endif

     if( player-> GetStrength > 69)


            if( player-> GetStrength < 80)
                  MessageBox, "It starts to feel like giving way..."
            endif
     endif

     if( player-> GetStrength > 79)


            if( player-> GetStrength < 90)
                  MessageBox, "You can feel the sword's futile efforts at resisting you grow weaker."
            endif
     endif

      if( player-> GetStrength > 89)


            if( player-> GetStrength < 100)
                  MessageBox, "There is no doubt about it - you shall have the sword with a little more
strength in your pull."
            endif
     endif

     if( player-> GetStrength == 100)


           MessageBox, "You heave and the sword sings as it slides free from the grip of the ground!"
           Activate
     endif

End R_strength_test

Another not from author: “I would just like to make a last minute defense in case this script has
some fatal flaws and say that I am not the best at scripting and... oh what the heck, you get the
idea! If it's wrong then it's wrong and I'm sure you super dooper scripters out there can fix it in
the blink of an eye!”
Sword in the stone 2
TOP
Script by Regaez

Another “Sword in the Stone” theme script. Attach this to a Daedric Longsword or a weapon of
your choice!

CODE
Begin Rz_dae_longsword_dummy

short pickup

if( MenuMode == 0)
    
        if( pickup == 0)    
            if( OnActivate == 1)
                MessageBox "You try to pick the sword up but find it stuck fast to the ground."
                set pickup to 1            
            endif
        endif

        if( pickup == 1)    


            if( OnActivate == 1)
                MessageBox "You try to pick the sword up but find it stuck fast to the ground."
                set pickup to 2            
            endif
        endif

        if( pickup == 2)    


            if( OnActivate == 1)
                MessageBox "You try to pick the sword up but find it stuck fast to the ground."
                set pickup to 3            
            endif
        endif

        if( pickup == 3)    


            if( OnActivate == 1)
                MessageBox "You try to pick the sword up but find it stuck fast to the ground."
                set pickup to 4            
            endif
        endif
    

    if( pickup == 4)
            if( OnActivate == 1)
                MessageBox "The sword suddenly comes free, your perserverence paid off!"
                Activate            
            endif
        endif

endif

End Rz_dae_longsword_dummy

Alternative TOP
by Symon69

CODE
Begin R_strength_test

local pstr

if ( MenuMode == 1)
     Return
endif

set pstr to player -> GetStrength

if ( OnActivate )
     if ( pstr < 50)
             MessageBox, "You are too weak. You cannot hope to pull this sword out.";or change the
sword to whatever you want
     elseif ( pstr < 60)
             MessageBox, "You tug but your hands just slip off the hilt. More strength is need to pull
out this sword."
     elseif ( pstr < 70)
             MessageBox, "You imagine a budge, but do not be fooled! You are still not strong enough."
     elseif ( pstr < 80)
            MessageBox, "It starts to feel like giving way..."
     elseif ( pstr < 90)
            MessageBox, "You can feel the sword's futile efforts at resisting you grow weaker."
     elseif ( pstr < 100)
            MessageBox, "There is no doubt about it - you shall have the sword with a little more
strength in your pull."
     else
            MessageBox, "You heave and the sword sings as it slides free from the grip of the ground!"
           Activate
     endif
endif
End R_strength_test
Weather Controller (carryable)
Script by Regaez
TOP

This is essentially the same script as above, but you can carry the object it is attached to! To use it
you just drag it onto your person in the inventory menu.

CODE
Begin Rz_carry_weatherbox_script

short change
short state
short misc
short OnPCEquip

if( MenuMode == 1)
    Return
endif

if( OnPCEquip == 1)
    set state to 10
    set misc to Random, 8
    set OnPCEquip to 0
endif

if( state == 10)


    if( misc == 0)
        ChangeWeather, "West Gash Region", 0
        ChangeWeather, "Bitter Coast Region", 0
        ChangeWeather, "Azura's Coast Region", 0
        ChangeWeather, "Ashlands Region", 0
        ChangeWeather, "Ascadian Isles Region", 0
        ChangeWeather, "Sheogorad", 0
        ChangeWeather, "Molag Mar Region", 0
        ChangeWeather, "Red Mountain Region", 0
        ChangeWeather, "Grazelands Region", 0
        MessageBox, "You fiddle around some...and the weather becomes clear!"
        set state to 0
    endif

    if( misc == 1)
        ChangeWeather, "West Gash Region", 1
        ChangeWeather, "Bitter Coast Region", 1
        ChangeWeather, "Azura's Coast Region", 1
        ChangeWeather, "Ashlands Region", 1
        ChangeWeather, "Ascadian Isles Region", 1
        ChangeWeather, "Sheogorad", 1
        ChangeWeather, "Molag Mar Region", 1
        ChangeWeather, "Red Mountain Region", 1
        ChangeWeather, "Grazelands Region", 1
        MessageBox, "You fiddle around some...and the weather becomes cloudy!"
        set state to 0
    endif

    if( misc == 2)
        ChangeWeather, "West Gash Region", 2
        ChangeWeather, "Bitter Coast Region", 2
        ChangeWeather, "Azura's Coast Region", 2
        ChangeWeather, "Ashlands Region", 2
        ChangeWeather, "Ascadian Isles Region", 2
        ChangeWeather, "Sheogorad", 2
        ChangeWeather, "Molag Mar Region", 2
        ChangeWeather, "Red Mountain Region", 2
        ChangeWeather, "Grazelands Region", 2
        MessageBox, "You fiddle around some...and the weather becomes foggy!"
        set state to 0
    endif

    if( misc == 3)
        ChangeWeather, "West Gash Region", 3
        ChangeWeather, "Bitter Coast Region", 3
        ChangeWeather, "Azura's Coast Region", 3
        ChangeWeather, "Ashlands Region", 3
        ChangeWeather, "Ascadian Isles Region", 3
        ChangeWeather, "Sheogorad", 3
        ChangeWeather, "Molag Mar Region", 3
        ChangeWeather, "Red Mountain Region", 3
        ChangeWeather, "Grazelands Region", 3
        MessageBox, "You fiddle around some...and the weather becomes overcast!"
        set state to 0
    endif

    if( misc == 4)
        ChangeWeather, "West Gash Region", 4
        ChangeWeather, "Bitter Coast Region", 4
        ChangeWeather, "Azura's Coast Region", 4
        ChangeWeather, "Ashlands Region", 4
        ChangeWeather, "Ascadian Isles Region", 4
        ChangeWeather, "Sheogorad", 4
        ChangeWeather, "Molag Mar Region", 4
        ChangeWeather, "Red Mountain Region", 4
        ChangeWeather, "Grazelands Region", 4
        MessageBox, "You fiddle around some...and the weather becomes rainy!"
        set state to 0
    endif
    if( misc == 5)
        ChangeWeather, "West Gash Region", 5
        ChangeWeather, "Bitter Coast Region", 5
        ChangeWeather, "Azura's Coast Region", 5
        ChangeWeather, "Ashlands Region", 5
        ChangeWeather, "Ascadian Isles Region", 5
        ChangeWeather, "Sheogorad", 5
        ChangeWeather, "Molag Mar Region", 5
        ChangeWeather, "Red Mountain Region", 5
        ChangeWeather, "Grazelands Region", 5
        MessageBox, "You fiddle around some...and the weather thunderous!"
        set state to 0
    endif

    if( misc == 6)
        ChangeWeather, "West Gash Region", 6
        ChangeWeather, "Bitter Coast Region", 6
        ChangeWeather, "Azura's Coast Region", 6
        ChangeWeather, "Ashlands Region", 6
        ChangeWeather, "Ascadian Isles Region", 6
        ChangeWeather, "Sheogorad", 6
        ChangeWeather, "Molag Mar Region", 6
        ChangeWeather, "Red Mountain Region", 6
        ChangeWeather, "Grazelands Region", 6
        MessageBox, "You fiddle around some...and the weather becomes ash-filled!"
        set state to 0
    endif

    if( misc == 7)
        ChangeWeather, "West Gash Region", 7
        ChangeWeather, "Bitter Coast Region", 7
        ChangeWeather, "Azura's Coast Region", 7
        ChangeWeather, "Ashlands Region", 7
        ChangeWeather, "Ascadian Isles Region", 7
        ChangeWeather, "Sheogorad", 7
        ChangeWeather, "Molag Mar Region", 7
        ChangeWeather, "Red Mountain Region", 7
        ChangeWeather, "Grazelands Region", 7
        MessageBox, "You fiddle around some...and the weather becomes blighted!"
        set state to 0
    endif

endif

End Rz_carry_weatherbox_script
JOURNAL TOP

Adding journal entries

Script by Cyran0

Well, here is a script that I frequently use in designing quests. It updates the player’s journal upon
reading a book or note. It works whether the player reads the note by activating it in the world or
equipping the note from inventory.

CODE
Begin lgnpc_fq_NoteScript

; Attached to note to trigger a journal update when player reads it.

short readNote
short OnPCEquip
short PCSkipEquip

if ( readNote == 1 )
   return
endif

set PCSkipEquip to 0

if ( OnActivate == 1 )
   if ( GetJournalIndex "lgnpc_fq_X" == 40 )
      Journal "lgnpc_fq_X" 50
      set readNote to 1
   endif
   Activate
   return
endif

if ( menumode == 0 )
   return
endif

set PCSkipEquip to 1

if ( OnPCEquip == 1 )
   if ( GetJournalIndex "lgnpc_fq_X" == 40 )
      Journal "lgnpc_fq_X" 50
   endif
   set readNote to 1
   set OnPCEquip to 0
   set PCSkipEquip to 0
   Activate
endif

End lgnpc_fq_NoteScript
TOP
Using the Journal to make items ‘appear’

This script can be placed on an item, activator, NPC to make it appear only after a certain Journal
entry has been reached. Remember to replace ‘MY_JOUNRAL_INDEX’ with the journal name of
the required entry.

CODE
Begin Journal_enable_script

if ( GetDisabled == 0 )
if ( GetJournalIndex MY_JOUNRAL_INDEX < 20 )
Disable
endif
elseif ( GetDisabled == 1 )
if ( GetJournalIndex MY_JOUNRAL_INDEX >= 20 )
Enable
endif
endif

End Journal_enable_script
TOP
LOCKS
Briefcase Lock

Script by Kir

CODE
begin CodeLock_Briefcase

short status
; 0 - initialization
; -1 - locked and standby
; 2 - locked and activated
; 3 - processing buttons
; -4 - unlocked and standby
; 5 - unlocked and activated
; 6 - processing lockpicking
; 7 - blocking from reaction to OpenLockFail sound more than once

short codesum
short code1
short code2
short code3
short code4
short lock1
short lock2
short lock3
short lock4
short locksum
short button
short pickable
float chance
short i
short j

if ( OnActivate == 1 )
if ( status == -4 )
set status to 5
else
set status to 2
endif
endif

if ( GetSoundPlaying "Open Lock Fail" == 1 )


if ( status == -1 )
set status to 6
return
endif
endif

if ( status < 0 )
return
endif

if ( status == 7 )
if ( GetSoundPlaying "Open Lock Fail" == 0 )
set status to -1
endif
return
endif

if ( status == 0 )
set pickable to 100; <= This is the difficulty of the lock regarding lockpicking. Set it to 0 if you
don't want the lock to be pickable at all
set code1 to 4; <= This is the combination that opens the lock. Edit at will... and don't forget to give
it to player somehow
set code2 to 8; <=
set code3 to 1; <=
set code4 to 0; <=
set codesum to ( code1 * 1000 ) +  ( code2 * 100 ) + ( code3 * 10 ) + code4
set lock1 to Random, 10
set lock2 to Random, 10
set lock3 to Random, 10
set lock4 to Random, 10
if ( pickable > 0 )
Lock 10000; It *must* be insanely high regardless of the intended difficulty - do not change
endif
set status to -1
endif

if ( status == 5 )
Activate
set status to -4
endif

if ( status == 2 )
; MessageBox "Enter the code number:| %.0f    %.0f    %.0f    %.0f", lock1, lock2, lock3, lock4, "  ", "
", "  ", "  ", "Exit"
MessageBox "  %.0f    %.0f    %.0f    %.0f             ", lock1, lock2, lock3, lock4, "  ", "  ", "  ", "  ",
"Exit"
set status to 3
endif

if ( status == 3 )
set button to GetButtonPressed
if ( button == -1 )
return
elseif ( button == 0 )
set lock1 to lock1 + 1
if ( lock1 == 10 )
 set lock1 to 0
endif
elseif ( button == 1 )
set lock2 to lock2 + 1
if ( lock2 == 10 )
 set lock2 to 0
endif
elseif ( button == 2 )
set lock3 to lock3 + 1
if ( lock3 == 10 )
 set lock3 to 0
endif
elseif ( button == 3 )
set lock4 to lock4 + 1
if ( lock4 == 10 )
 set lock4 to 0
endif
elseif ( button == 4 )
set status to -1
return
endif
set locksum to ( lock1 * 1000 ) +  ( lock2 * 100 ) + ( lock3 * 10 ) + lock4
if ( locksum == codesum )
set status to 5
PlaySound "Open Lock"
if ( pickable > 0 )
 Unlock
endif
else
set status to 2
PlaySound "LockedChest"
endif
endif

if ( status == 6 )
set chance to ( Player->GetSecurity )
set chance to ( chance * chance * chance )
set chance to ( chance / 10000 )
set i to Random, 20
set chance to ( chance + i )
set i to ( Player->GetLuck )
set i to ( i / 10 )
set chance to ( chance + i )
;messagebox "Security + Random + Luck chance %.3f" chance

if ( Player->GetItemCount       "skeleton_key" > 0 ); Morrowind only


; if ( Player->HasItemEquipped "skeleton_key" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 2 )
elseif ( Player->GetItemCount       "pick_secretmaster" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_secretmaster" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 1.2 )
elseif ( Player->GetItemCount       "pick_grandmaster" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_grandmaster" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 1.1 )
elseif ( Player->GetItemCount       "pick_master" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_master" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 1.0 )
elseif ( Player->GetItemCount       "pick_journeyman_01" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_journeyman_01" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 0.8 )
elseif ( Player->GetItemCount       "pick_apprentice_01" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_apprentice_01" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 0.6 )
endif
;messagebox "Total chance %.3f" chance

if ( ( Chance * 2 ) < pickable )


set status to 7
MessageBox "You have no slightest idea how to crack this lock"
return
endif
if ( ( Chance * 1.5 ) < pickable )
set status to 7
MessageBox "You tamper with the lock but have no success this time"
return
endif
if ( ( Chance * 1.2 ) < pickable )
set status to 7
MessageBox "You almost pick up one of triggers but at the last moment it's off"
return
endif
set j to Random, 40; choosing random digit out of 4
set i to j / 10
set j to 0

if ( i == 0 ); skipping digits already picked


if ( lock1 == code1 ); this fragment is repeated twice on purpose!
 set i to 1
endif
endif
if ( i == 1 )
if ( lock2 == code2 )
 set i to 2
endif
endif
if ( i == 2 )
if ( lock3 == code3 )
 set i to 3
endif
endif
if ( i == 3 )
if ( lock4 == code4 )
 set i to 0
endif
endif
if ( i == 0 )
if ( lock1 == code1 )
 set i to 1
endif
endif
if ( i == 1 )
if ( lock2 == code2 )
 set i to 2
endif
endif
if ( i == 2 )
if ( lock3 == code3 )
 set i to 3
endif
endif
if ( i == 3 )
if ( lock4 == code4 )
 set i to 0; it should never occur, but version with "while" would occasionally hang the program
messagebox "Program alert"; into eternal loop, so maybe I'm missing something. Mail me if you see
this message
endif
endif

if ( i == 0 )
if ( Chance < pickable )
 if ( lock1 < code1 )
  MessageBox "You get the feeling that the first digit must be higher"
  set lock1 to lock1 + 1
 else
  MessageBox "You get the feeling that the first digit must be lower"
  set lock1 to lock1 - 1
 endif
else
 set lock1 to code1
 MessageBox "You manage to figure the first digit of the code. It is ' %.0f '", code1
endif
set status to 7
elseif ( i == 1 )
if ( Chance < pickable )
 if ( lock2 < code2 )
  MessageBox "You get the feeling that the second digit must be higher"
  set lock2 to lock2 + 1
 else
  MessageBox "You get the feeling that the second digit must be lower"
  set lock2 to lock2 - 1
 endif
else
 set lock2 to code2
 MessageBox "You manage to figure the second digit of the code. It is ' %.0f '", code2
endif
elseif ( i == 2 )
if ( Chance < pickable )
 if ( lock3 < code3 )
  MessageBox "You get the feeling that the third digit must be higher"
  set lock3 to lock3 + 1
 else
  MessageBox "You get the feeling that the third digit must be lower"
  set lock3 to lock3 - 1
 endif
else
 set lock3 to code3
 MessageBox "You manage to figure the third digit of the code. It is ' %.0f '", code3
endif
elseif ( i == 3 )
if ( Chance < pickable )
 if ( lock4 < code4 )
  MessageBox "You get the feeling that the fourth digit must be higher"
  set lock4 to lock4 + 1
 else
  MessageBox "You get the feeling that the fourth digit must be lower"
  set lock4 to lock4 - 1
 endif
else
 set lock4 to code4
 MessageBox "You manage to figure the fourth digit of the code. It is ' %.0f '", code4
endif
endif

set status to 7
set locksum to ( lock1 * 1000 ) +  ( lock2 * 100 ) + ( lock3 * 10 ) + lock4
if ( locksum == codesum )
set status to 5
MessageBox "You've successfully picked the code lock"
if ( pickable > 0 )
 Unlock
endif
PlaySound "Open Lock"
endif

endif

end
Keypad lock TOP

Script by Kir

CODE
begin CodeLock_Numpad1

short status
; 0 - initialization
; -1 - locked and standby
; 2 - locked and activated
; 3 - processing buttons
; -4 - unlocked and standby
; 5 - unlocked and activated
; 6 - processing lockpicking
; 7 - blocking from reaction to OpenLockFail sound more than once

long codesum
long code
short lock_length
short lock_order
short code1
short code2
short code3
short code4
short code5
short code6
short code7
short code8
short code9
short code10
short code11
short code12
short code13
short code14
short code15

short button
short pickable
float chance
short doonce
short correct
short i

if ( OnActivate == 1 )
if ( status == -4 )
set status to 5
else
set status to 2
set lock_order to 1
set codesum to 0
endif
endif

if ( GetSoundPlaying "Open Lock Fail" == 1 )


if ( status == -1 )
set status to 6
endif
endif

if ( status < 0 )
return
endif

if ( status == 7 )
if ( GetSoundPlaying "Open Lock Fail" == 0 )
set status to -1
endif
return
endif

if ( status == 0 )
set pickable to 100; <= This is the difficulty of the lock regarding lockpicking. Set it to 0 if you
don't want the lock to be pickable at all
set lock_length to 9; <= this is the lenght of code combination (maximum is 9 digits)
set code1 to 1; <= this is the combination that opens the lock
set code2 to 1; <= (no zeroes - there can be only up to 9 buttons in MessageBox!)
set code3 to 2; <=
set code4 to 2; <=
set code5 to 3; <=
set code6 to 3; <=
set code7 to 4; <=
set code8 to 4; <=
set code9 to 5; <=
set code to 0
if ( lock_length >= 1 )
set code to ( code * 10 ) + code1
endif
if ( lock_length >= 2 )
set code to ( code * 10 ) + code2
endif
if ( lock_length >= 3 )
set code to ( code * 10 ) + code3
endif
if ( lock_length >= 4 )
set code to ( code * 10 ) + code4
endif
if ( lock_length >= 5 )
set code to ( code * 10 ) + code5
endif
if ( lock_length >= 6 )
set code to ( code * 10 ) + code6
endif
if ( lock_length >= 7 )
set code to ( code * 10 ) + code7
endif
if ( lock_length >= 8 )
set code to ( code * 10 ) + code8
endif
if ( lock_length >= 9 )
set code to ( code * 10 ) + code9
endif
if ( pickable > 0 )
Lock 10000; It *must* be insanely high regardless of the intended difficulty - do not change!
endif
set status to -1
endif

if ( status == 5 )
Activate
set status to -4
endif

if ( status == 2 )
MessageBox "       Enter the code sequence: %.0f         ", codesum, "1", "2", "3", "4", "5", "6", "7",
"8", "9"
set status to 3
endif

if ( status == 3 )
set button to GetButtonPressed + 1
if ( button == 0 )
return
endif
set codesum to codesum * 10
set codesum to codesum + button
set lock_order to lock_order + 1

if ( lock_order > lock_length )


if ( codesum == code )
;   Activate
 set status to 5
 PlaySound "Open Lock"
 Unlock
else
 set status to 7
 PlaySound "Open Lock Fail"
endif
else
set status to 2
PlaySound "LockedChest"
endif
endif

if ( status == 6 )
set chance to ( Player->GetSecurity )
set chance to ( chance * chance * chance )
set chance to ( chance / 10000 )
set i to Random, 20
set chance to ( chance + i )
set i to ( Player->GetLuck )
set i to ( i / 10 )
set chance to ( chance + i )
;messagebox "Security + Random + Luck chance %.3f" chance

if ( Player->GetItemCount       "skeleton_key" > 0 ); Morrowind only


; if ( Player->HasItemEquipped "skeleton_key" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 2 )
elseif ( Player->GetItemCount       "pick_secretmaster" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_secretmaster" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 1.2 )
elseif ( Player->GetItemCount       "pick_grandmaster" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_grandmaster" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 1.1 )
elseif ( Player->GetItemCount       "pick_master" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_master" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 1.0 )
elseif ( Player->GetItemCount       "pick_journeyman_01" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_journeyman_01" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 0.8 )
elseif ( Player->GetItemCount       "pick_apprentice_01" > 0 ); Morrowind only
; elseif ( Player->HasItemEquipped "pick_apprentice_01" > 0 ); Tribunal/Bloodmoon
set chance to ( chance * 0.6 )
endif
;messagebox "Total chance %.3f" chance

set status to 7
if ( ( Chance * 1.5 ) < pickable )
 MessageBox "You have no slightest idea how to crack this lock"
return
endif
if ( ( Chance * 1.2 ) < pickable )
 MessageBox "You need more skill and better tools to crack this lock"
return
endif
if ( Chance < pickable )
MessageBox "You tamper with the lock but have no success this time"
return
endif
set i to 1000
while ( i >= lock_length )
set i to Random, 9
endwhile
if ( i == 0 )
MessageBox "You believe that the first digit of the code should be %.0f", code1
endif
if ( i == 1 )
MessageBox "You believe that the second digit of the code should be %.0f", code2
endif
if ( i == 2 )
MessageBox "You believe that the third digit of the code should be %.0f", code3
endif
if ( i == 3 )
MessageBox "You believe that the fourth digit of the code should be %.0f", code4
endif
if ( i == 4 )
MessageBox "You believe that the fifth digit of the code should be %.0f", code5
endif
if ( i == 5 )
MessageBox "You believe that the sixth digit of the code should be %.0f", code6
endif
if ( i == 6 )
MessageBox "You believe that the seventh digit of the code should be %.0f", code7
endif
if ( i == 7 )
MessageBox "You believe that the eighth digit of the code should be %.0f", code8
endif
if ( i == 8 )
MessageBox "You believe that the ninth digit of the code should be %.0f", code9
endif
endif

end
MAGIC TOP

Magic regeneration

Script by Zer010

This global script makes the PC's (and only the PC's) Magicka gradually regenerate.
I find it better than sleeping 26 hours at a stretch.
Note that the formula can be changed, as well as the time.

CODE
begin Global_MagickaRegeneration

float regen
float timer
float will

if ( MenuMode == 1 )
return
endif

set timer to ( timer + GetSecondsPassed )


if ( timer < 5 )
return
else
set will to ( player->getwillpower )
set regen to ( ( will +5) / 10 )
player->modcurrentmagicka, regen
set timer to 0
endif

end
MISC
Detecting Player’s Birthsign TOP

Script by The Pixie

This script will detect the player's birthsign, setting the global variable Pix_g_Birthsign. Use it as a
global script.
CODE

begin Pix_sc_Birthsign

; Global script, call only if Pix_g_Birthsign is zero

; 1 The Mage: fay ability


; 2 The Apprentice: elfborn ability
; 3 The Atronach: wombburn
; 4 The Ritual: blessed word, blessed touch, mara's gift
; 5 The Thief: akaviri danger-sense
; 6 The Lover: mooncalf ability, lover's kiss
; 7 The Shadow: moonshadow
; 8 The Tower: beggar's nose spell, tower key
; 9 The Warrior: warywrd ability
;10 The Lady: lady's grace, lady's favor
;11 The Lord: blood of the north, trollkin ability
;12 The Steed: charioteer ability
;13 The Serpent: star-curse
;14 Custom/unknown

; Most signs give an ability that can be detected with GetSpellEffects


if ( Pix_g_Birthsign == 0 )
if ( Player -> GetSpellEffects "fay ability" == 1 )
Set Pix_g_Birthsign to 1
elseif ( Player -> GetSpellEffects "elfborn ability" == 1 )
Set Pix_g_Birthsign to 2
elseif ( Player -> GetSpellEffects "wombburn" == 1 )
Set Pix_g_Birthsign to 3
elseif ( Player -> GetSpellEffects "akaviri danger-sense" == 1 )
Set Pix_g_Birthsign to 5
elseif ( Player -> GetSpellEffects "mooncalf ability" == 1 )
Set Pix_g_Birthsign to 6
elseif ( Player -> GetSpellEffects "warywrd ability" == 1 )
Set Pix_g_Birthsign to 9
elseif ( Player -> GetSpellEffects "lady's grace" == 1 )
Set Pix_g_Birthsign to 10
elseif ( Player -> GetSpellEffects "trollkin ability" == 1 )
Set Pix_g_Birthsign to 11
elseif ( Player -> GetSpellEffects "charioteer ability" == 1 )
Set Pix_g_Birthsign to 12
endif
endif

; Some birthsigns give spells or powers, but they cannot be detected with GetSpell
; Check the character does not have the spell as a spell rather than a birthsign
; Give the spell to the player, this will fail if he has it as already
; If GetSpell says he still does not have the spell, he must have had it already as a birthsign thing
; Otherwise, remove the spell again.

if ( Pix_g_Birthsign == 0 )
if ( Player -> GetSpell "star-curse" == 0 )
Player -> AddSpell "star-curse"
if ( Player -> GetSpell "star-curse" == 1 )
Player -> RemoveSpell "star-curse"
else
Set Pix_g_Birthsign to 13
endif
endif
endif

if ( Pix_g_Birthsign == 0 )
if ( Player -> GetSpell "beggar's nose spell" == 0 )
Player -> AddSpell "beggar's nose spell"
if ( Player -> GetSpell "beggar's nose spell" == 1 )
Player -> RemoveSpell "beggar's nose spell"
else
Set Pix_g_Birthsign to 8
endif
endif
endif

if ( Pix_g_Birthsign == 0 )
if ( Player -> GetSpell "blessed word" == 0 )
Player -> AddSpell "blessed word"
if ( Player -> GetSpell "blessed word" == 1 )
Player -> RemoveSpell "blessed word"
else
Set Pix_g_Birthsign to 4
endif
endif
endif
if ( Pix_g_Birthsign == 0 )
if ( Player -> GetSpell "moonshadow" == 0 )
Player -> AddSpell "moonshadow"
if ( Player -> GetSpell "moonshadow" == 1 )
Player -> RemoveSpell "moonshadow"
else
Set Pix_g_Birthsign to 7
endif
endif
endif

; Catch custom birthsigns


if ( Pix_g_Birthsign == 0 )
Set Pix_g_Birthsign to 14
endif

; Prove it has worked in debug mode (the global Pix_g_Debug is one when debugging)
if ( Pix_g_Debug == 1 )
messagebox "Birthsign is %.0f" Pix_g_Birthsign
endif

stopscript Pix_sc_Birthsign

end

On anyone or anything that is interested in the birthsign, put this at the start of their script, so
the above is called once and only once:
CODE

if ( Pix_g_Birthsign == 0 )
StartScript Pix_sc_Birthsign
return
endif

I have tested this to my satisfaction, but it has not been beta-tested.


Detecting Player’s Facing TOP

Script by Clownbaton

This is a script from my current (and first :] ) mod. Its easy to determine in which direction the
Player is facing but if you want plot any sort of projectile motion relative to the way the player is
facing then you need to know in which Cartesian quadrant you are in and in which direction you are
facing. Basically, this script gives you access to your location and your orientation within each
quadrant. Each unique state is defined by a value and these values can later be used to correctly
plot an object's path. It is supposed to be attached to an equippable object and once the object has
been equipped the user can access the data. a simple modification would mean you could run it as a
global script.

So I guess you could put this one under "location determination" or "projectile motion update
information" or something. I know it sounds like I'm over-complicating it but imagine plotting the
course of a catapult's round? Since "SetPos" sets the world coordinates we need this extra
orientation information.

I've included a pic that should clear things up a bit and yes it was done in MSPaint and no I don't
care. I'm a coder not a modeller.

Piccie link: http://img234.imageshack.us/img234/7493/mw...conventiyr9.jpg

Script:
CODE
begin tjk_scr_PC_Faces

;this will define as a number the orientation of the PC and in which quadrant
;the PC is in. This information will be useful for projectile motion path
;plotting

short OnPCEquip
short PantsOn
short FrameCount
float PCX
float PCY
float PCZ
float TimePassed
short QState ;holds quadrant PC is in
short FState ;holds the local direction PC is facing
short PCAngle ;holds relative angle of the PC

if ( OnPCEquip == 1 )
MessageBox "Player orientation object has been equipped!"
set PantsOn to 1
set OnPCEquip to 0
endif

if ( PantsOn == 1 )
if ( FrameCount < 10 )
set FrameCount to ( FrameCount + 1 )
else
set FrameCount to 0
;now check which world quadrant PC is in
set PCX to ( Player-> GetPos, X )
set PCY to ( Player-> GetPos, Y )
set PCZ to ( Player-> GetPos, Z )

;quadrant 1 check
if ( PCY > 0 )
if ( PCX > 0 )
set State to 1
MessageBox "PC is in Q1"
endif; PCX
endif; PCY

;quadrant 2 check
if ( PCY > 0 )
if ( PCX < 0 )
set State to 2
MessageBox "PC is in Q2"
endif; PCX
endif; PCY

;quadrant 3 check
if ( PCY < 0 )
if ( PCX < 0 )
set State to 3
MessageBox "PC is in Q3"
endif; PCX
endif; PCY

;quadrant 4 check
if ( PCY < 0 )
if ( PCX > 0 )
set State to 4
MessageBox "PC is in Q4"
endif; PCX
endif; PCY

;now we can get the rotation of PC


set PCAngle to ( Player-> GetAngle, Z )
;must first check to see if PC is in line with a local axis
if ( PCAngle == 0 )
set FState to 9
MessageBox "PC is facing North as angle is 0"
Return
endif

if ( PCAngle == -90 )
set FState to 10
MessageBox "PC is facing West as angle is -90"
Return
endif

;if ( PCAngle == -180 )


;set FState to 11
;MessageBox "PC is facing South as angle is -180"
;Return
;endif

if ( PCAngle == 180 )
set FState to 11
MessageBox "PC is facing South as angle is 180"
Return
endif

if ( PCAngle == 90 )
set FState to 12
MessageBox "PC is facing East as angle is 90"
Return
endif

;now we can see if it lies in a local quadrant


;local q1
if ( PCAngle > 0 )
if ( PCAngle < 90 )
set FState to 5
MessageBox "PC is facing p1"
Return
endif
endif

;local q2
if ( PCAngle < 0 )
if ( PCAngle > -90 )
set FState to 6
MessageBox "PC is facing p2"
Return
endif
endif

;local q3
if ( PCAngle < -90 )
if ( PCAngle > -180 )
set FState to 7
MessageBox "PC is facing p3"
Return
endif
endif

;local q4
if ( PCAngle > 90 )
if ( PCAngle < 180 )
set FState to 8
MessageBox "PC is facing p4"
Return
endif
endif

endif; Framecount

endif; PantsOn

end tjk_scr_PC_Faces
Interors Like Exteriors TOP

Script by abot

CODE
begin interiorLikeExteriorScript

if ( GetInterior == 1 )
 if ( GetWindSpeed >= 0.01 )
   MessageBox "This interior is set to behave like exterior"
 endif
endif

end
Keg Script TOP

Script by Lurlock

CODE
begin PRH_Keg_Mazte
short quantity
short activated
short button

if ( onActivate == 1 )
MessageBox "%.3g servings." quantity, "Unload your Mazte", "Pour 1 bottle", "Pour 10 bottles",
"Have a drink!", "Load me up!", "Finished"
set activated to 1
endif

if ( activated != 0 )
Set button to GetButtonPressed
If ( button == -1 )
 return
Elseif ( button == 0 );Unload your Mazte
 set activated to player -> getItemCount "Potion_Local_Brew_01"
 if ( activated > 0 )
  while ( activated > 0 )
   set quantity to quantity + 1
   set activated to activated - 1
   player -> removeItem "Potion_Local_Brew_01" 1
  endwhile
  playSound "Item Potion Up"
  MessageBox "You now have %.3g servings." quantity
 else
  MessageBox "You don't have any Mazte to unload."
 endif
elseif ( button == 1 );Pour 1 bottle
 if ( quantity >= 1 )
  set quantity to quantity - 1
  player -> addItem "Potion_Local_Brew_01" 1
  MessageBox "1 bottles poured.  You have %.3g servings left." quantity
  playSound "Item Potion Up"
 else
  MessageBox "Sorry, you're all out of Mazte."
 endif
elseif ( button == 2 );Pour 10 bottles
 if ( quantity >= 10 )
  set quantity to quantity - 10
  player -> addItem "Potion_Local_Brew_01" 10
  MessageBox "10 bottles poured.  You have %.3g servings left." quantity
  playSound "Item Potion Up"
 elseif ( quantity > 0 )
  MessageBox "You don't have enough for 10 bottles.  Here's %.3g bottles." quantity
  while ( quantity > 0 )
   set quantity to quantity - 1
   player -> addItem "Potion_Local_Brew_01" 1
  endwhile
  playSound "Item Potion Up"
 else
  MessageBox "Sorry, you're all out of Mazte."
 endif
elseif ( button == 3 );Have a drink!
 if ( quantity > 0 )
  if ( player -> getSpellEffects, "PRH_Drink_Mazte" == 1 )
   MessageBox "You just had one.  Wait until it wears off first."
  else
   set quantity to quantity - 1
   MessageBox "Down the hatch!  You have %.3g servings left." quantity
   cast "PRH_Drink_Mazte", player
   playSound "Item Potion Up"
  endif
 else
  MessageBox "Sorry, you're all out of Mazte."
 endif
elseif ( button == 4 );Load me up!
 if ( quantity > 0 )
  set activated to 0
  while ( quantity > 0 )
   set quantity to quantity - 1
   set activated to activated + 1
   player -> addItem "Potion_Local_Brew_01" 1
  endwhile
  playSound "Item Potion Up"
  MessageBox "%.3g bottles poured." activated
 else
  MessageBox "Sorry, you're all out of Mazte."
 endif
else
 set activated to 0
endif
endif
end
Trash Can TOP

Original script by Boblen1982 - rewritten by IxidorsBane

CODE
begin container_reset_scr

short deltimer
;object_reset - glob.variable to start deleting container

if ( object_reset == 0 )
if ( deltimer != 0 )
 set deltimer to 0
endif
return
endif

if ( object_reset == 1 )
if ( deltimer == 0 )
 Disable
endif
if ( deltimer < 4 )
 set deltimer to ( deltimer + 1 )
endif
if ( deltimer == 4 )
 set object_reset to 0
 set deltimer to ( deltimer + 1 )
endif
if ( deltimer == 5 )
 SetDelete, 1
endif
endif

end
-----------part II----------To be put on a hidden activator (a ring under the floor, etc.)

CODE
begin object_activator

;original script by Boblen1982 - rewritten by IxidorsBane

short active
short message_state
short buton
short object_timer
short currentDay
;object_reset - glob.variable to start deleting container

if ( currentDay != Day )
set currentDay to Day
set active to 1
endif

if ( active == 0 )
return
endif

if ( active == 1 )
set active to 2
set object_timer to 0
endif

if ( active == 2 )
set object_reset to 1
set active to 3
elseif ( active == 3 )
set object_timer to ( object_timer + 1 )
if ( object_timer < 6 )
 return
else
 set active to 4
endif
elseif ( active == 4 )
PlaceItem Your Object xPos, yPos, zPos, zAng
set object_timer to 0
set active to 0
endif

end
MOVERS
Activator Wall move TOP

Script by Nikki

Now heres a script that will cause a wall to rise up when that button is pressed, or you get near
that invisible marker. Make an activator from the wall mesh and attach this script to it.

CODE
begin WallMove01_script

float Timer
short State

if ( MenuMode == 1 )
return
endif

if ( var01 == 1 )
if ( State == 0 )
PlaySound3D "SothaDoorOpen"
set State to 1
endif
endif

if ( State >= 1 )

set timer to ( timer + GetSecondsPassed )

if ( Timer < 1 )
Move, Z, 256
set State to 2
endif
endif

end

Use with the actor reset script


Closing a Door TOP

I hate having doors opened all over the place about as much as I hate having to always stop and
close the door. So I created this simple but useful script for my house mod.

Put this on a door and the door will close by itself 5 seconds after being opened.

CODE
Begin ZZA_Door_close_script

Short ContVar
float timer

  ;if the door should happen to get messed up or if the player leaves the cell while a door is not
finished
  ;closing itself this resets everything whenever the player enters the cell
If ( cellchanged > 0 )  
    SetAtStart
    Set ContVar to 0
endif

If ( ContVar == 0 )
    If ( OnActivate )
        Activate
        set ContVar to 1
        set timer to 0
    Endif
Elseif ( ContVar == 1 )
    If ( OnActivate )       ;if the player closes the door by hand
        set timer to 6
    Endif
    set timer to timer + GetSecondsPassed
    If timer > 5
        Activate
        set ContVar to 0
    Endif
Endif

End
Sliding wall trap 1 TOP

Script submitted by Nedius, written by Nedius but made to work by Enmesharra

This should be placed on a mesh that the player stands on to activate a wall mover.

CODE
Begin GDRN_LostStairTrap

float counter
Short doOnce

if ( doonce == 4 ) ;once script has done it's thing, keep it as short as possible
   return
endif

if ( MenuMode == 1 )
  return
endif

if ( doOnce == 3 )
   if ( CellChanged == 1 )
      "in_dwrv_wall_GDRN_1"->disable
      set doonce to 4
      return
  else
    return
  endif
endif

if doonce ( == 0 )               ;trigger when player stands on item


  if ( GetStandingPC == 1 )
    Set doonce to 1
  endif
  return
endif

if ( doOnce == 1 )
  PlaySound "Door Stone Open"
  Set doOnce to 2
endif

Set counter to counter + GetSecondsPassed

"in_dwrv_wall_GDRN_1"->MoveWorld X 80
if ( counter > 6 )
   Set doOnce to 3
   Set counter to 0
endif

end GDRN_LostStairTrap
TOP
Sliding wall trap 2

Script submitted by Nedius, written by Nedius but made to work by Enmesharra

This should be placed on a mesh that the player stands on to activate a wall mover.

CODE
Begin GDRN_LostStairTrap

float counter
Short doOnce

if ( doonce == 4 ) ;once script has done it's thing, keep it as short as possible
   return
endif

if ( MenuMode == 1 )
  return
endif

if ( doonce == 0 )               ;trigger when player stands on item


    if ( GetStandingPC == 1 )
      Set doonce to 1
    endif
elseif ( doonce == 1 )
    PlaySound "Door Stone Open"
    Set doOnce to 2
elseif ( doonce == 2 )
    Set counter to counter + GetSecondsPassed
    "in_dwrv_wall_GDRN_1"->MoveWorld X 80
    if ( counter > 6 )
       Set doOnce to 3
       Set counter to 0
    endif
elseif ( doOnce == 3 )
   if ( CellChanged == 1 )
      "in_dwrv_wall_GDRN_1"->disable
      set doonce to 4
      return
  endif
endif

end GDRN_LostStairTrap
Sliding wall trap 3 TOP

Submitted by Nedius, written by Nedius but made to work by Enmesharra

This should be placed on a mesh that the player stands on to activate a wall mover.

CODE
Begin GDRN_LostStairTrap

short state
float counter
Short doOnce

if ( MenuMode == 1 )
return
endif

if ( GetStandingPC == 0 )
;its best to do it this way ... otherwise the whole script until you step on the mesh
return
endif

If ( doOnce == 0)

set state to 10

endif

if ( state == 10 )

Set counter to counter + GetSecondsPassed

if ( counter < 6 )

"in_dwrv_wall_GDRN_1"->Playsound3DVP "Door Stone Open" 1.0 1.0

"in_dwrv_wall_GDRN_1"->MoveWorld Z 320

elseif ( counter > 6.1 )

Set doOnce to 2
Set counter to 0
Set state to 0

endif
if ( CellChanged == 1 )
if ( doOnce == 2 )
"in_dwrv_wall_GDRN_1"->disable
endif

end GDRN_LostStairTrap
Rotating Objects constantly.
TOP
Script by Nikki

This script will make an object rotate constantly. You should change the X/Y/Z value to alter the
axis, the number to alter the speed.

CODE
Begin rotate

if ( menumode == 1 )
    return
endif

;spin around

if ( OnActivate == 0 )
    Rotate Z 90            ;  Rotate " this is the Axis"  "this is the speed"
    return
    
endif

End rotate
TOP
Up and Down constant movement

This will make a mover rise and then fall again, constantly.

CODE
begin updwn

float      timer
float    uptime

if ( MenuMode == 0 )

    set uptime to 1    

    set timer to ( timer + GetSecondsPassed )

;move up
    if ( timer < uptime )

        Move Z,2

;movedown

    elseif ( timer < (uptime * 3) )

            Move Z, -2

;up again
    elseif (timer < (uptime * 4 ) )
        Move Z, 2

;reset timer to zero


    else
        set timer to 0
        SetAtStart

    endif

endif

end updwn
MUSIC
Over-Riding Battle Music TOP

Script by Nikki

This script causes a certain music file to be played and overrides battle music. I always thought
battle music ruined the element of suprise in MW, as levitation magic ruins the fun of exploration.

First make two rats, one called "music rat 01" and another called "music rat 01b", check the
references persist tab on rat01b. Give each of them a constant paralyze ability. Place this script on
"music rat 01":

CODE
begin no_battle_music

Float timer
Short doOnce

set timer to ( timer + getSecondsPassed )

if ( CellChanged == 1 )
    set doOnce to 0
endif

if ( doOnce == 2 )
    if ( timer > 112 ); insert the length of your track (in seconds) here
        StreamMusic "explore\Morrowind title.mp3"; insert your track name here
        set timer to 0
    endif
    
elseif ( doOnce == 1 )
    if ( timer > 1 )
        StreamMusic "explore\Morrowind title.mp3"; insert your track name here
        set doOnce to 2
        set timer to 0
    endif

elseif ( doOnce == 0 )
    StartCombat "music_rat01b"
    set timer to 0
    set doOnce to 1
endif
end no_battle_music

Then place each of them in the cell somewhere where you cant see them like under a rock or
something. They will try to fight one another but wont be able to move due to the paralyse ability.
The music file you scripted on the other one will loop over and over as long as you are in the cell and
will not be interuppted by battle music.

I got this idea from another poster on this forum but the original had just one rat that attacked
the player. The problem with that version is that any NPCs or creatures with startcombat scripted
on them caused battle music to play again. This one is foolproof.
TOP
NPCs
Changing NPCs clothes daily

Script by Trey Leavens

Here’s a simple script to make a npc wear different outfits on different days, for each day of the
week, and pjs at night. substitute or add lines for whatever outfits you want. they do not have to be
in it's inventory, the equip command additems and equips to npcs.

CODE

begin laundryscript

short currentday
short localday
short shirtchange
short pajammas

if ( currentday != Day )
 set currentday to day
 set localday to ( localday + 1 )
 set shirtchange to 0
endif

if ( pajammas == 0 )
 if ( gamehour >= 20 )
   equip, "nightgown"
   set pajammas to 1
endif

if ( shirtchange == 0 )

 if ( localday == 1 )
   if ( gamehour >= 6 )
     equip, "extravagant_robe_01_c"
     set shirtchange to 1
     set pajammas to 0
   endif
 endif

 if ( localday == 2 )
   if ( gamehour >= 6 )
     equip, "extravagant_robe_01_h"
     set shirtchange to 1
     set pajammas to 0
   endif
 endif

 if ( localday == 3 )
   if ( gamehour >= 6 )
     equip, "extravagant_robe_01_r"
     set shirtchange to 1
     set pajammas to 0
   endif
 endif

 if ( localday == 4 )
   if ( gamehour >= 6 )
     equip, "extravagant_robe_01_t"
     set shirtchange to 1
     set pajammas to 0
   endif
 endif

 if ( localday == 5 )
   if ( gamehour >= 6 )
     equip, "extravagant_robe_01"
     set shirtchange to 1
     set pajammas to 0
   endif
 endif

 if ( localday == 6 )
   if ( gamehour >= 6 )
     equip, "extravagant_robe_01_a"
     set shirtchange to 1
     set pajammas to 0
   endif
 endif

 if ( localday == 7 )
   if ( gamehour >= 6 )
     equip, "extravagant_robe_01_b"
     set shirtchange to 1
     set pajammas to 0
     set localday to 0
   endif
 endif
endif

end laundryscript
TOP
Disposition

Script by Melian

This one is VERY simple, but I seem to remember people asking about NPC disposition control a lot
in the past. Sets an NPC's in-game (not base) disposition to match a variable NPC_Disp.

CODE
begin NPC_local_script

float temp

;short NPC_Disp
;can be local or global, as needed
;can also be a float if you like but not necessary unless you want to mod disp by a float value

if ( MenuMode == 1 )
    if ( NPC_Disp < 0 )
        set NPC_Disp to 0
    elseif ( NPC_Disp > 100 )
        set NPC_Disp to 100
    endif
    set temp to ( GetDisposition )
    set temp to ( NPC_Disp - temp )
    ModDisposition temp
endif

end

The only way to change the NPC's disposition is to set NPC_Disp, nothing else will have any effect.
So no "ModDisposition 10", it's "set NPC_Disp to ( NPC_Disp + 10 )".
Enforced clothing for a companion

Script by Enmesharra TOP

The concept is for a companion to have their own outfit and not wear the stuff you really just want
them to carry for you. This is the simple version, the one I'm using in the mod will allow the player
to choose from several outfits.

The script is started in the result box of the companions greetings. When you give the companion
things to carry, if they are more valuable or have a better armor rating then the companions
personl stuff then they will immediately put them on. Once the dialog ends this script removes all
clothes and re-equips the companions personal outfit. This would work for a merchant as well.

The items ZZA_strip_01 through ZZA_strip_05 - are a set of clothing and armor that cover all
body parts, ensuring the removal of all clothing/armor. The items ZZA_Comp_outfit_1 and
ZZA_Comp_outfit_2 are the companions personal armor and boots.

The potential for abuse exists in that it is easy for the player to create an infinate number of the
companions outfit by removeing them each time. When I included checks to see if the companion
still possed the outfit it slowed the redressing down too much (at least in the complicated
multioutfit version). If someone is going to exploit this, they can just use the console to give
themselves a bunch of money much more easily, so I didn't worry about it. (Except to make the
companions outfit only worth 1 gold piece).

CODE
Begin ZZA_comp_dress_script

short counter

If ( menumode == 1 )
  return
endif

if ( counter < 3 )      ;when called from a greeting the script will run before menu mode
    set counter to ( counter + 1 );registers, this delay prevents that.
    return
endif

If ( GetHealth <= 0 )                ;just in case


    stopscript ZZA_Slave_nodress_script
    return
endif

equip ZZA_strip_01
equip ZZA_strip_02
equip ZZA_strip_03
equip ZZA_strip_04
equip ZZA_strip_05
removeitem ZZA_strip_01 1
removeitem ZZA_strip_02 1
removeitem ZZA_strip_03 1
removeitem ZZA_strip_04 1
removeitem ZZA_strip_05 1

equip ZZA_Comp_outfit_1
equip ZZA_Comp_outfit_2

set counter to 0

stopscript ZZA_comp_dress_script

end
TOP
Guard Script

Script by Stuporstar

Here's a script to control AIEscorts and make sure they will not follow the player through a door
or teleport. It's great for making guards in a particular cell which defend the player but need to
stay put. This was contributed to my mod by Arcimaestro Anteres, and consists of two scripts that
work together:

CODE
Begin Door_EscortControl
; place on door or teleport to prevent escorts following outside

If ( OnActivate == 1 )
    Set NoAIEscort to 1; short global
    Activate
Endif

End

CODE
Begin AIEScort_Control
; place on escorting npc or creature to prevent following out of a cell

If ( NoAIEscort == 1 )
    AiWander 0 0 0 0 0
Endif

If ( CellChanged == 1 )
    AiEscort Player 0 0 0 0 0
    If ( NoAIEscort == 1 )
        Set NoAIEscort To 0
    Endif
Endif

End

Note:
From Yacoby
The guards will not defend the player if the player teleports into the cell.
Making NPC’s fight TOP

A version of this script was submitted by Zer010

This script could be placed on one or the other NPC, or even on a hidden activator in their cell if
there is some reason you do not want the script attached to an NPC. I do not know what distance
you want them for combat to begin, but you can play with the distance value I am using until you are
satisfied.

CODE
Begin Kite_NPCDuel

short doOnce

if ( doOnce == 1 )
   return
endif

if ( ( “NPC1_ID”->GetDistance “NPC2_ID” ) > 2000 ); change ‘2000’ as needed


   return
endif

set doOnce to 1

“NPC1_ID”->SetFight 100
“NPC2_ID”->SetFight 100
“NPC1_ID”->SetFlee 0
“NPC2_ID”->SetFlee 0
“NPC1_ID”->StartCombat “NPC2_ID”
“NPC2_ID”->StartCombat “NPC1_ID”

End Kite_NPCDuel
Making them fight 2 TOP

This script should be placed on NPC1, and another on NPC2. However, the script for NPC2 should
have the locations on NPC1 and NPC2 reversed.

CODE
Begin fightNPC1

Short NoLore
short doOnceA

if ( CellChanged == 0 )
Return
endif

if ( doOnceA == 0 )
if ( GetDeadCount NPC2 == 0 )
StartCombat NPC2
set doOnceA to 1
endif
endif

End fight NPC1


Making them fight two NPCs
TOP
To make an NPC fight with two NPCs, NPC 1 uses this script, NPCs 2 & 3 use the above script,
suitably altered.

CODE
Begin fightNPC1

Short NoLore
short doOnceA
short doOnceB

if ( CellChanged == 0 )
Return
endif

if ( doOnceA == 0 )
if ( GetDeadCount "NPC2" == 0 )
StartCombat "NPC2"
set doOnceA to 1
endif
endif

if ( doOnceB == 0 )
if ( GetDeadCount "NPC3" == 0 )
StartCombat "NPC3"
set doOnceB to 1
endif
endif

End fightNPC1
Making Companions warp to you TOP

Script by Grumpy, Submitted by Zer010

This script is used a lot, it's Grumpy's companion script which causes a companion to "warp" back to
you if it gets too far away ( meaning that it's stuck in a hedge or something ).

You still need to put the companion in follow mode through dialogue/script.

CODE
float myx
float myy
float myz
float timer

if ( GetCurrentAIPackage == 3 )
if ( Player->GetEffect sEffectLevitate == 1 )
AIWander 0 0 0 0
endif

if ( GetWeaponDrawn == 1 )
return
elseif ( GetDistance Player > 800 )
set timer to timer + GetSecondsPassed
if ( timer > 8 )
set timer to 0
set myx to ( Player->GetPos x )
set myy to ( Player->GetPos y )
set myz to ( Player->GetPos z )
SetPos x myx
SetPos y myy
SetPos z myz
endif
endif
endif
endif
Mannequins TOP

Simple Mannequin

Script by Zer010

A simple mannequin script. This freezes an NPC into position so the player can put armour on them.
They're fun but disturbingly detailed for mannequins.

The simplest one is this:


CODE
begin simple_mannequin
skipanim
end

You put it on an NPC with 0 life and "corpses persist" checked, their body stays upright. Problem is
you can get rid of them if you hit "dispose of corpse" when activating them.
TOP
Simple Mannequin

Scripts from http://www.morrowind-mod.com

ARMOR MANNEQUINS - Wooden Armor Mannequins


by Chris Janosi.
These are non-weapon wielding & they are moveable so you need the placeholder script,
which is provided here also.

;script operates armor mannequins it came from Chris Janosi

begin SA_mannequin

short button
short questionState

SkipAnim

if ( menumode == 1 )
return
endif

if ( OnActivate == 0 )
if ( questionState == 0 )
return
endif
endif

if ( questionState == 0 )
MessageBox, "Armor Mannequin", "Move Mannequin", "Add/Remove Armor"
set questionState to 1
endif

if ( questionState == 1 )
set button to GetButtonPressed

if ( button == 0 )
set questionState to 10
elseif ( button == 1 )
set questionState to 0
Activate
endif
endif

if ( questionState == 10 )
MessageBox "Did you remove all items from the mannequin?", "Yes", "No"
set questionState to 20
endif

if ( questionState == 20 )
set button to GetButtonPressed

if ( button == 0 )
set questionState to 0
Disable
player->addItem, "_SA_armorman_placeholder", 1
playSound "Item Misc Up"
elseif ( button == 1 )
set questionState to 0
Activate
endif
endif
TOP
end SA_mannequin

ARMOR MANNEQUIN PLACEHOLDER SCRIPT- used with the above script for Chris
Janosi Mannequins

;script operates armor mannequin placeholders it came from Chris Janosi

begin SA_mannequinplaceholder
short OnPCDrop

if ( OnPCDrop == 1 )
Disable
; PlaceAtPC, "_SA_ArmorMann_Wooden", 1, 64, 0
PlaceAtPC, "_SA_ArmorMann_Wooden", 1, 0, 0
Set OnPCDrop to 0
endif
end SA_mannequinplaceholder
TOP
Pacifying NPCs

Script by Lurlock

CODE
begin punching_Bag
  short OnPCHitMe

  if ( OnPCHitMe == 1 )
      set OnPCHitMe to 0
      stopCombat, player
;Here's a good place to play some sort of sound or whatever.
  endif
end
SCALE TOP
For the scale of your choice, simply edit the ‘setscale X’ number.

Numerous modders have suggested these, or similar scripts. Here a selection. Thanks to all who
submitted.

Scale Script 1

CODE
Begin ScaleScript
short DoOnce
if ( doOnce == 1 )
return
endif
SetScale 3.0
set DoOnce to 1
end ScaleScript

Scale Script 2

CODE
Begin _scale_20

if ( getscale != 20.00 )
setscale 20.00
endif

End _scale_20

Scale Script 3

CODE
begin _scale_5
;replace 5.0 with whatever scale you want it to have

if ( getscale != 5.0 )
setscale 5.0
endif

End
TIMERS TOP

Timer 1

By Zer010

Well, here's a timer


Placed on an activator, it'll make it do something five seconds after activation.

CODE
begin activate_timer

float timer
short doonce1
short doonce2

if ( OnActivate == 1 )
if ( doonce2 == 0 )
set doonce1 to 0
set doonce2 to 1
set timer to ( timer + GetSecondspassed )
if ( timer > 5 )
if ( doonce1 == 0 )
;do something here
set doonce1 to 1
set doonce2 to 0
set timer to 0
endif
endif
endif
end

Or perhaps it would work with timer=5, and one fewer doonce? Dunno...

You might also like