Jump to content

[FO4 CK] General Help Thread


Recommended Posts

I'll just hit you with a quote from my last post:

"Scripts of type ReferenceAlias receive all events that the filled object reference receives, including, but not limited to, actor events."

Link to comment
22 hours ago, ag12 said:

Forget all that stuff Carreau just told you about using perks/magic effects and importing the actor script (??)... your problem is so common that Bethesda themselves had it when they worked on Skyrim, so they put an entire system in place to deal with it. It's called Quest Aliases, you can find all the necessary information on the wiki.

Just make a new ReferenceAlias, force it to fill the player in the CK, then attach a script to the RefAlias. Scripts of type ReferenceAlias receive all events that the filled object reference receives, including, but not limited to, actor events.

 

Most of Fallout 4's quests are actually built around using Quest Aliases, it's the only acceptable way of doing this sort of thing in the current iteration of the engine. Any other method is either way more expensive, harder to do maintenance on or has a high chance of producing script ghosts in your savegame (such as the magic effect variant). If you don't know what you're doing, use the systems that Bethesda uses - they are usually the cheapest.

 

Check our the wiki, check out how the vanilla quests handle things and if it still doesn't click, let me know - if I get the time, I'll help.

okay, thanks a lot, i will look at it :) and again thanks for your help

Link to comment
7 hours ago, ag12 said:

I'll just hit you with a quote from my last post:

"Scripts of type ReferenceAlias receive all events that the filled object reference receives, including, but not limited to, actor events."

I must have missed that. Cool deal then. 

Link to comment

Yeah I just use Alias's for all scripts now, there's very few things they can't do, pretty much all the functions and events work in them, other scripts its always a game trying to work out what works and what doesn't with all that "native script" bullcrap.

Link to comment
  • 2 weeks later...

Does anyone know what makes the Hunger,Thirst and Sleep increase over time?

i want something to increase overtime but idk what to search for in CK. 

Link to comment
1 hour ago, Halstrom said:

Stupid quick question what does GetWornItem return? It doesn't seem to be Armor or Form or ObjectReference

 

Form fmCurrSlot33 = rActor.GetWornItem(33)

https://www.creationkit.com/fallout4/index.php?title=GetWornItem_-_Actor

 

 

For Armor you can use item or model.

And use Wornitem instead of form.

 

Wornitem fmCurrSlot33 = rActor.GetWornItem(33)

Armor slot33Armor= fmCurrSlot33.item

 

https://www.creationkit.com/fallout4/index.php?title=WornItem_Struct_-_Actor

 

Link to comment
1 hour ago, Andy14 said:

 

For Armor you can use item or model.

And use Wornitem instead of form.

 

Wornitem fmCurrSlot33 = rActor.GetWornItem(33) 

Armor slot33Armor= fmCurrSlot33.item

 

https://www.creationkit.com/fallout4/index.php?title=WornItem_Struct_-_Actor

 

Sorry that doesn't compile :/
C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SynthPlayer\Synth9LooksMenu.psc(229,11): unknown type wornitem
C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SynthPlayer\Synth9LooksMenu.psc(229,11): type mismatch while assigning to a wornitem (cast missing or types unrelated)
No output generated for SynthPlayer:Synth9LooksMenu, compilation failed.

 

Link to comment
8 minutes ago, Halstrom said:

Sorry that doesn't compile :/
C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SynthPlayer\Synth9LooksMenu.psc(229,11): unknown type wornitem
C:\Users\Owner\AppData\Local\Temp\PapyrusTemp\SynthPlayer\Synth9LooksMenu.psc(229,11): type mismatch while assigning to a wornitem (cast missing or types unrelated)
No output generated for SynthPlayer:Synth9LooksMenu, compilation failed.

 

 

It's a F4SE actor member.

 

Syntax should be like this - according to creationkit.com

Actor:WornItem fmCurrSlot33  = rActor.GetWornItem(33)
Link to comment

Hello! I had a quick question. I am following this tutorial: https://www.youtube.com/watch?v=ze9icEJpQ2M&t=1389s

 

 

