Jump to content

Recommended Posts

View File

Surprise Equip

 

This mod behaves similarly to Deviously Cursed Loot; whenever the player opens a container, there is a random chance of an item equipping itself to the player, or a spell being cast on them. Unlike CursedLoot, however, this mod is extendable. Other mods are able to register their items or spells with Surprise Equip, and they will have a chance of appearing when a container is opened.

 

Surprise Equip is something of a framework, in that sense. On its own, no spells or items are included. You will need to install other mods that add their items/spells to this one. My other mod, Becoming Futanari, has the option to register some of its spells with Surprise Equip. (As soon as I can update it, that is. Just wait 5 or so minutes so I can upload it, okay?)

 

This mod is not a replacement for Deviously Cursed Loot, but a supplement. No longer are you limited to just bondage items

 

For modders

 

If you're a mod creator and want to add your own content to Surprise Equip, listen up! This mod uses ModEvents, so there is no need to list Surprise Equip as a dependency.

 

To register an item to be equipped, invoke the event "JBT_SurpriseEquipRegisterItem". It takes two parameters: a Form pointing to the item you want to register, and a float representing the relative chance for your item to be chosen (aka its weight). Here's an example of what that would look like:

Function RegisterSurpriseItem(Form akItem, float defaultWeight)			int handle = ModEvent.Create("JBT_SurpriseEquipRegisterItem")		if (handle)			ModEvent.PushForm(handle, akItem)			ModEvent.PushFloat(handle, defaultWeight)			ModEvent.Send(handle)		endif			EndFunction

Similarly, you can register a spell by invoking the event "JBT_SurpriseEquipRegisterSpell". Here's what that would look like:

Function RegisterSurpriseSpell(Spell spellRef, float defaultWeight)			int handle = ModEvent.Create("JBT_SurpriseEquipRegisterSpell")		if (handle)			ModEvent.PushForm(handle, spellRef as Form)			ModEvent.PushFloat(handle, defaultWeight)			ModEvent.Send(handle)		endif			EndFunction

Changelog

 

_____• 0.2.0
__________• All properties that were previously set in the creation kit are now filled using Game.GetFormFromFile
__________• Used SkyUI's versioning system to automatically re-fill the properties when an update has been detected
__________• Added two events: OnUnregisterItem and OnUnregisterSpell. These will allow other mods to un-register their items, for example if they're updating or uninstalling.
__________• OnRegisterItem() now updates the item's default weight, even if it's already been registered.


  • Submitter
  • Submitted
    05/31/2016
  • Category
  • Requires
    SKSE, PapyrusUtil, SkyUI
  • Special Edition Compatible

 

Link to comment

I have a question. Is this mod gives the opportunity for other modes or just yours?
Are you using the capabilities of other mods DD, such as DD, DDE, cursed loot., which are installed in the game? Is the creator has to do something to take advantage of it?

Link to comment

I can see this happening

 

fights way through a dungeon

reaches the boss

barely wins with 25% hp left

opens the final chest of the cave

Summon Dremora x5 spell activates from chest

pause game and tries not to cry

turns over

cries alot

Link to comment

I have a question. Is this mod gives the opportunity for other modes or just yours?

Are you using the capabilities of other mods DD, such as DD, DDE, cursed loot., which are installed in the game? Is the creator has to do something to take advantage of it?

 

Good questions.

 

Surprise Equip will work for any other mod that takes advantage of it, not just ones that I've made.  However, Becoming Futanari is currently the only mod that supports it, and is the main reason I wrote it.

 

Surprise Equip does not use or modify Devious Devices or Cursed Loot.  It is meant as a workaround for people who want to extend Cursed Loot's functionality.  

 

For example, let's say I wanted to modify Cursed Loot to add a trap that makes your character grow a schlong.  I'd need to edit Cursed Loot's source and add my magic effect to a giant cascade of if-statements.  This would work just fine for personal use, but I wouldn't be able to share my modification without also distributing a modified version of Cursed Loot's script.  Why is that bad?  You'll see in a minute.

 

