Script-workspace

Note

Placeholder

Tip

This is the documentation for the openmw implementation of mwscript language and quite naturally it’s implications on gameplay mechanics.

TES3MP Scripting overview

This is placeholder before actual documentation is written.

TES3MP scripting is comprised clientside console commands and serverside lua scripts.

MCP features

cooldowns

enchants
MCP: patch on vanilla code base on where the check to cast change is
gives cooldown to enchants and ability to cast extra charge depending on enchant level
Abilities and powers
OpenMW: abilities don’t go 0 change in failed (interrupted) cast (Revision e24173f9)(1482)

Readme

morrowind scripts categorized and writes

partially copy pasting from from MSFD and wikis

activate

can force player activation on ID by activate, player (vanilla usage without unload cell reference)(2099)

not restricted inside if (onactivate == 1) as in vanilla (needs checking)

animation

playgroup, gruop

plays the animation group in kf file applying it to function target

is the same behavior for 1st and 3rd person view (npc and player alike) referred

don’t loop animations with no loop keys (revision 8bc7eb55)(2223)(2304)

LoopGroup

AI

setflee, -attack, -etc
(distance dependancy?)
getAIpackagedone
return 1 if the package is done vanilla/openmw repair: returns value when next package is called to bypass skipped frame.
startcombat, target

starts the comnat with given target

vanilla: in scripts only works to existing references and first found target.
also placeatme and placeatpc are untargetable

works in console workaround to place reference to somewhere and use positiocell when needed

openmw: striggering when the id is found ingame (ie. not giving error of unfound id before) should be possible as position needs unique id, but could overlap if the position from other cell is anyway used. leading to fix for referencing any id in any cell interfere.

placeatpc and placeatme could also be used in mod as way to safeguard from one from dublicate id otherwise after 1.0 it could be fixed with keywork to handle multiple targets and so on out of the bucket

TEST : current status

equip, objectID

equips the given item in the owner inventory

vanilla: works randomly differing in script and console ie. potions and armors, repair hammers and such

openmw: should work without problems.

TEST : creatures?

check variables

onpcequip

-check after item is equipped to prevent stack contamination (2969) -working with addfunctions inside menumode + realtime updating screens (2967) -don’t set onpcequip for items that failed to equip (revision 992b7703)

revent’s walse alarm in worn item check (2776)