I have all of my NIF and textures and BGSMs in order so far, and I am following the tutorial to make it standalone instead of a mesh replacer to the original outfits. In the tutorial she has you clone the Synth Uniform which is flagged for both genders.  What do I change to make it only female? 

 

Granted, this is a personal file and I don't really play a guy anyway, but I'd like to have the information.

 

(I am using FO4Edit at the moment, it is not CK. But I didn't think making a whole new thread for this was appropriate).

 

 

Thank you.

Link to comment
On 7/2/2018 at 3:03 AM, Halstrom said:

Ah thanks that got it

 

Actor:WornItem wiCurrSlot33 = rActor.GetWornItem(33)
armCurrSlot33 = wiCurrSlot33.item as Armor
 

One thing I noticed when I started playing around with the armor slots is that there's an offset.  The base version of Fallout Vore is supposed to have a 50% chance of stripping the clothing off of actors, but it never worked.  I did a little digging and testing, and found out slot 33 was the incorrect slot to point to for armors.  Slot 3 was what I found through my testing, and it has been working properly ever since.

 

Actor:WornItem wornItem = akPred.GetWornItem(3)

Link to comment
2 hours ago, Carreau said:

One thing I noticed when I started playing around with the armor slots is that there's an offset.  The base version of Fallout Vore is supposed to have a 50% chance of stripping the clothing off of actors, but it never worked.  I did a little digging and testing, and found out slot 33 was the incorrect slot to point to for armors.  Slot 3 was what I found through my testing, and it has been working properly ever since.

 

Actor:WornItem wornItem = akPred.GetWornItem(3)

Thanks, that explains it not firing :)
 

Link to comment

How am I meant to use the "OnEquipped(Actor akActor)" event?

Currently, I have an item with two Armour Addons; One with a model, and one with an empty model. What I want to do is, when slot 33 is occupied, I want to change the addon index to the null mesh, and when slot 33 becomes unoccupied, I want the addon index changed back.

 

Spoiler

ScriptName Evan555alpha:BraPantyHideUnhideScript Extends Actor
{This script will change the armour looks of bras and panties depending on whether or not slot 33 is equipped.}

Group Required
{Required Properties.}
	Form Property Myself Auto Const
	{Self-referential.}
	Actor Property Player Auto Const
	{The actor we wish to check.}
	ObjectMod Property Enabler Auto Const
	{The object mod that enables/disables the mesh.}
EndGroup

;Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
Event OnEquipped(Actor akActor)
	Debug.Trace("Evan: An item was equipped.")
	;If akBaseObject as Armor
	If akActor == Player
		Debug.Trace("Evan: Equipped armour")
		Actor:WornItem Slot33 = Player.GetWornItem(3)
		Armor Item33 = (Slot33.Item as Armor)
		If !Item33
			(Myself as ObjectReference).RemoveMod(Enabler)
		Else
			Debug.Trace("Evan: GetWornItem is weird.")
		EndIf
	Else
		Debug.Trace("Evan: Not Armour")
	EndIf
EndEvent

Event OnItemUnequipped(Form akBaseObject, ObjectReference akReference)
	If akBaseObject as Armor
		If Player.GetWornItem(33)
			(Myself as ObjectReference).AttachMod(Enabler, 0)
		EndIf
	EndIf
EndEvent

 

Spoiler'd is the script that I've been using, and I'm finding that none of the debug traces show up, which leads me to believe that the event isn't even firing. Mind the hodge-podge-iness of it all, I am currently just trying to get something to show up in the first place.

 

Is it that I'm just using the wrong kind of event for this?

Link to comment
58 minutes ago, Evan555alpha said:

How am I meant to use the "OnEquipped(Actor akActor)" event?

Currently, I have an item with two Armour Addons; One with a model, and one with an empty model. What I want to do is, when slot 33 is occupied, I want to change the addon index to the null mesh, and when slot 33 becomes unoccupied, I want the addon index changed back.

 

  Hide contents


ScriptName Evan555alpha:BraPantyHideUnhideScript Extends Actor
{This script will change the armour looks of bras and panties depending on whether or not slot 33 is equipped.}