Now let's say somebody else, we'll call him Person B, wants to add a new chastity belt to Cursed Loot.  So, they do exactly what I did: they modify Cursed Loot's source and add their chastity belt to the giant wall of if-statements.  But now, my mod is incompatible with Person B's mod, because they both modify the same script.  And unlike with .esp files, there is no way to automatically resolve that conflict without...you guessed it, manually editing the script.

 

That's because Cursed Loot manually assigns every device an index.  It then generates a random number between 0 and 40(that's a made up number, but the point is that it's a constant).  Then it manually checks each device to see if the number is equip do the device's index.  There is no list of devices, just a big wall of if-statements.  In pseudocode, it would look something like this:

 

 

 

 

Form Function ChooseDevice()
    
    int index = Random(0, 40)

    if (index == 0)
        return ChastityBelt

    elseif (index == 1)
        return Armbinder
    
    elseif (index == 2)
        return RubberSuit

    elseif (index == 3)
        return CursedCollar

    ;...fast forward...
   
    elseif (index == 39)
        return TentacleParasite

    endif

EndFunction

 

 

 

The solution that I came up with is Surprise Equip.  Instead of having a giant wall of if-statements to choose which device to equip, Surprise Equip has a FormList that keeps track of all items and spells.  When it's time for Surprise Equip to equip a device, it generates a random number between zero and the length of the list, and then chooses whichever item is in that position.(that's a simplification).  In pseudocode, Surprise Equip looks something like this:

 

 

 

Form Function ChooseDevice()
    
    int index = Random(0, itemList.length)
    return itemList.getAt(index)

EndFunction

 

 

 

If another modder wants to add their own device or spell, they don't need to edit my ChooseDevice function.  Instead, they can write their own separate script that adds their device to itemList.

 

_______________________________________

 

Surprise Equip does NOT equip any devious devices or trigger any of Cursed Loot's effects (that is, unless someone writes an addon that adds those items to the list).  That's why I say it's a supplement to Cursed Loot.  If you have both Suprise Equip and Cursed Loot installed at the same time, then they will both run independently of each other.  Cursed Loot will trigger whenever it's programmed to, and Surprise Equip will trigger whenever *it's* programmed to.  It's entirely possible for both mods to trigger at the same time.

Link to comment

 

.  It's entirely possible for both mods to trigger at the same time.

 

 

Which is actually not entirely without problems. If somebody would add, say, a chastity belt to your drop list and both yours and my mod would trigger at the same time, and both would try to equip a belt, they would actually fight over who gets to occupy the belt slot first. That's not very likely to happen for any particular user mind you, but if it becomes commonplace to install both mods, the law of great numbers demands that it -will- happen for some. So, while I agree that these mods are perfectly compatible with each other in their current state (I looked at the code), if somebody starts making your mod drop DD items and has Cursed Loot installed as well, they could conflict quite easily. That's something to keep in mind, I guess.

Link to comment

 

 

.  It's entirely possible for both mods to trigger at the same time.

 

 

Which is actually not entirely without problems. If somebody would add, say, a chastity belt to your drop list and both yours and my mod would trigger at the same time, and both would try to equip a belt, they would actually fight over who gets to occupy the belt slot first. That's not very likely to happen for any particular user mind you, but if it becomes commonplace to install both mods, the law of great numbers demands that it -will- happen for some. So, while I agree that these mods are perfectly compatible with each other in their current state (I looked at the code), if somebody starts making your mod drop DD items and has Cursed Loot installed as well, they could conflict quite easily. That's something to keep in mind, I guess.

 

 

That's a very good point.  If Cursed Loot tries to equip a devious device during normal gameplay and there is already one present, what is the default behavior?  Does Cursed Loot override the existing one, or does it just abort?

