OBSE Wish List

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
Note : Function requests are better made in the current OBSE discussion thread. Search for Oblivion Script Extender (OBSE) at the BGS forums to find the latest one.


This wish list is a place to put ideas for inclusion in OBSE. It will be kept organized, consistent, and clean as possible. That means your contribution may be edited or deleted in order to keep this list manageable. Contributions will only be deleted if they are redundant - either because Oblivion came with a function for this, or because the function has already been requested. Contributions may be edited for a large variety of reasons, from consistency to aesthetics. Please do not take this personally.

Care will be taken to include a name with any requested function if that request is signed. If you don't care about having your name attached, please do not sign your request, since it will keep the list neater.

If, for any reason, you disagree with a change or deletion from this list, please discuss this in the Talk page - we are not infallible, it is entirely possible that we misunderstood the need or use of a given function, and we need that explained so that the contribution can be reverted into its original form and/or be changed into something more appropriate.

To keep the list more manageable, requests have been broken down into categories according to the type of function and, in some cases, the probable ease of implementation. Requested functions which can be accomplished with existing functions appear in a separate section at the bottom of the list.

To avoid requesting a feature which is already available, first consult the OBSE documentation and the list of OBSE Wishes Fulfilled.

Modifications of Existing Functions[edit | edit source]

Tweaks to functions already present in the scripting language:

  • PlayMagicShaderWeapon - Similar to the standard "PlayMagicShaderVisuals", but plays a magic shader only on an actor's equipped weapon; Not the body, not the scabbard, just the weapon. Like an enchantment shader. Could be abbreviated to "pmsw", much like how the template can be shortened to "pms". May require a contingency for when the equipped weapon are unarmed/fists (IE: nothing happens).
  • StopMagicShaderWeapon - The counterpart to the above command, it acts like "StopMagicShaderVisuals". Like its template, and like the counterpart requested function, it could be shortened to "smsw" for convenience.
  • PlayMagicShaderArmor - As above, but with specific pieces of armor. Perhaps could have a flag for scabbard. Could be abbreviated pmsa. would be used instead of above for unarmed fists.
  • StopMagicShaderArmor - The counterpart to the above command. it would act like "StopMagicShaderVisuals". Could also be shorted to "smsa" as well.
  • castNoAnim - When called on an actor, the actor casts the spell without playing the casting animation.
  • castut - when called, the actor casts a spell in the direction he/she is facing without needing a target.
  • DeleteClonedForm - Delete the reference and base object of a cloned form like DeleteFullActorCopy
  • SetObjectAlpha - Just like SetActorAlpha except works on any object, not just actors.
  • EnablePlayerControls2/DisablePlayerControls2 - Acts like the original functions but without hiding UI.
  • Resurrect2 - Like Resurrect but doesn't remove all of your abilities when called on the player, nor causes camera issues.
  • PushActorAway2 - just like PushActorAway except that the calling ref don't have to be an Actor
  • ResurrectActorHealthPercent- Resurrects the target actor with the given health remaining.
  • SetLocalGravity/SetLocalGravityVector - These functions seem to have no effect at all while an actor is swimming or under water. It would be very helpful if they had an effect actually, because this would allow to simulate burden and buoyancy under water.

Modifications/Extensions of OBSE Functions[edit | edit source]

  • IsKeyPressed2+3 - IsKeyPressed2 can pick up tapped keys, IsKeyPressed3/IsControlPressed can pick up disabled keys. Combining them into one IsKeyPressed4 function would be nice, but more to the point being able to do both with an IsControlPressed2 would make coding much easier.
  • MessageBoxEx Centre Message - add a new command to force the text in a message box to be centred, in the same way that the buttons are.
  • SetRaceNthSpell - Sets the race's Nth spell. Useful for adding spells to races without conflicting with other mods, when used in combination with GetRaceSpellCount.
  • MessageBoxEx Silent Menu - Add a way to set the box to silent, so no sound plays when the menu pops up and no sound plays when you click a button. Useful for mods where you want to play your own custom sound for just one menu, or want to play a sound while the menu is there, without being cut off by the sound the MessageBox makes.
  • Ar_Sum - Sums the numeric values ranging from start to end. Syntax would be