Group Required
{Required Properties.}
	Form Property Myself Auto Const
	{Self-referential.}
	Actor Property Player Auto Const
	{The actor we wish to check.}
	ObjectMod Property Enabler Auto Const
	{The object mod that enables/disables the mesh.}
EndGroup

;Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
Event OnEquipped(Actor akActor)
	Debug.Trace("Evan: An item was equipped.")
	;If akBaseObject as Armor
	If akActor == Player
		Debug.Trace("Evan: Equipped armour")
		Actor:WornItem Slot33 = Player.GetWornItem(3)
		Armor Item33 = (Slot33.Item as Armor)
		If !Item33
			(Myself as ObjectReference).RemoveMod(Enabler)
		Else
			Debug.Trace("Evan: GetWornItem is weird.")
		EndIf
	Else
		Debug.Trace("Evan: Not Armour")
	EndIf
EndEvent

Event OnItemUnequipped(Form akBaseObject, ObjectReference akReference)
	If akBaseObject as Armor
		If Player.GetWornItem(33)
			(Myself as ObjectReference).AttachMod(Enabler, 0)
		EndIf
	EndIf
EndEvent

 

Spoiler'd is the script that I've been using, and I'm finding that none of the debug traces show up, which leads me to believe that the event isn't even firing. Mind the hodge-podge-iness of it all, I am currently just trying to get something to show up in the first place.

 

Is it that I'm just using the wrong kind of event for this?

There was some voodoo magic you had to add into an ini file to get debug trace to work, try using Debug.Notification(stringMessage) instead till you find out what the ini change is.
Otherwise the script looks like it should be doing something close to what you want :)

 

Link to comment
5 hours ago, Halstrom said:

There was some voodoo magic you had to add into an ini file to get debug trace to work, try using Debug.Notification(stringMessage) instead till you find out what the ini change is.
Otherwise the script looks like it should be doing something close to what you want :)

 

Well that's the thing. I enabled papyrus logging ages ago, and I have dozens of scripts, some of them also my own, that will put out debug traces just fine. I will do a run with Debug.Notification() however, and see if there's a change.

 

Edit: As I suspected, nothing. The event isn't firing. Any suggestions on how else I could go about this?

Link to comment

I do this in my mod and it works ok:

Event OnInit()
	Utility.wait(5.0)
	rActor = Game.GetPlayer()
EndEvent

Event OnItemEquipped(Form akBaseObject, ObjectReference akTemp)
	If (kwPOTC_ButtPlug) && (armFusionCoreButtPlug)
		If (akBaseObject.HasKeyword(kwPOTC_ButtPlug))
			If (rActor.IsEquipped(armFusionCoreButtPlug)) || (rActor.IsEquipped(armFusionCoreButtPlugDepleted))
				gPOTC_ButtPlugSize.SetValue(80)
			ElseIf (rActor.IsEquipped(armMiniNukeButtPlug))
				gPOTC_ButtPlugSize.SetValue(100)
			Else
				gPOTC_ButtPlugSize.SetValue(50)
			EndIf
		EndIf
	EndIf
EndEvent

Event OnItemUnEquipped(Form akBaseObject, ObjectReference akTemp)
	If (kwPOTC_ButtPlug)
		If (akBaseObject.HasKeyword(kwPOTC_ButtPlug))
			gPOTC_ButtPlugSize.SetValue(0)
		EndIf
	EndIf
EndEvent

Check akActor is being set perhaps or it is the correct actor.
This line does not make sense to me: 
Actor Property Player Auto Const
I don't think you are setting the Actor. try adding an Init Event to set the Actor.
Remember Const make the Property Read Only too, I never use Const, I never found a need for it.

Link to comment
46 minutes ago, Halstrom said:

I do this in my mod and it works ok:

 

-snip-

 

Check akActor is being set perhaps or it is the correct actor.

This line does not make sense to me: 
Actor Property Player Auto Const
I don't think you are setting the Actor. try adding an Init Event to set the Actor.
Remember Const make the Property Read Only too, I never use Const, I never found a need for it.

What are "kwPOTC_ButtPlug" and "armFusionCoreButtPlug" in this context? Are they properties that you set beforehand? What are they supposed to be?
Or does papyrus automatically fill them to fit the event that that if statement is in?

 

