Jump to content

[Scripting] Remove Devious Devices without DD as Hard Dependency?


Nymra

Recommended Posts

Posted

Heyho,

 

I just successfully made my Naked Defeat mod working with Devious Devices Equip, which allows the to work via soft depenency and its great mod events.

So in short: I already can ADD devious devices.

 

Now I want to scan for certain devices if they are equiped or not, like yokes, armbinders etc. (their respective zad keywords).

But I dont see any mod events in place in DD (zadlibs), or with DDe that I could use.

Do I miss something here? is there any common mod that allows such things?

 

Or do I have to make a DD depencency again to use their internal functions?
I understand that would be required since I need a zad script as propery (zadlibs) :(

 

My idea now is: either someone has some mod event ideas?

(sendmodevent: aktorWearsDevices (zad_DeviousArmbinder, zad_DeviousArmbinderElbow, zad_DeviousHeavyBondage, zad_DeviousHobbleSkirt, zad_DeviousHobbleSkirtRelaxed) 

(sendmodevent: aktorRemoveDevices (zad_DeviousArmbinder, zad_DeviousArmbinderElbow, zad_DeviousHeavyBondage, zad_DeviousHobbleSkirt, zad_DeviousHobbleSkirtRelaxed) 

 

or would it be possible to make an ESP patch for my mod that adds the zad propery and has the DD hard dependency?

Thx alot.

 

Posted
8 minutes ago, AndrewLRG said:

Well, there two ways to do that.

1) Manually registering property zadlibs for entire script

_aaaTest.psc 309 B · 0 downloads

2) Second method registers zadlibs for only one function.

_aaaTest2.psc 317 B · 0 downloads

 

 

 

 

uuuh, wow, very cool. Did not know something like that is possible. 
More Script sorcery, heheh. I feel like Dirty Harry Potter ^^

 

thx alot, will try these out!

  • 2 weeks later...
Posted
On 4/16/2021 at 5:39 PM, AndrewLRG said:

Well, there two ways to do that.

1) Manually registering property zadlibs for entire script

_aaaTest.psc 309 B · 5 downloads

2) Second method registers zadlibs for only one function.

_aaaTest2.psc 317 B · 4 downloads

 

 

 

 

hmmm, I found out that I could make this work without hard depenency, but now the mod does not work correctly or initilaize in a Load Order without Devious Devices installed.

So its not a hard dependency but.... still also is....

 

Might be I just failed to implement it correctly, tho,...

 

this is the errors I get in the Papyruslog:

 

Quote

[04/25/2021 - 04:40:17AM] Error: Unable to link type of variable "libs" on object "nade_calmquest_qf_scr"
[04/25/2021 - 04:40:17AM] Error: Unable to link types associated with function "OnInit" in state "" on object "nade_calmquest_qf_scr".

 

 

 

this is how I implemented the scripts (nvm my clunky check function, its an early version ^^ I was glad anything worked up until this point).

Maybe, since all this seems to be high magic for me anyway, I need to use the version of your script examples that only applies all this for only ONE function.

 

I just wonder then if the problem persists or if I have to build some kind of extra check that prevents the script from calling the function IF DD is not installed, hmm. 
sorry and thank you :D

 

 

zadLibs libs

Event OnInit()
	if Game.GetModByName("Devious Devices - Expansion.esm") != 255
		libs = (Quest.GetQuest("zadQuest") As zadLibs)
	endif
endevent

			
Bool DeviceCheck = false	

Bool Function CheckDevices() 

if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousArmbinder)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousArmbinderElbow)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousHeavyBondage)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousHobbleSkirt)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousHobbleSkirtRelaxed)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousYoke)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousYokeBB)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousStraitJacket)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousPlug)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousGag)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousPlugAnal)
DeviceCheck = true
endif
if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousPlugVaginal)
DeviceCheck = true
endif
if DeviceCheck
return true
else
return false
endif
EndFunction 

 

Posted

I guess its happening because CheckDevice() it trying to use property "libs", but since we don't have DD installed 'libs = none'.

What if we try to perform a check inside function CheckDevice(). Something like:

 

Bool Function CheckDevice()

if Game.GetModByName("Devious Devices - Expansion.esm") != 255

      libs = (Quest.GetQuest("zadQuest") As zadLibs)

      if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousArmbinder)

            DeviceCheck = true

      endif

      ; etc

endif

EndFunction

Posted
4 minutes ago, AndrewLRG said:

I guess its happening because CheckDevice() it trying to use property "libs", but since we don't have DD installed 'libs = none'.

