OBSE Wish List

Revision as of 21:56, 9 January 2010 by imported>Angel (→‎Language Enhancements: add one)
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

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.
  • 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.
  • [ref].On[blocktype] [ObjectID] Would be used as a block type in quest scripts which would run as if the block type is used in the reference or object's script.
  • 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.
  • EquipItem2 - Just like EquipItem except runs the item's OnEquip block.
    • If it's your own item, you can use an onUnEquip block for this one. Unequipping an item, and then requipping it in the next line, will still run the item's onUnEquip block. Since the onUnEquip block will run after the calling script (the one that did the UnEquipItem and EquipItem), you can use a GetEquipped check, in the onUnEquip block, to make sure the item is equipped.
    • Using OnUnequip blocks is a good idea. However, if it's not allowed to modify the script on the item I want to equip, I cannot use OnUnequip blocks. I think it'd be a great help for some mods like scruggs' "Expanded Hotkeys and Spell Delete".--Isatin 16:30, 12 November 2007 (EST)
  • DuplicateAllItems2 - Same as DuplicateAllItems, but doesn't create a new ID/cloneformed item for each scripted item that's duplicated
  • 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.
  • PushActorAway2 - just like PushActorAway except that the calling ref don't have to be an Actor

Modifications/Extensions of OBSE Functions

  • 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 Force Upper/Lower case - Add two new commands - %u and %l - to force the first character of a variable to be either upper or lower case. For example, using %u %pp at the start of a sentence would print as His, Her ot Its, instead of his, her or its.
  • 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.


Language Enhancements

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.
  • OnActorHits (Id Optional) - This block will be run once when the scripted actor hits the specified Object or actor.
  • OnDetect- runs when the actor detects the target actor.

Audio Functions

Functions dealing with music and sound:

  • 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

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

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

Functions that return a reference:

  • getLastAttacked - Returns a reference to the actor last attacked by the calling actor.
  • getLastActivated - Returns a reference to the last object activated by the player or calling actor.
  • (reference).GetLastKilled - Returns the reference of the last actor killed by the player/an actor.

Actor Functions

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

UI Functions

  • SelectDialogResponse - Choose a particular answer in a dialog (e.g. Yes, No, Cancel, Optionx, etc.)


Other Functions

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
  • EquipMe - Makes the actor holding the calling reference equips it. Even better if it can trigger OnEquip blocks.
  • 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)
  • GetDimension [x|-x|y|-y|z|-z] - returns the distance from the object 'origin' to its outer limit in the requested axis and direction - very useful when moving/placing/aligning/spacing references by script. (a typical NPC with the origin at the feet would return 125 to Z (origin to top) and 0 to -Z (origin to bottom)
  • GetCollidingRefs - returns an array of the references colliding with the calling reference. <OR> GetFirst/NextCollidingRef - returns one at a time.


Questionable Requests

"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

  • 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

  • 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.