What is this script attached to? Is it a manager quest? Or is it the item itself?

 

I just made the player an Actor property through the Properties window in the CK. I didn't do anything with that particular property beyond that. I'll remove "Const" however.

Link to comment

im fairly certain this is a small enough question to go here, not entirely certain if it pertains to the CK or not...

 

im editing Body textures, while i could do this through GIMP to edit the .dds files is there a way to edit while its on a model?

 

i.e outfit studio, nifskope,etc.

 

what i mean by that is : is there a way to see a 3D representation of the model whilst i alter textures on it?

 

 

Link to comment
12 hours ago, Evan555alpha said:

How am I meant to use the "OnEquipped(Actor akActor)" event?

Currently, I have an item with two Armour Addons; One with a model, and one with an empty model. What I want to do is, when slot 33 is occupied, I want to change the addon index to the null mesh, and when slot 33 becomes unoccupied, I want the addon index changed back.

 

  Hide contents


ScriptName Evan555alpha:BraPantyHideUnhideScript Extends Actor
{This script will change the armour looks of bras and panties depending on whether or not slot 33 is equipped.}

Group Required
{Required Properties.}
	Form Property Myself Auto Const
	{Self-referential.}
	Actor Property Player Auto Const
	{The actor we wish to check.}
	ObjectMod Property Enabler Auto Const
	{The object mod that enables/disables the mesh.}
EndGroup

;Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
Event OnEquipped(Actor akActor)
	Debug.Trace("Evan: An item was equipped.")
	;If akBaseObject as Armor
	If akActor == Player
		Debug.Trace("Evan: Equipped armour")
		Actor:WornItem Slot33 = Player.GetWornItem(3)
		Armor Item33 = (Slot33.Item as Armor)
		If !Item33
			(Myself as ObjectReference).RemoveMod(Enabler)
		Else
			Debug.Trace("Evan: GetWornItem is weird.")
		EndIf
	Else
		Debug.Trace("Evan: Not Armour")
	EndIf
EndEvent

Event OnItemUnequipped(Form akBaseObject, ObjectReference akReference)
	If akBaseObject as Armor
		If Player.GetWornItem(33)
			(Myself as ObjectReference).AttachMod(Enabler, 0)
		EndIf
	EndIf
EndEvent

 

Spoiler'd is the script that I've been using, and I'm finding that none of the debug traces show up, which leads me to believe that the event isn't even firing. Mind the hodge-podge-iness of it all, I am currently just trying to get something to show up in the first place.

 

Is it that I'm just using the wrong kind of event for this?

So, you’re attaching this to an actor?  You would need to register the event since OnEquipped  and OnUnequipped are ObjectReference events. You would need to register for a remote event for the armor in question during the oninit process. 

Link to comment
7 hours ago, Carreau said:

So, you’re attaching this to an actor?  You would need to register the event since OnEquipped  and OnUnequipped are ObjectReference events. You would need to register for a remote event for the armor in question during the oninit process. 

Hmm I didn't register mine, although maybe because its in an Actor Alias it doesn't need to be registered, I wish there was a blanket rule for some of this stuff in Papyrus, its all over the place depending on the script type.

8 hours ago, Evan555alpha said:

What are "kwPOTC_ButtPlug" and "armFusionCoreButtPlug" in this context? Are they properties that you set beforehand? What are they supposed to be?
Or does papyrus automatically fill them to fit the event that that if statement is in?

 

What is this script attached to? Is it a manager quest? Or is it the item itself?

 

I just made the player an Actor property through the Properties window in the CK. I didn't do anything with that particular property beyond that. I'll remove "Const" however.

I'm still learning this quirky language myself but I found due to the bodgyness of the GameBro engine quite often stuff from other mods doesn't seem to load into properties if tried too soon during game start so I try avoid that with Utility.Wait(5) in the Init Event. My debug logs are flooded with errors from Beth stuff and other mods that show errors during startup.  So therefore besides setting the kwPOTC_ButtPlug, I need to check its existing before attempting to use it in a If condition.
And I wouldn't set Actor as a Property unless you need some option to change it. I'd do what I did with: akActor = Game.GetPlayer().
Here is the full NSFW script:

Scriptname SynthPlayer:Synth9PlugsOfCommonwealth extends ReferenceAlias

Group Misc
	GlobalVariable Property gSynthPlayerQuestStage Auto
	GlobalVariable Property gDebugSetting Auto
	ActorValue Property RadsAV Auto
	GlobalVariable Property gPowerLevel Auto
	GlobalVariable Property gPowerMax Auto
	GlobalVariable Property gPowerPerc Auto
	GlobalVariable Property gPowerAdjust Auto
	GlobalVariable Property gSPUAdjust Auto
	GlobalVariable Property gAnusSize Auto
	GlobalVariable Property gChassisHealthAdjust Auto
	GlobalVariable Property gArousalAdjust Auto
	GlobalVariable Property gArousalAdjAnal Auto
	Ammo Property amFusionCore Auto Const
	Ammo Property amMiniNuke Auto Const
	Armor Property armFusionCoreInsert Auto Const
	Armor Property armFusionCoreDepleted Auto Const
EndGroup

Group POTC
	GlobalVariable Property gPOTC_0Installed Auto
	GlobalVariable Property gPOTC_FusionCorePlug Auto
	GlobalVariable Property gPOTC_ButtPlugSize Auto
	GlobalVariable Property gPOTC_FusionCoreCharge Auto
	Armor Property armFusionCoreButtPlugDepleted Auto
	Armor Property armFusionCoreButtPlug Auto
	Armor Property armMiniNukeButtPlug Auto
	Keyword Property kwPOTC_ButtPlug Auto
EndGroup

Group AVEffects
	GlobalVariable Property gVolumePerc Auto
	GlobalVariable Property gSoundsFemale Auto
	Sound Property sndPlugInsertedF Auto const
	Sound Property sndPlugInsertedM Auto const
	Sound Property sndPlugRemovedF Auto const
	Sound Property sndPlugRemovedM Auto const
	Sound Property sndPlugDepleted Auto const
EndGroup

;-----------------------------------------------------------------------------------------------------------------------------

Actor rActor
String sScriptName = "POTC"
Int iSynthPlayerQuestStage
Float fVolumeMult 
Int iDebugSetting
Float fCurrTime
Float fPrevTime
String sModNameA = "dcc-bp-lol.esp"
String sModNameB = "dcc-bp-lol-navi.esp"
String sModName
Float fFusionCoreCharge

Int iTimerID = 68
Float fFrequencyTimer = 5.0

;-----------------------------------------------------------------------------------------------------------------------------

Event OnInit()
	Utility.wait(10.0)
	rActor = Game.GetPlayer()
	iDebugSetting = gDebugSetting.GetValueInt()
	If (Game.IsPluginInstalled(sModNameA)) || (Game.IsPluginInstalled(sModNameB))
		fnInit()
		armFusionCoreButtPlug = Game.GetFormFromFile(0x00000804, sModName) as Armor
		armMiniNukeButtPlug = Game.GetFormFromFile(0x00000807, sModName) as Armor
		kwPOTC_ButtPlug = Game.GetFormFromFile(0x00000FF5, sModName) as Keyword
		if (armFusionCoreButtPlug)
			rActor.AddItem(armFusionCoreButtPlug, 1, 1)
			fnDebug(sModName + ": " + armFusionCoreButtPlug + " Assets Added")
		Endif
		if (armMiniNukeButtPlug)
			rActor.AddItem(armMiniNukeButtPlug, 1, 1)
			fnDebug(sModName + ": " + armMiniNukeButtPlug + " Assets Added")
		Endif
	Else
		fnCleanup()
	EndIf
EndEvent

Event OnPlayerLoadGame()
	Utility.wait(10.0)
	If (Game.IsPluginInstalled(sModNameA)) || (Game.IsPluginInstalled(sModNameB))
		fnInit()
	Else
		fnCleanup()
	EndIf
EndEvent

