Script Functions

AI

AiActivate , ObjectID, [reset]
AiEscort, ActorID, duration, x, y, z, [reset]
AiEscortCell, ActorID, CellID, duration, x, y, z, [reset]
AiFollow, ActorID, duration, x, y, z, [reset]
AiFollowCell, ActorID, CellID, duration, x, y, z, [reset]
AiTravel, x, y, z, [reset]
AiWander, range, duration, time, [idle2], [idle3], …[idle9], [reset]
GetCurrentAIPackage     ;returns the current package the NPC is doing (0 through 4)
GetAIPackageDone     ;returns true if current package has finished.
GetDetected, ActorID         Returns true if object can detect ActorID. Slow function, do not call a lot.
ForceSneak        Make the npc sneak if he wanted to run he will only walk
ClearForceSneak
GetForceSneak

Animation

PlayGroup, GroupName, [Flags]
LoopGroup, GroupName, Number, [Flags]
SkipAnim

Collision

GetCollidingPC         Object returns true if PC is colliding with it.
GetCollidingActor     Object returns true if ANY actor (including PC) is colliding on it.
HurtCollidingActor, Val     Damages colliding actor Val health per second
HurtStandingActor, float     value is per second and should be negative to hurt him

Combat

GetAttacked             return 0 if the actor has never been attacked and 1 if he has ever been attacked
GetTarget, ActorID         returns 1 if object’s combat target is ActorID
HitAttemptOnMe, ObjectID         returns true if a hit on the calling Actor is attempted by objectID in melee (such as hammer01)
HitOnMe, ObjectID         returns true if calling Actor is hit by objectID in melee (such as hammer01)
OnDeath             Returns true for one frame when Actor is killed.
OnKockout             Returns true for one frame when Actor is knocked out.
OnMurder            Returns true for one frame when Actor is murdered.
OnPCHitMe             NOT A FUNCTION!, but used as a short var that gets set when object is hit.
StartCombat, ActorID
StopCombat

Dialogue

AddTopic, TopicID             Adds TopicID to PC’s list of known topics
ClearInfoActor             Makes this info NOT appear in the journal.
ForceGreeting             makes the NPC start dialogue with the PC. Does NOT matter where the NPC is.
GetJournalIndex, JournalID
Goodbye                 Ends current dialogue, PC can only press “Bye”
Journal, ID, Index             Adds the index entry into the journal for the journal ID
Choice, “Button1”, …[“Button5”]        similar to “messagebox”, but for dialogue choices.
SetJournalIndex JournalID index     Sets the Journal to that index. Can move up or down.

Faction

GetPCRank, [FactionID]         Returns PC’s rank in faction. This will default to the actor’s faction if FactionID is not defined.   Returns 0-9 and -1 if not a member.
GetPCFacRep, [FactionID]
GetRace, “RaceID”         Returns 1 if the object is of RaceID
LowerRank             Lowers the object’s rank in its current faction.
ModPCFacRep, var, [FactionID]
ModFactionReaction, factionID1, factionID2, var
PCClearExpelled         Clears currently expelled flag.
PCExpell [FactionID]             Expells PC from NPCs faction.
PCExpelled [factionID]             Returns 1 if PC has been expelled once from calling object (NPC) Faction, or a faction can be defined to get a specific one.
PCJoinFaction [FactionID]         FactionID is optional if it is not added it will use the faction of the npc who called the function
PCLowerRank
PCRaiseRank     Raises the PC 1 rank in the NPCs faction. If pc is not part of the faction, makes rank 1
RaiseRank             Raises the object’s rank in its current faction.
SameFaction             Returns 1 if PC is in the faction of the calling object (NPC).
SetPCFacRep, var, [FactionID]
SetFactionReaction, factionID1, factionID2, var

Item/Object

AddItem, ObjectID, count         adds item to calling objects inventory
Activate                   activates the item (uses it’s default activation)
Drop, ObjectID, count                 calling Actor drops item into world at his feet.
Equip, ObjectID                     equips the calling item on its owner
GetItemCount, ObjectID             returns the count on the objectID in the calling object
OnActivate                 returns true if calling object is activated
OnRepair                 returns true if calling object is repaired at all
RemoveItem, objectID, count         removes the item from the calling object. Does NOT drop it.
RepairedOnMe, objectID             returns true if calling object is repaired by objected
UsedOnMe, objectID             returns true if objectID is used on calling object

GetWeaponType             returns a number (1-long blade one hand; 2-long blade two hand, 3 - blunt, etc.) based on the class of weapon the actor has equipped.
GetArmorType
HasItemEquipped

See also:

Inventory Scripts

Magic