-use on equip function (revision c04a8afc) -run the script after setting OnPcEquip, but before actually equipping the item to allow setting onPCskipequip (Bug #3016) not exactly right bug (mentions)

revision 7983b07b (bk_treasurereport script)
check also on using enchanted (any) items pcskipeguip variable handling ( 1 = skip equipping, 0 = allow ) execute item script once, immediately after getting onpceguip bypass after skipped with pcskipequip and pcskipequip set to 0 allowing afterhand equip (same script?)

movement

setangle, axis, angle
workings ingame and via scripts?
getangle, axis
returns the angle in relation to given world axis
rotate, axis, speed
reference’s axis
rotateworld, axis, speed
global axis

difference in local and global rotation in openmw?

face, target
makes the npc face the desired target

position

-interior and exterior behaviour when using underground, outside or in allowed space -if something fails, player is teleported to coe 0,0 , daedric ruin with scamp running around

coe, centeronexterior and coc, centeroncell
-don’t copy the height info when teleporting causing possible death on ground level
position
effect of water and groundlevel on behavior
positioncell

places the reference inside the cell into given coordinates

vanilla: buggy. accepting float variables is picky and moving object from far away cell is not guaranteed to load + arbitary move can cause crash on activation

openmw: should work right out of the bucket with variables and loading + script execution

placeatpc, ID, distance, direction
places given object
fixme unimplemented (1421)
hard to detect collision at random relocation

messsagebox

behavior at different tages
on screen script dialogue multiples (almost impossible to detect on runtime)

getbuttonpressed

dialogue

inventory related

addsoulgem, creature, soulgem

vanilla: referencded soulgem need to be in target inventory for function to work openmw: adds soulgem if not alredy in inventory

if

no nested if / elseif limit like in vanilla or script lenght for that matter

elseif

while

will execute after whole script is run once due to structure preventing getting getbuttonpressed from inside while loop for if condition

unittest

requests: (wishlist)

unequip like function / disable / setdelete on worn items (2960)

base scripts need removeitem and additem for all similar content in inventory losing script variable data, nonunique reference being unrefencelable

Sources

AI

—-AiFollowcommands

AiFollow

AiFollowCell

AiEscort

AiEscortCell

—-AiExecutionState

GetAIPackageDone

GetCurrentAIPackage

ToggleAi, Tai

—-AiDetection

GetDetected

GetLineOfSight, GetLos

Face

—-AiCommands

AIActivate

AITravel

AIWander

—-AiCombat

StartCombat

StopCombat

GetTarget

—-AiHelloState

SetHello

ModHello

GetHello

—-AiFightstate

SetFight

ModFight

GetFight

—-AiFleestate

SetFlee

ModFlee

GetFlee

—-AiAlarmstate

SetAlarm

ModAlarm

GetAlarm

Animation

Note

Animation in gerenal is handled in the kf files.

LoopGroup

PlayGroup

SkipAnim

PlayBink

Container

—-Generic

AddItem

RemoveItem

GetItemCount

HasSoulGem

—-Invertory

GetArmorType

GetWeaponType

Equip

HasItemEquipped

Dialogue

—-Journal

Journal

SetJournalIndex

GetJournalIndex

—-Reputation

SetReputation

ModReputation

GetReputation

—-Faction

SetFactionReaction

ModFactionReaction

GetFactionReaction

SameFaction

—-Topics

Addtopic

ClearInfoActor

ForceGreeting

Choise

Goodbye

Cell

—-CenterOn

CenterOnCell / coc

CenterOnExterior / coe

—-Waterlevel

SetWaterLevel

ModWaterLevel

GetWaterLevel

—-CellStates

CellChanged

GetInterior

GetPCCell

Control

Enable

Disable

GetDisabled

SetDelete

Gui

—-Chargen

enablebirthmenu

enableclassmenu

enablenamemenu

enableracemenu

enablestatreviewmenu

—-Resting

enablerest

enablelevelupmenu

showrestmenu

—-Map

togglefogofwar, tfow

showmap

fillmap

—-Various

getbuttonpressed

togglefullhelp, tfh

Miscellaneous

—-Activating

onactivate

activate

—-Locking

lock

unlock

getlocked

—-Magic effects

See also

magic efffects in stats

geteffect

getspelleffects

cast

explodespell

addspell

removespell

removespelleffects

removeeffects

getspell

—-Drop functions

drop

dropsoulgem

—-Console toggles

togglecollisionboxes, tcb

togglecollisiongrid, tcg

togglewireframe, twf

togglewater, twa

toggleworld, tw

togglepathgrid, tpg

togglevanitymode, tvm

togglegodmode, tgm

togglescripts

toggleborders, tb

togglenavmesh

setnavmeshnumber

toggleactorspaths, tap

—-Fading

fadein

fadeout

fadeto

—-View mode

pcforce1stperson

pcforce3rdperson

pcget3rdperson

—-Player state

getpcsleep

getpcjumping

getpctraveling

getpcinjail

—-Movies

playbink

—-Criminality

get-, set-, modpccrimelevel

payfine

payfinethief

gotojail

—-Soulgems

addsoulgem

removesoulgem

—-Combat states

getweapondrawn

getspellreadied

getattacked

—-Hit detection

hitonme

hitattemptonme

getstandingpc

getstandingactor

hurtstandingactor

getcollidingpc

getcollidingactor

hurtcollidingactor

—-Show game infos

showvars, sv

show

betacomment, bc

ori

showscenegraph, ssg

—-Teleporting

enableteleporting

disableteleporting

—-Levitation

enablelevitation

disablelevitation

—-Leveled lists

addtolevcreature

removefromlevcreature

addtolevitem

removefromlevitem

—-Various

xbox

getsquareroot

getwindspeed

getcurrenttime

fall

dontsaveobject

repairedonme

wakeuppc

Sky

—-Moons

turnmoonwhite

turnmoonred

getmasserphase

getsecundaphase

—-Weather

changeweather

getcurrentweather

modregion

togglesky, ts

Sound

—-Music

streammusic

—-Sounds

stopsound

getsoundplaying

playsound

playsoundvp

playsound3d

playsound3dvp

playloopsound3d

playloopsound3dvp

—-Talkings

say

saydone

Transformation

—-Scale

setscale

getscale

modscale

—-Angle

setangle

getangle

getstartingangle

—-Rotation

rotate

rotateworld

—-Position

setpos

getpos

getstartingpos

position

positioncell

move

moveworld

—-Placing

placeitem

placeitemcell

placeatpc

placeatme

—-Resetting

setatstart

resetactors, ra

fixme

Stats

—-Attributes

—-prefixes:

set-
get-
mod-

strength

intelligence

willpower

agility

speed

endurance

personality

luck

—-Dynamics

—-prefixes:

Get-
Set-
Mod-
ModCurrent-
Get- - -Getratio

health

fatigue

magicka

—-Skills

—-prefixes:

Get-
Set-
Mod-

—-Defence

unarmored
lightarmor
mediumarmor
heavyarmor
block

—-Offence

bluntweapon
longblade
axe
spear
shortblade
marksman
handtohand

—-Magic

destruction
alteration
illusion
conjuration
mysticism
restoration
enchant
alchemy

—-Others

armorer
security
sneak
athletics
acrobatics
mercantile
speechcraft

—-Magic effects

—-prefixes:

Get-
Set-
Mod-

—-Resists

resistmagicka
resistfire
resistfrost
resistshock
resistpoison
resistparalysis
resistdisease
resistblight
resistcorprus
resistnormalweapons

—-Others

waterbreathing
waterwalking
swimspeed
chameleon
invisible
silence
blindness
paralysis
superjump
flying
castpenalty
attackbonus
defendbonus
armorbonus

—-Various

resurrect

ondeath

onmurder

onknockout

—-Faction

getpcrank
pcraiserank
pclowerrank
raiserank
lowerrank
pcexpell
pcexpelled
pcclearexpelled
pcjoinfaction
get-, set-, modpcfacrep

get-, set-, moddisposition

setlevel

getlevel

getstat

getdeadcount

getcommondisease

getblightdisease

getrace

—-werewolf

getwerewolfkills
iswerewolf
becomewerewolf
undowerewolf
setwerewolfacrobatics