Function fnInit()
	rActor = Game.GetPlayer()
	gPOTC_0Installed.SetValue(1)
	iDebugSetting = gDebugSetting.GetValueInt()
	If (Game.IsPluginInstalled(sModNameA))
		sModName = sModNameA
	ElseIf (Game.IsPluginInstalled(sModNameB))
		sModName = sModNameB
	EndIf
	armFusionCoreButtPlug = Game.GetFormFromFile(0x00000804, sModName) as Armor
	armMiniNukeButtPlug = Game.GetFormFromFile(0x00000807, sModName) as Armor
	kwPOTC_ButtPlug = Game.GetFormFromFile(0x00000FF5, sModName) as Keyword
	fnDebug(sModName + " Assets Loaded")
	StartTimer(fFrequencyTimer, iTimerID)
	fPrevTime = Utility.GetCurrentGameTime()
EndFunction

;-----------------------------------------------------------------------------------------------------------------------------

Event OnTimer(Int aiTimerID)
	iDebugSetting = gDebugSetting.GetValueInt()
	iSynthPlayerQuestStage = gSynthPlayerQuestStage.GetValueInt()
	If (aiTimerID >= iTimerID) && (iSynthPlayerQuestStage > 9)
		fVolumeMult = gVolumePerc.GetValue() / 100
		Int iSoundsFemale = gSoundsFemale.GetValueInt()
		fCurrTime = Utility.GetCurrentGameTime()
		Float fSecondsPassed = fCurrTime - fPrevTime
		If (fSecondsPassed < fFrequencyTimer)
			fSecondsPassed = fFrequencyTimer
		EndIf
		If (fSecondsPassed > 3600)
			fSecondsPassed = 3600
		EndIf
		Float fPowerLevel = gPowerLevel.GetValue()
		Float fPowerMax = gPowerMax.GetValue()
		Float fPowerPerc = gPowerPerc.GetValue()
		Float fAnusSize = gAnusSize.GetValue()
		Float fChassisHealthAdjust = gChassisHealthAdjust.GetValue()
		Float fSPUAdjust = gSPUAdjust.GetValue() 
		Float fArousalAdjust = gArousalAdjust.GetValue()
		Float fArousalAdjAnal = gArousalAdjAnal.GetValue()

		If (armFusionCoreButtPlug)
			If (fFusionCoreCharge != 0) && (!rActor.IsEquipped(armFusionCoreButtPlug)) && (!rActor.IsEquipped(armFusionCoreButtPlugDepleted))
				fnDebug("Fusion Core Power Plug Removed!")
				If (iSoundsFemale)
					fnPlaySound(sndPlugRemovedF, 0.9)
				Else
					fnPlaySound(sndPlugRemovedM, 0.9)
				EndIf
				gPOTC_FusionCorePlug.SetValue(0)
				gPOTC_ButtPlugSize.SetValue(0)
				fFusionCoreCharge = 0
			ElseIf (rActor.IsEquipped(armFusionCoreButtPlugDepleted))
				fFusionCoreCharge = -100
				gPOTC_FusionCoreCharge.SetValue(0)
				gPOTC_FusionCorePlug.SetValue(0)
			ElseIf (rActor.IsEquipped(armFusionCoreButtPlug))
				fFusionCoreCharge = gPOTC_FusionCoreCharge.GetValue()
				If (fFusionCoreCharge == 0)
					fnMessage("Fusion Core Power Plug Inserted!")
					fnDebug("Fusion Core Power Plug Inserted!")
					If (iSoundsFemale)
						fnPlaySound(sndPlugInsertedF, 0.9)
					Else
						fnPlaySound(sndPlugInsertedM, 0.9)
					EndIf
					gPOTC_FusionCorePlug.SetValue(100)
					fFusionCoreCharge = 100
				ElseIf (fFusionCoreCharge > 0) && (fPowerPerc < 100)
					Float fNeeded = fPowerMax - fPowerLevel
					If (fNeeded > fSecondsPassed)
						fNeeded = fSecondsPassed
					EndIf
					If (fNeeded > fFusionCoreCharge)
						fNeeded = fFusionCoreCharge
					EndIf
					Float fPowerAdjust = gPowerAdjust.GetValue() + fNeeded
					gPowerAdjust.SetValue(fPowerAdjust)
					fFusionCoreCharge = fFusionCoreCharge - fNeeded
					fnDebug("PowerLevel/Max/Perc/PlugPower/Charging/Adjust: " + fPowerLevel + "/" + fPowerMax + "/" + fPowerPerc + "/" + fFusionCoreCharge + "/" + fNeeded + "/" + fPowerAdjust)
					gPOTC_FusionCorePlug.SetValue(100)
				EndIf
				If (fFusionCoreCharge <= 0)
					fnMessage("Fusion Core Power Plug Depleted!")
					fnPlaySound(sndPlugDepleted, 0.9)
					rActor.RemoveItem(armFusionCoreButtPlug, 1, 1)
					rActor.EquipItem(armFusionCoreButtPlugDepleted, 1, 1)
					fFusionCoreCharge = -100
				EndIf
				gPOTC_FusionCoreCharge.SetValue(fFusionCoreCharge)
			Endif
		Else
			armFusionCoreButtPlug = Game.GetFormFromFile(0x00000804, sModName) as Armor
			gPOTC_FusionCorePlug.SetValue(0)
		EndIf

		If (armMiniNukeButtPlug)
			If (rActor.IsEquipped(armMiniNukeButtPlug)) && (Utility.RandomInt(0, 1) > 0)
				Float fRadDam = Utility.RandomFloat(0, 1) * fSecondsPassed
				rActor.DamageValue(RadsAV, fRadDam)
			Endif
		Else
			armMiniNukeButtPlug = Game.GetFormFromFile(0x00000807, sModName) as Armor
		EndIf

		Float fButtPlugSize = gPOTC_ButtPlugSize.GetValue()
		fArousalAdjust += (fButtPlugSize / 100 * fSecondsPassed / 100 * fArousalAdjAnal / 100)
		fSPUAdjust += (fButtPlugSize / 100 * fSecondsPassed / 100)

		If (fButtPlugSize > 0)
			Float fEffect = (fButtPlugSize - fAnusSize) / 100 * fArousalAdjAnal / 100
			fSPUAdjust += fEffect
			if (fArousalAdjAnal > 0)
				fArousalAdjust += fEffect
				If (Utility.RandomInt(0, 100) == 1)
					fnMessage("The warm Fusion Core in your Rear Waste Port is arousing you!")
				EndIf
			ElseIf(fArousalAdjAnal < 0)
				fChassisHealthAdjust += -fEffect
				If (Utility.RandomInt(0, 100) == 1)
					fnMessage("The hot Fusion Core stretching your Rear Waste Port sends a twinge of pain through you!")
				EndIf
			EndIf
			If (fButtPlugSize > fAnusSize)
				fAnusSize += ((fButtPlugSize - fAnusSize) / 100 * fSecondsPassed / 1000)
			EndIf

			gAnusSize.SetValue(fAnusSize)
			gSPUAdjust.SetValue(fSPUAdjust)
			gArousalAdjust.SetValue(fArousalAdjust)
			gChassisHealthAdjust.SetValue(fChassisHealthAdjust)
		EndIf

		Int iAMFusionCoreCount = rActor.GetItemCount(amFusionCore)
		Int iARMFusionCoreInsertCount = rActor.GetItemCount(armFusionCoreInsert)
		Int iARMFusionCoreButtPlugCount = rActor.GetItemCount(armFusionCoreButtPlug)
		If (iARMFusionCoreButtPlugCount < 1) && (iAMFusionCoreCount < 1)
			gPOTC_FusionCoreCharge.SetValue(0)
		Endif
		If (iAMFusionCoreCount > 1) && (iARMFusionCoreInsertCount > 0) && (iARMFusionCoreButtPlugCount < 1)
			rActor.RemoveItem(amFusionCore, 1, 1)
			rActor.AddItem(armFusionCoreButtPlug, 1, 1)
			fnDebug(sModName + " ButtCore Added")
		EndIf
		Int iARMFusionCoreButtPlugDepletedCount = rActor.GetItemCount(armFusionCoreButtPlugDepleted)
		If (iARMFusionCoreButtPlugDepletedCount > 1)
			rActor.RemoveItem(armFusionCoreButtPlugDepleted, 1, 1)
			rActor.AddItem(armFusionCoreDepleted, 1, 1)
			fnDebug(sModName + " DepletedCore Added")
		EndIf
		Int iAMMiniNukeCount = rActor.GetItemCount(amMiniNuke)
		Int iARMMiniNukeButtPlugCount = rActor.GetItemCount(armMiniNukeButtPlug)
		If (iAMMiniNukeCount > 1) && (iARMMiniNukeButtPlugCount < 1)
			rActor.RemoveItem(amMiniNuke, 1, 1)
			rActor.AddItem(armMiniNukeButtPlug, 1, 1)
			fnDebug(sModName + " MiniNuke ButtPlug Added")
		EndIf

		fPrevTime = fCurrTime
	EndIf
	StartTimer(fFrequencyTimer, iTimerID)