ar_Sum src:array start, end

Language Enhancements[edit | edit source]

New control structures and data types:

  • onBreak - This block runs when a scripted spell hits an inanimate object.
  • anyMode - Runs in gameMode and menuMode.
  • Global reference variables, to avoid issues where calling quest.refVar.someFunction is not allowed.
  • Return2 - Unlike Return stopping the scripts in this frame, Return2 only breaks the current block and other blocks in the same script can be still run. Useful for the script writers who want to use multiple Return to reduce the use of nested if/endif blocks without missing the calling of other blocks.
  • OnDetect- runs when the actor detects the target actor.

Audio Functions[edit | edit source]

Functions dealing with music and sound:

  • PlaySound2/PlaySound3D2 - This function allows more than one copy of the same sound to be played before the first one finishes. Example: Normally if one sound lasts 3 seconds and is played twice within that time, the second one will never play. Using PlaySound2/PlaySound3D2 any subsequent instances of the first sound will play no matter how many times they were called before the oldest playing one finished.
  • stopSound - stops a looping sound from playing.
  • EnableTrivialSound/DisableTrivialSound - While disabling trivial sounds, the sounds played by the functions in scripts like AddItem, RemoveItem, EquipItem, Activate (while picking up items), and even for the actions done by the player like while equiping or picking up items. Mainly for script writers to avoid these interface sounds with a simple way when they want something to be done in the background.

AI Functions[edit | edit source]

Functions dealing with combat, crime, detection, and AI:

  • setHitBy actorID, damage - damages the actor and updates AI as if the calling actor had attacked them. The Kill function might provide a shortcut to implementing this function, as it allows an actorID parameter to be specified as the attacker.
  • SetHostile - would force the calling actor to behave as if they perceived a hostile threat, assuming such states can be imposed in the absence of real combat.


Animation and Graphics Functions[edit | edit source]

Functions dealing with animations or game rendering:

  • forceDismount - Forces a mounted actor to dismount.
  • ReloadCell or UpdateLighting - Reloads the cell as if the player had just entered or as if he were moved out of and then back into the cell; or updates the illumination of lights on static objects. Kind of a specific request to eliminate issues with disabled and re-enabled lights not illuminating properly.
  • Get/SetFacialData - Returns/sets facial data of the calling actor.
  • GetShader: Returns shader(s) active on PC camera (e.g. nighteye, hitshader/blur, etc).
  • ForcePickIdle - force an Idle to be played even if the player is not on the ground or under any other circumstance that would usually block pickidle.
  • SetCellAmbientLight: Accepts 3 integer values that set the red, green, and blue ambient light values in an interior cell. A GetCellAmbientLight function would also be nice.

Functions Returning a Reference[edit | edit source]

Functions that return a reference:

  • getLastActivated - Returns a reference to the last object activated by the player or calling actor.

Actor Functions[edit | edit source]