AddSoulgem, CreatureID, SoulgemID
AddSpell, SpellID             adds spell item to calling object
Cast, SpellID, TargetID             calling object casts spell onto target, spells only.
DropSoulgem, CreatureID        
DisableLevitation             Disables levitation magic.
DisableTeleporting
EnableLevitation
EnableTeleporting
GetBlightDisease             Returns 1 if has BlightDisease
GetCommonDisease             Returns 1 if has CommonDisease
GetEffect, Effect         Returns 1 if Actor is being effected by effect
GetSpell, SpellID             Returns true if object has SpellID in inventory
GetSpellEffects, SpellID             Returns true if calling object is being effected by spellID
HasSoulgem, CreatureID
RemoveSoulgem, CreatureID
RemoveSpell, SpellID             remove spell item from calling objects inventory
RemoveSpellEffects, SpellID         remove spell effects of SpellID from effecting the calling object
RemoveEffects, Effect         removes all spells with the EffectEnum from effecting the calling object

Miscellaneous

Enable                     Makes the object visible and processed.
DontSaveObject            Call when you do not want object change in save game.
Disable                     Makes the object invisible and it will not be processed.
FadeIn time                 time is > 0 and 10.0
FadeOut time                 same as fade in
FadeTo alpha speed             FadeTo 50 2.0 (Fades screen to 50% in 2 seconds). 0 is full transparency. 100 is black.
GetButtonPressed
GetDisabled                 Returns true if object is disabled.
GetLocked                 returns 1 or 0
GetPCCell, Cell ID             Returns true if PC is in CellID named. Works like dialogue in that “Vivec” returns true for both “Vivec” and “Vivec, Fred’s House”.
GotoJail                 Sends PC to Prison.
GetMasserPhase
GetSecundusPhase
GetStandingPC                 Object returns true if PC is standing on it.
GetStandingActor             Object returns true if ANY actor (including PC) is standing on it.
Lock, Var                 sets the door or container to the specified lock level.
MenuMode
MessageBox, “Message”, [var1], [var2], [“button1”], [“button2”]
PayFine                 call after paying a crime fee to clean AI
PlayBink “filename” flag             Pauses game and plays video. Set Flag to true if player can escape movie.
Random, Value
ShowMap cellID             show all the cells that start with this string on the world map
Unlock                     makes object unlocked, doors and containers only
Xbox                     returns true if running Xbox version, used for button messages

SetWaterLevel, Val             Sets water level at a certain height for an interior
GetWaterLevel
ModWaterLevel, Val

Movement

CellChanged             ;returns 1 for one frame when player changes cells
CellUpdate
GetPos, axis
GetAngle, axis
GetLOS, ObjectID         ;returns true if object has a line of sight to other object(ObjectID)
GetDistance, ObjectID         ;returns the distance the object has to ObjectID.
GetStartingPos, axis
GetStartingAngle, axis
Move, axis, units/sec
MoveWorld, axis, units/sec
PlaceAtPC ObjectID, count, distance, direction
PlaceItem, ObjectID,   x, y, z, rot        
PlaceItemCell, ObjectID, celID x, y, z, rot
Rotate, axis, angle/sec
RotateWorld, axis, angle/sec
Position, x, y, z, zRot
PositionCell, x, y, z, zRot, “cellID”
SetAtStart
SetAngle, axis, angle
SetPos, axis, pos

ForceRun         Make the npc run
ClearForceRun
GetForceRun

ForceJump         Make the npc jump like crazy
ClearForceJump
GetForceJump

ForceMoveJump     Make the npc jump when he is moving
ClearForceMoveJump
GetForceMoveJump

GetPCSneaking         Returns 1 if player is in Sneak Mode
GetPCRunning         Returns 1 if player is running
GetPCJumping         Returns 1 ever time the player starts a jump

Player Controls

DisablePlayerControls         Can only look around with mouse or use options menu, nothing else and menus disappear.
DisablePlayerFighting
DisablePlayerJumping
DisablePlayerLooking
DisablePlayerMagic
DisablePlayerViewSwitch
DisableVanityMode
EnableLevelUpMenu
EnablePlayerControls         Enables the controls and menus.
EnablePlayerJumping
EnablePlayerFighting
EnablePlayerLooking
EnablePlayerMagic
EnablePlayerViewSwitch
EnableRest
EnableVanityMode
GetPlayerControlsDisabled
GetPlayerFightingDisabled
GetPlayerJumpingDisabled
GetPlayerMagicDisabled
GetPlayerLookingDisabled
GetPlayerViewSwitch
GetVanityModeDisabled
PCGet3rdPerson             returns 1 if in 3rd person mode
PCForce3rdPerson             queue the change to 3rd person mode (this may have to wait for the animation to finish)
PCForce1stPersonb             same as above but 1st person mode

Player Sleeping

GetPCSleep             Returns true if pc is sleeping.
ShowRestMenu             Brings up rest menu, for beds in illegal cels
WakeUpPC             Wakes up PC

Time

GetSecondsPassed

Script

ScriptRunning, ScriptName
StartScript, ScriptName
StopScript, ScriptName

Sound

GetSoundPlaying soundID
PlayLoopSound3D, “soundID”
PlayLoopSound3DVP, “soundID”, volume, pitch
PlaySound, “soundID”
PlaySoundVP,“soundID”, volume, pitch
PlaySound3D, “soundID”
PlaySound3DVP, “soundID”, volume, pitch
Say, “file name”, “text”         make subject say wav file, only works on animating objects
SayDone             returns true if the object is not saying anything.
StreamMusic, “filename.ext”
StopSound, SoundID         stops the soundID if it is currently playing in the object.