EndEvent

;-----------------------------------------------------------------------------------------------------------------------------

Event OnItemEquipped(Form akBaseObject, ObjectReference akTemp)
	If (kwPOTC_ButtPlug) && (armFusionCoreButtPlug)
		If (akBaseObject.HasKeyword(kwPOTC_ButtPlug))
			If (rActor.IsEquipped(armFusionCoreButtPlug)) || (rActor.IsEquipped(armFusionCoreButtPlugDepleted))
				gPOTC_ButtPlugSize.SetValue(80)
			ElseIf (rActor.IsEquipped(armMiniNukeButtPlug))
				gPOTC_ButtPlugSize.SetValue(100)
			Else
				gPOTC_ButtPlugSize.SetValue(50)
			EndIf
		EndIf
	EndIf
EndEvent

Event OnItemUnEquipped(Form akBaseObject, ObjectReference akTemp)
	If (kwPOTC_ButtPlug)
		If (akBaseObject.HasKeyword(kwPOTC_ButtPlug))
			gPOTC_ButtPlugSize.SetValue(0)
		EndIf
	EndIf
EndEvent

Function fnPlaySound(Sound sndSound, Float fVolume)
	Int instanceID = sndSound.play(rActor)
	Sound.SetInstanceVolume(instanceID, (fVolume * fVolumeMult))