What if we try to perform a check inside function CheckDevice(). Something like:

 

Bool Function CheckDevice()

if Game.GetModByName("Devious Devices - Expansion.esm") != 255

      libs = (Quest.GetQuest("zadQuest") As zadLibs)

      if libs.isWearingDeviceType(cfgqst.PlayerRef, libs.zad_DeviousArmbinder)

            DeviceCheck = true

      endif

      ; etc

endif

EndFunction

 

already tried inside of a function and it also failed. But not like this. I think.... hmm 

Will try this later, thx! 


 

Function RemoveDDs()

if Game.GetModByName("Devious Devices - Expansion.esm") != 255
	zadLibs libs = (Quest.GetQuest("zadQuest") As zadLibs)
	Armor idevice = None
	Armor rdevice = None
	Keyword kw = None
	Keyword token = None
	if !cfgqst.PlayerRef.WornHasKeyword(libs.zad_Lockable)
		Debug.Trace("nade_: RemoveDDs aborting")		
		return
	endif			
	Int i = cfgqst.PlayerRef.GetNumItems()
	Debug.Trace("nade_: RemoveDDs i:"+i)	
	While i > 0			
		i -= 1
		Form kForm = cfgqst.PlayerRef.GetNthForm(i)
		Debug.Trace("nade_: RemoveDDs kForm:"+kForm)			
		If (kForm As Armor)
			if kForm.HasKeyword	(libs.zad_InventoryDevice) ;libs.zad_DeviousStraitJacket) || kForm.HasKeyword(libs.zad_DeviousYokeBB) || kForm.HasKeyword(libs.zad_DeviousYoke) || kForm.HasKeyword(libs.zad_DeviousHobbleSkirtRelaxed) || kForm.HasKeyword(libs.zad_DeviousHobbleSkirt) || kForm.HasKeyword(libs.zad_DeviousHeavyBondage) || kForm.HasKeyword(libs.zad_DeviousArmbinderElbow) || kForm.HasKeyword(libs.zad_DeviousArmbinder)
				idevice = kForm As Armor
				Debug.Trace("nade_: RemoveDDs idevice:"+idevice)	
				if idevice
					rdevice = libs.GetRenderedDevice(idevice)
					Debug.Trace("nade_: RemoveDDs rdevice:"+rdevice)
					kw = libs.GetDeviceKeyword(idevice)
					Debug.Trace("nade_: RemoveDDs kw:"+kw)
						;filter keywords 

						
					if (kw == libs.zad_DeviousHeavyBondage) || (kw == libs.zad_DeviousPlug) || (kw == libs.zad_DeviousBelt) || (kw == libs.zad_DeviousGag) || (kw == libs.zad_DeviousPlugAnal) ||(kw == libs.zad_DeviousPlugVaginal)       
						If idevice && rdevice && kw
							; we got a valid DD item here, let's remove it

							libs.removeDevice(cfgqst.PlayerRef, idevice, rdevice, kw, destroyDevice = true, skipevents = false, skipmutex = true)
							Debug.Trace("nade_: actually removing stuff")						
						EndIf
						;Utility.Wait(1)
					EndIf
				Endif			
			EndIf
		EndIf
	EndWhile
endif

EndFunction

 

Posted

Your problem is this: 

you should not cast/declare as an external/foreign type in a normal script if you don't know for certain that that dependency will be installed (hard dependency). It will break stuff. Either your own stuff or someone else's stuff. 

 

SLS has plenty of examples of how to get around this. 

 

 

Posted
33 minutes ago, Monoman1 said:

Your problem is this: 

you should not cast/declare as an external/foreign type in a normal script if you don't know for certain that that dependency will be installed (hard dependency). It will break stuff. Either your own stuff or someone else's stuff. 

 

SLS has plenty of examples of how to get around this. 

 

 

 

oi! 

 

ok, wow. 
Will read into this and also look up the SLS code. 

 

For now I found a workaround via DDequips mod events (is this just me or is this really the cleanest method of making soft dependencies?) 

I was just surprised DD framework does not offer Modevents that help one bit. Or I just missunderstood the ones I found :D

Posted

That makes thing more complicated. :) So, we need to call optional scripts through global functions.

 

nadeUtil.psc

 

I've deleted libs properties in nade_configquest_scr, nade_playeralias_scr, nade_calmquest_qf_scr and changed libs.isWearingDeviceType() (and others) to nadeUtil.isWearingDeviceType(). "Unable to link" errors seem to disappear.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...