Link to comment

 

 

 

.  It's entirely possible for both mods to trigger at the same time.

 

 

Which is actually not entirely without problems. If somebody would add, say, a chastity belt to your drop list and both yours and my mod would trigger at the same time, and both would try to equip a belt, they would actually fight over who gets to occupy the belt slot first. That's not very likely to happen for any particular user mind you, but if it becomes commonplace to install both mods, the law of great numbers demands that it -will- happen for some. So, while I agree that these mods are perfectly compatible with each other in their current state (I looked at the code), if somebody starts making your mod drop DD items and has Cursed Loot installed as well, they could conflict quite easily. That's something to keep in mind, I guess.

 

 

That's a very good point.  If Cursed Loot tries to equip a devious device during normal gameplay and there is already one present, what is the default behavior?  Does Cursed Loot override the existing one, or does it just abort?

 

 

For standard devices, it doesn't happen. Cursed Loot will not equip items into an already occupied slot (it checks before it tries to equip).

Quest items are a bit more complicated: If Cursed Loot wants to start a quest, it checks if the item occupying the slot in question is a generic/standard device, and if yes, it unequips it and replaces it with the quest item. Cursed Loot will -never- unequip quest items. All its quests have failsafes in place to make sure they don't start if a needed slot is taken by someone else's quest item.

Link to comment

I can see this happening

 

fights way through a dungeon

reaches the boss

barely wins with 25% hp left

opens the final chest of the cave

Summon Dremora x5 spell activates from chest

pause game and tries not to cry

turns over

cries alot

 

This is what I had in mind, instead of a replacer / extender for DD related mods.  Something like this could be "cleaned" though it probably does not have any sex ties (from the description of what it does, at least) and uploaded to the Workshop, Nexus, or anywhere else.

 

I can see a whole variety of "vanilla" types using something like this for poison traps, spells, and such.  There was at least one mod that changed diseases and poisons to make them actually dangerous, and using those as traps on containers would make gameplay a lot more hazardous, and would fit in with iNeed or Realistic Needs and that bunch.

 

I don't know if someone wanted to, but you could also "trap" containers to sound alarms (probably via a script, not exactly a magical effect, but I don't know ) that would either spawn a guard, alert any still living guards, or just set a variable flag so that elsewhere, an NPCs dialog makes a comment about you rummaging around in his pantry.

Link to comment
  • 1 month later...

Hey sorry for the necro bump. I kinda want an addon to this mod that randomly equips SOS Size change potions. Specifically slaps the player with an SOS Decrease Size potion as a random trap. Would that be easy to make myself? Does this mod have an MCM or something?

Link to comment

Hey sorry for the necro bump. I kinda want an addon to this mod that randomly equips SOS Size change potions. Specifically slaps the player with an SOS Decrease Size potion as a random trap. Would that be easy to make myself? Does this mod have an MCM or something?

 

If you already know the basics of scripting, then it should be super-simple.  You'll want to copy/paste the RegisterSurpriseItem function from my OP into a quest script you create.  Then, when the quest starts, it should call that function with your potion as a parameter.

Link to comment
  • 1 month later...

Function RegisterSurpriseItem(Form akItem, float defaultWeight)
	
		int handle = ModEvent.Create("JBT_SurpriseEquipRegisterItem")
		if (handle)
			ModEvent.PushForm(handle, akItem)
			ModEvent.PushFloat(handle, defaultWeight)
			ModEvent.Send(handle)
		endif
		
	EndFunction
Function RegisterSurpriseSpell(Spell spellRef, float defaultWeight)
	
		int handle = ModEvent.Create("JBT_SurpriseEquipRegisterSpell")
		if (handle)
			ModEvent.PushForm(handle, spellRef as Form)
			ModEvent.PushFloat(handle, defaultWeight)
			ModEvent.Send(handle)
		endif
		
	EndFunction

 