EndFunction

Function fnDebug(String sDebug)
	If (iDebugSetting > 0)
		Debug.Trace("SynthPlayer: " + sScriptName + ": " + sDebug)
	EndIf
EndFunction

Function fnMessage(String sMessage)
	Debug.Notification(sMessage)
	If(iDebugSetting > 0)
		Debug.Trace(sMessage)
	EndIf
EndFunction

Function fnCleanup()
	Int iCount = rActor.GetItemCount(armFusionCoreButtPlugDepleted)
	If (iCount > 0)
		rActor.RemoveItem(armFusionCoreButtPlugDepleted, iCount, 1)
		rActor.AddItem(armFusionCoreDepleted, iCount, 1)
	EndIf
	gPOTC_FusionCorePlug.SetValue(0)
	gPOTC_ButtPlugSize.SetValue(0)
	gPOTC_0Installed.SetValue(0)
	UnregisterForAllEvents()
	CancelTimer(iTimerID)
EndFunction

 

Link to comment
10 hours ago, Carreau said:

So, you’re attaching this to an actor?  You would need to register the event since OnEquipped  and OnUnequipped are ObjectReference events. You would need to register for a remote event for the armor in question during the oninit process. 

Nope. This script is attached to every ARMO record that is meant to be affected by the object mod. I do not touch actors with this little plugin. I had imagined that by doing so, I would be able to use the "OnEquipped" event. Here, you guys are using the "OnItemEquipped" event, which is different.

 

Link to comment

 

5 hours ago, Evan555alpha said:

Nope. This script is attached to every ARMO record that is meant to be affected by the object mod. I do not touch actors with this little plugin. I had imagined that by doing so, I would be able to use the "OnEquipped" event. Here, you guys are using the "OnItemEquipped" event, which is different.

 

But you extended Actor, which means ObjectReference events aren’t native to your script. OnEquipped and OnUnEquipped are both ORef events. 

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