Device Customization - DeviousDevices/Docs GitHub Wiki

This page describes a number of ways that one can extend the scripting of Devious Devices, to create completely new / custom device effects. If you're looking for more basic information, see the Creating a new device page.

zadEquipScript.psc forms the basis of all device logic. The devices are designed in an Object Oriented manner, in order to assist Modders in extending, and customizing their behavior.

To get started, you will need to create a new script, first decide upon the type of device you wish to create. A list of relevant scripts follows:

Device Type Script Notes
Chastity Belts zadBeltScript.psc
Plugs zadPlugScript.psc
Bras zadBraScript.psc
Collars zadCollarScript.psc
Cuffs (Arms) zadRestraintArmsScript.psc
Cuffs(Legs) zadRestraintLegsScript.psc
Gags zadGagScript.psc Includes Enchantments
Harness (Chastity Belt) zadBodyHarnessBeltScript.psc
Harness (Non-Chastity) zadBodyHarnessScript.psc
Blindfolds zadBlindfoldScript.psc
Nipple Piercings zadPiercingNippleScript.psc
Vaginal Piercings zadPiercingVaginalScript.psc
Armbinders zadArmbinderScript.psc Armbinder Scripting
(Anything Else) zadEquipScript.psc The base script

Once you have selected a base device type, create a new script extending that type. Example:

ScriptName myCustomCollar extends zadCollarScript
zadLibs Property libs Auto

Function OnEquippedPre(actor akActor, bool silent=false)
	if !silent
		libs.NotifyActor(GetMessageName(akActor)+" is about to equip my custom collar!", akActor, true)
	EndIf
EndFunction

In this case, if an actor were about to equip your collar, the above message would be displayed. There are many such functions that can be extended, to customize your device's behavior to your liking.


OnEquippedFilter

int Function OnEquippedFilter(actor akActor, bool silent=false)

This function allows you to implement conditions under which it is okay to equip your device. You will be either returning 0 or 2 from your filter, in most cases.

###Return Values###

Code Description
0 Okay to proceed with equipping the device.
1 Do not proceed with equipping the device.
2 Do not proceed with equipping the device, and unequip the inventory instance of it.

OnEquippedPre

Function OnEquippedPre(actor akActor, bool silent=false)

Any code within this function will be run just prior to your device being equipped.

OnEquippedPost

Function OnEquippedPost(actor akActor)

Any code within this function will be run just after your device is equipped.

OnRemoveDevice

Function OnRemoveDevice(actor akActor)

Any code within this function will be run just after your device is removed (By script, or by the player directly).

NoKeyFailMessage

Function NoKeyFailMessage(Actor akActor) ; Display fail removal for devices without a key

Any code within this function will be called if the player attempts to remove a device from an NPC without the key.

DeviceMenu

Function DeviceMenu(Int msgChoice = 0)
        msgChoice = zad_DeviceMsg.Show() ; display menu
	if msgChoice == 0 ; Equip Device voluntarily
		DeviceMenuEquip()
	elseif msgChoice == 1	; Remove device, with key
		DeviceMenuRemoveWithKey()
	elseif msgChoice == 2 ; Remove device, without key
		DeviceMenuRemoveWithoutKey()
	endif
	DeviceMenuExt(msgChoice)	
	SyncInventory()
EndFunction

This function is the root of all direct device interaction (Brought up by activating the item in your inventory). In general, unless you're looking to completely overhaul how your device interacts with the player, you should extend one of the below functions instead.

DeviceMenuExt

Function DeviceMenuExt(Int msgChoice)

This function is called whenever DeviceMenu is called. The intended usage case for this function, is to allow you to add on additional interaction options for devices. For example, the Inflatable plugs have a deviceExt function that looks like this:

Function DeviceMenuExt(Int msgChoice)
	if msgChoice == 4
		squeezeMsg.show()
		libs.UpdateExposure(libs.PlayerRef,2)
	EndIf
EndFunction

DeviceMenuEquip

Function DeviceMenuEquip()

This is called whenever the player voluntarily equips a device which offers such an option (The armbinder, for instance).

DeviceMenuRemoveWithKey

function DeviceMenuRemoveWithKey()

This is called whenever the player attempts to remove a device, while having the proper type of key (But not necessarily the proper key itself).

DeviceMenuPickLockSuccess

string Function DeviceMenuPickLockSuccess()

DeviceMenuPickLockModerate

string Function DeviceMenuPickLockModerate()

DeviceMenuPickLockFail

string Function DeviceMenuPickLockFail()

DeviceMenuPickLock

Function DeviceMenuPickLock()

DeviceMenuDestructionSuccess

string Function DeviceMenuDestructionSuccess()

DeviceMenuDestructionModerate

string Function DeviceMenuDestructionModerate()

DeviceMenuDestructionFail

string Function DeviceMenuDestructionFail()

DeviceMenuAlterationSuccess

string Function DeviceMenuAlterationSuccess()

DeviceMenuAlterationModerate

; string Function DeviceMenuAlterationModerate()

DeviceMenuAlterationFail

string Function DeviceMenuAlterationFail()

DeviceMenuConjurationSuccess

; string Function DeviceMenuConjurationSuccess()

DeviceMenuConjurationModerate

; string Function DeviceMenuConjurationModerate()

DeviceMenuConjurationFail

string Function DeviceMenuConjurationFail()

DeviceMenuRestorationSuccess

; string Function DeviceMenuRestorationSuccess()

DeviceMenuRestorationModerate

; string Function DeviceMenuRestorationModerate()

DeviceMenuRestorationFail

string Function DeviceMenuRestorationFail()

DeviceMenuIllusionSuccess

; string Function DeviceMenuIllusionSuccess()

DeviceMenuIllusionModerate

; string Function DeviceMenuIllusionModerate()

DeviceMenuIllusionFail

string Function DeviceMenuIllusionFail()

DeviceMenuMagic

Function DeviceMenuMagic()

DeviceMenuBruteForceFail

string Function DeviceMenuBruteForceFail()

DeviceMenuBruteForce

Function DeviceMenuBruteForce()

DeviceMenuCarryOn

Function DeviceMenuCarryOn()

DeviceMenuRemoveWithoutKey

Function DeviceMenuRemoveWithoutKey()