Stats

GetDeadCount, ObjectID     ; returns how many of this objID have been killed
GetStat
SetStat, NewValue
ModStat, Mod
Resurrect             Brings Actor back to life

Weather

ChangeWeather, RegionID, TypeEnum
GetCurrentWeather
ModRegion, RegionID, clear_var, cloudy_var, foggy_var, overcast_var, rain_var, thunder_var, ash_var, blight_var

Console (in game only commands)

CenterOnCell (coc), CellID             Places the PC in the named cell.
CenterOnExterior (coe), X, Y             Places the PC in the exterior cell grid.
CreateMaps “Filename.esp”             Creates map image file for Xbox
FillJournal                     add all entries to journal, takes a long time
FillMap                     show all the towns on the full map
FixMe                         Jump 128 units away from where I am now.
GetFactionReaction factionID factionID     The faction ids are not optional, works in Console window only
Help                         Shows shorthand for most commands
Show
ShowVars (sv)
StopCellTest (sct)
TestCells (tc)
TestInteriorCells (tic)
TestModels ( t3d)
ToggleAI (ta)
ToggleBorders (tb)
ToggleCombatStats (tcs)
ToggleCollision (tcl)
ToggleCollisionBoxes (tcb)
ToggleCollisionGrid (tcg)
ToggleDebugText (tdt)
ToggleDialogueStats (tds)
ToggleFogOfWar (tfow)
ToggleFullHelp (tfh)             show you ownership and script
name
ToggleGodMode (tgm)
ToggleGrid (tg)
ToggleKillStats (tks)
ToggleLoadFade
ToggleMagicStats (tms)
ToggleMenus (tm)
ToggleScripts
ToggleStats (tst)
ToggleSky (ts)
ToggleTextureString (tts)
ToggleWorld (tw)
ToggleWireframe (twf)
TPG                         Toggle path grid display
SG                         Show selected actor’s group members
ST                         Show selected actor’s target group members.
ShowScenegraph (ssg)


34 items under this folder.

  • UsedOnMe

    Returns true if the ObjectId has been used on the calling object.

    • StopScript

      This stops a currently running global script.

      • Stat Script Functions

        Stat Script functions can be used to get or modify stats available to the player or actors.

        • StartScript

          This function starts a script running. This is a Global script.

          • SkipAnim

            Causes the current animation to not be played for this frame.

            • ScriptRunning

              This function returns 1 if the script you ask for is currently running.

              • Rotate

                Rotates the object along the selected axis at the speed selected.

                • RotateWorld

                  Rotates the object along the selected axis at the speed selected. This movement is based on the world axis.

                  • RemoveEffects

                    Removes all spells on the actor that include the Effect.

                    • Random

                      Random returns a value from 0 to the Value - 1.

                      • Position

                        Warps the object to the exterior coordinate location specified by x, y, and z.

                        • PositionCell

                          Warps the object to the interior cell coordinate location specified by x, y, and z.

                          • PlayGroup

                            Plays the animation group defined by GroupName.

                            • PlaceAtPC

                              Places the object at the PC, in the direction you specify and the distance.

                              • PCRace

                                If you want to know the race of the PC check the global flag PCRace.

                                • OnActivate

                                  This function returns TRUE if the calling object has been activated.

                                  • Move

                                    Moves the object along the selected axis at the speed selected.

                                    • MoveWorld

                                      Moves the object along the selected world axis at the speed selected.

                                      • Moon Phases

                                        The GetMasserPhase and GetSecundusPhase functions can be used to track the phase of the moons.

                                        • ModRegion

                                          Changes the weather chances for the RegionID. Used to get rid of, or add weathers to an area permanently.

                                          • MessageBox

                                            The MessageBox script function displays a message on the screen.

                                            • MenuMode

                                              This function should be used in just about every script. It tells you if the player is in menu mode or not.

                                              • LoopGroup

                                                Plays the animation group defined by GroupName.

                                                • GetStartingPos

                                                  Returns the original world position of the object on the selected axis in float.

                                                  • GetStartingAngle

                                                    Returns the original world rotation angle of the object on the selected axis in float.

                                                    • GetSecondsPassed

                                                      Returns the number of seconds passed since the last game frame (in float).

                                                      • GetPos

                                                        Returns the current world position of the object on the selected axis in float.

                                                        • GetPlayerDistance

                                                          This will return the distance in units from the player to this object reference.

                                                          • GetEffect

                                                            This function returns TRUE if the calling Actor is being affected by the effect.

                                                            • GetCurrentPackage

                                                              Used for checking the current AI package an Actor is performing.

                                                              • GetAngle

                                                                Returns the current world rotation angle of the object on the selected axis in float.

                                                                • ChangeWeather

                                                                  Changes the weather in the specified region right now.

                                                                  • CellUpdate

                                                                    Updates the current object's cell position.

                                                                    • Activate

                                                                      This function tells the object to do its default activation.