Functions which read or alter the state of an actor:

  • SetRace - Allows you to change the race of an actor
  • DropEquipped [slot] - Drops the equipped item according to the given equipment slot. This function keeps the item's statuses like RemoveMe or disarmament.
  • GetKilledBy - Get the reference by whom the actor was killed. Should be available in blocks like actorId.GetDead == 1.
  • GetHitBy - Returns the reference whom just hit the actor.
  • GetAge - Returns the age of the actor if it is an NPC
  • SetAge - Allows you to change the age of an NPC
  • MatchRace- Changes the target reference's race to match another Actor. Similar to SetRace above, but allows for custom races and races not defined in the CS.
  • MatchFaceData- Changes the target's face data to match another Actor.
  • IsInWater WaterTypeID - returns 1 if actor is currently being underwater or even touching the water, even with Water Walking. Specifying the optional WaterTypeID allows us to check whether the actor is currently touching the specific type of water.
  • ForceLeaveWater SwimmingFlag NoReenteringFlag - forces actor to leave the water. If SwimmingFlag is not specified or set to 0, actor will attempt to completely leave the water, even if he's only touching it, not swimming. With SwimmingFlag set to 1, this function will only force him to get high enough to be no longer swimming. With NoReenteringFlag set to 1, using this function will force actor to avoid touching water/swimming (and thus if he's pushed back into water, he will again attempt to leave it). If function below was previously used with NoLeavingFlag, using ForceLeaveWater will nuke the effects of this flag.
  • ForceEnterWater SwimmingFlag NoLeavingFlag - forces actor to find the closest area where he can touch the water and attempt to enter it. With SwimmingFlag set to 1, called actor will not only try to touch the water, but start swimming. Could have no effect in interiors and worldspaces with no water. With NoLeavingFlag set to 1, using this function will prevent actor from leaving the water (and thus if he's pushed away from the water, he will again attempt to enter it). If function above was previously used with NoReenteringFlag, using ForceEnterWater will nuke the effects of this flag.
  • ClearWaterBehaviour - clears the NoReenteringFlag and NoLeavingFlag from functions above.
  • IsEquipmentSlotFree [slot] - returns 1 if the specified slot is free, and 0 when not.

UI Functions[edit | edit source]

  • SelectDialogResponse - Choose a particular answer in a dialog (e.g. Yes, No, Cancel, Optionx, etc.)
  • SetEffectItemScriptEffectIcon (Effect ID) (Path/Filename.dds) - Causes the "Script Effect" of a magic item (Spell, enchantment, etc.) to display a custom icon instead of the default Script Effect icon. Affects every "Script Effect" on the item without changing non-script effect's icons.

Other Functions[edit | edit source]

Functions which don't fit into other categories:

  • GetCollisionTrace - Generalized version of GetLOS to return where collision occurs, rather than a boolean expression of success or failure. Traces a line from a start point to a destination point and returns a two-dimensional array. Each row corresponds to a point where collision with a new object is detected from the start to destination, with four columns: the reference ID of the colliding object, and X,Y,Z coordinates of the collision. If collision is never detected, returns an empty array. Actors are ignored for the collision check if optional parameter ignoreActors is true, defaults to false. If necessary for efficiency, implementation can include a distance between collision checks specified by optional parameter distanceSkip, defaulting to 16 (or some other efficient value).
Usage:
array<float> startRef:reference.GetCollisionTrace destRef:reference, ignoreActors:bool, distanceSkip:float
array<float> GetCollisionTrace startX:float, startY:float, startZ:float, destX:float, destY:float, destZ:float, ignoreActors:bool, distanceSkip:float
  • GetCollisionTraceSpherical - Same as GetCollisionTrace, but uses spherical coordinates to calculate the destination point.
Usage:
array<float> startRef:reference.GetCollisionTraceSpherical distance:float, elevation:float, heading:float, ignoreActors:bool, distanceSkip:float
array<float> GetCollisionTraceSpherical startX:float, startY:float, startZ:float, distance:float, elevation:float, heading:float, ignoreActors:bool, distanceSkip:float
  • RevertName - Called on a reference or base object with the 'Named' property to revert its name to its original definition in the construction set. Examples: if setname or setnameex is used on Shadowmere to name her "Darkness", calling RevertName on 'ShadowmereRef' or 'Dark10Horse' would reset her name to "Shadowmere". Likewise, if a mod is loaded that explicitly sets the name property of Shadowmere to "Black Beauty" using the CS (and assuming her name is then set (in game) to "Darkness" using setname or setnameex), calling RevertName on her should set her name to "Black Beauty". I.E. The name should be set to whatever is defined in the construction set, with regard to installed mods.
  • GetModRecords - With the advent of arrays in OBSE v17, this request seems possible. The function returns an array of the records introduced by a particular mod. For example, the first level of the array would store an array for each of Actors, Items, Magic, Miscellaneous, and WorldObjects. The contents of each subarray would be the records that each CS category contains that are new/introduced by the mod. For example, If there is a mod loaded that adds 5 books to the game, and the mod is 8th in this imaginary load order, calling GetModRecords, passing 08 as the mod index, should return an array, and let's call it arItems. arItems[Actors], arItems[Magic], etc. would be empty, but arItems[Items] would contain 5 records (numeric keys are used as opposed to labels, this is just for illustration). These 5 records should be the FormID's of the five books. In this way, one could search a mod for records, and make use of them in-game using placeatme or additem.
  • SetIsPersistent - allows persistence to be toggled via script.*
  • [optional reference].AutocalSpellMagickaCost spellID - autocalculates spell cost including area factor, duration factor, and range factor based on the formula in FMagicCasterSkillCostMult. If optional reference is included, also calculates in the skill factor for that actor (including luck).
  • LoadObject - Forcibly cache/load an object, or LoadCellBuffer which would load/cache an entire cell, sort of opposite to PurgeCellBuffers
  • Get/SetCellFogNear & Get/SetCellFogFar - Get and set interior cell fog distance.
  • GetStartingCell CellID - Returns true if editor cellID is the same a the parameter specified.
  • GetGroundPos - Returns the groundlevel co-ordinate of the current cell.
  • Add/RemoveMajorSkill - Adds or removes major skill on calling actor.
  • Add/RemoveClassSkill - Adds or removes class skill for indicated class (If above request is prohibitive)
  • GetCollidingRefs - returns an array of the references colliding with the calling reference. <OR> GetFirst/NextCollidingRef - returns one at a time.
  • TrainSkill- similar to advskill, only trains the skill as if you are training it in-game.
  • IsRemoved- to check if a persistent reference is removed from the game - for instance put in chest scripted with RemoveAllItems, dropped in an oblivion world which got purged or put in the inventory of a dead actor which got deleted. IsFormValid returns true for a persistent reference in all these cases, and there seems to be no way to know if such a reference is still around.
  • ForceFunctionValue- Forces a function to always return a value with the number specified. For instance
ForceFunctionValue GetIsPlayableRace 0

would force the function GetIsPlayableRace to return 0, no matter what the calling reference is. Adding an optional reference parameter would set the function to return a specific value whenever the function is called on that reference. So,

ForceFunctionValue GetIsPlayableRace 0 player

would force GetIsPlayableRace to return 0 every time it is called on the player, but normal values any time it's called on someone else. For debug, limitation, and certain Gameplay Effect purposes.

  • ReleaseFunctionOverride- Releases the effect of ForceFunctionValue and allows the function to continue acting normally.
  • getReference - Returns a string containing the reference given to the calling reference in the editor. This string can be used like
set stringVar to anyRef.getReference
set stringVar.anyVariable to x

Questionable Requests[edit | edit source]

"Questionable" is not meant to be demeaning. These requests may be unclear, or it may be possible to implement them using existing functions, thus they receive lower priority. If you disagree with a function's classification here, discuss it on the TALK page:

Requests that can be implemented with current functions[edit | edit source]

  • getStandingActor - use onTrigger.
  • isBowDrawn - use IsKeyPressed2 in conjunction with getControl to find out when the attack button is pressed and how long it is held down.
  • cellChanged - use getParentCell.
  • getActorID - use getActionRef.
  • PCActivateActorInventory - This can be done using DuplicateAllItems to copy the actor's inventory to a container, then calling Container.Activate player. OBSE's inventory functions provide other ways of doing this as well.
  • "Function scripts" - use an OnActivate block in a persistent reference's script, and call Activate to run the code inside it.
  • DropAllItems - Similar to RemoveAllItems, but causes all items in inventory to appear at the actor's feet as in Drop.

This can be done using existing OBSE functions: [[1]]

  • SetScript [ScriptID] [ObjectID] - Replaces the attached script of the give object and returns the previous script if applicable.

This can be done by cloning an object with the desired script, and using various functions (i.e., CopyName, SetWeight) to make the clone look like the desired item. Any other use of this particular function might be unstable, as other mods will expect the original script to be on the original object.
This function is included in OBSEv12, however, it should be considered a beta function and not released in public mods, as the effects of replacing a script have not been tested yet (and doesn't follow, for the most part, good modding etiquette)

  • Activate the Magnitude option for script effect spells, then send it to a float variable (fMagnitude) in the related script. (Would allow the script to behave differently based on the magnitude of the spell).

The magnitude won't show up in game, but it will be the number you set it to (with SetNthEffectItemMagnitude, and you can use GetNthEffectItemMagnitude to return that number. By the way, it will be an integar, as with any other spell effect.

  • RemoveAllItems2 - Like RemoveAllItems, but removes quest items too.

This can be done by scanning through the player's inventory, listing all quest items in a separate inventory, changing the quest status to non-quest items, using RemoveAllItems, and then going through the quest item list to return their quest item status.

  • GetCrosshairDistance - How far away is the item or surface under the crosshair?

This can already be done with GetDistance using the reference returned by GetCrosshairRef and player.

The above only works if the object is within the activate distance. You can, however, change that distance with the GMST setting functions: [[iActivatePickLength].
  • GetEquipmentSlot - Extend this function to detect more inventory slot groups. currently, lower body with foot combination is not documented as available.

This can be done with GetEquipmentSlotMask

  • EnableMessage/DisableMessage - While disabling messages, the messages (on top-left corner) sent meanwhile won't be queued and never be shown. EnableMessage can reset this flag.

Spam-blocking versions of functions like AddItem and RemoveSpell will be available in OBSE v0015. Completely blocking UI messages is possible, but would cause conflicts with other mods which need to display messages and therefore is unlikely to be implemented.

    • GetClothingGoldValue - Returns the actual value of worn equipment in gold, where armor and weapons count as 0 gold.
    • GetEquipmentGoldValue - Returns the actual value of worn equipment in gold.
    • GetBackpackGoldValue - Returns the actual value of all items on an actor in gold.
Although it would be nice to have OBSE do the work for you, all three of these can be done using a loop and GetInventoryObject or GetEquippedObject. v0017 will include commands which return equipped items or all inventory items as an array variable which will allow these calculations to be done much more quickly in scripts than currently possible.
  • Drop2 - Same as basic drop, but returns a reference that actually works, instead of a null one. Use GetPCLastDroppedItemRef
  • Min|Max Var1 var2 . . . Var n - The usual: returns the smaller|larger value from the list (just a convenience to do [If A > B] [Set A to B] [Endif] in a single line: [Set A to Min A B] )
Put the values in an array, sort the array, extract the first or last element.

Unclear requests[edit | edit source]

  • spread - Explain what this function is supposed to do...
  • evaluateEquippedItems - Use a dummy AI package to force the actor to evaluate his equipped items.
  • All 4 functions below have the same issue - The requester seems to want references rather than the object record. It is currently unclear whether items with different stats are actually stored separately in the inventory, and as of now, there are no ways to specify any one of these items or grab the reference of an item in a container.
    • RemoveItem2 [ObjectID] (TargetContainer) - Removes the items of the same type to the target container and keep the item statuses (like stolen, health, charge, and poison).
    • DuplicateItem [ObjectID] [TargetContainer] - Copies the items of given type in the calling container to the target with the same quantity. It keeps the same ObjectID for scripted items. I'm not sure if it's possible to give the count in the parameter list. It seems there's no way to distinguish among the item with the same type even if they have different item statuses. Hope I'm wrong.
    • Drop2 [Reference] - Drops the given reference from the calling container. DropMe only works for ObjectID and is not suitable for a reference. Unlike DropMe, you have to first add the item to drop. You don't need (and probably cannot) add the reference to a container.
    • AddItem2 [Reference] - Adds the given item reference to the calling container. The reference is still valid while it's in the container, and it can keep its item statuses even after being dropped on the ground. I guess it might be impossible to do these due to the item maintenance mechanism used by the engine. But I wish we could.