I would register the mod's ESP/ESM name as well. That way you can clean up items/spells from any mods that use this and then later get removed.

 

Link to comment

I would register the mod's ESP/ESM name as well. That way you can clean up items/spells from any mods that use this and then later get removed.

I don't know if that's possible or not. Items are registered using scripts, and scripts can register items from *any* .esp file. Since scripts aren't associated with .esp files, there'd be know way to know which script registered it that way.

 

The best thing I can do is give other mods the tools to clean up after themselves. That's what I've done in the most recent update; I added the OnUnregisterItem and OnUnregisterSpell events, which do exactly what they say on the tin. I'll update the OP with info on those events ASAP.

Link to comment

 

I would register the mod's ESP/ESM name as well. That way you can clean up items/spells from any mods that use this and then later get removed.

I don't know if that's possible or not. Items are registered using scripts, and scripts can register items from *any* .esp file. Since scripts aren't associated with .esp files, there'd be know way to know which script registered it that way.

 

The best thing I can do is give other mods the tools to clean up after themselves. That's what I've done in the most recent update; I added the OnUnregisterItem and OnUnregisterSpell events, which do exactly what they say on the tin. I'll update the OP with info on those events ASAP.

 

This should work.

string nameOfMod = Game.GetModName( item.GetBaseObject().GetFormID() >> 24 )

Though I can't remember what happens to the form ID's when load order is changed. I think the game internals track the mods name when a reference is loaded so when myMod.esp gets moved in the load order from 0x08 to 0x10 a mod reference of 0x08XXXXXX gets updated to 0x10XXXXXX.

 

 

Link to comment

My want to experiment between these two and dump the output to the console to make sure you're getting the right mod. Think the former may get the DDI esm while the later would get the mod that included an item from the DDI esm

string nameOfMod = Game.GetModName( item.GetFormID() >> 24 )
Link to comment
  • 2 weeks later...

I add my item into your mods Via TESV Edit, the item shown in MCM... and spawn well.

how to I integrated your mods and script into my own ESP? Should I Rename a Script/Source as well? Sorry I'm Sucks in scripting Skill...

 

Can I spawn 2 or 3 items at once (like Devious Chastity and plug) all together?

Link to comment

I add my item into your mods Via TESV Edit, the item shown in MCM... and spawn well.

how to I integrated your mods and script into my own ESP? Should I Rename a Script/Source as well? Sorry I'm Sucks in scripting Skill...

 

Can I spawn 2 or 3 items at once (like Devious Chastity and plug) all together?

 

If you add them in the way you did, it won't work correctly.  My mod keeps track of the total weight of all items registered to it, and simply adding your items directly to the FormList won't tell my mod that it needs to update its total weight.  Additionally, it won't assign your items a default weight.

 

To properly register the items you want:

 

  • Use creation kit to make a new mod
  • Create a new quest that starts by default
  • Create a new script for this quest
  • In the creation kit, add all of the items and spells you want as properties for that script
  • In the script, paste the first two functions, RegisterSurpriseItem and RegisterSurpriseSpell, from my original post.  Put it beneath all of the stuff that's already there.
  • In the OnInit event for this script, call RegisterSurpriseItem for every item you want to add, and RegisterSurpriseSpell for every spell you want to add.
  • Save as a .esp file in creation kit

I recommend doing a basic Papyrus tutorial if you haven't already.

 

There's no built-in way to add "groups" of items that get equipped together, unfortunately.  However, there's a way around that.  Create a new spell, and have it equip those items to the player when it's cast.  Then register that spell with SurpriseEquip using the above method.

 

Have fun!  Ask again if you need help.

Link to comment
  • 1 year later...

 

so i decided to make a test esm file and add mods to the suprise equip form list and it seems to work the item shows up the mcm, now i know this is not recommended way of doing it but for me with limited scripting knowledge it works the best. 

 

my question is it possible to spawn in enemies through this...

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use