Jump to content

AAF Equipmentset won't behave


Recommended Posts

So, my script needs to catch the actors in any given scene, check them for a keyword, and if they have it, equip a specific item for the duration of the scene. My script is successfully detecting the keyworded actors, but I just can't seem to get AAF to do what I need it to. hopefully someone can spot where i've made an oopsie, code below.
 

Event AAF:AAF_API.OnSceneInit(AAF:AAF_API akSender, Var[] akArgs)

    Debug.Notification("AAF OnSceneInit Event Heard!")
	int Status = akArgs[0] as int
	If( Status == 0)
		; The Actors involved:
		Actor[] actors = Utility.VarToVarArray(akArgs[1]) as Actor[]
	
		Int iElement = Actors.Length
		Int iIndex = 0
		While iIndex < iElement
			if(Actors[iIndex].Hasspell(Raknar_Futanari_Spell))
				Futachar = Actors[iIndex]
				AAF:AAF_API.GetAPI().ApplyEquipmentSet(FutaChar, "Raknar_Futanari_EquipmentSet")
				debug.notification("erected")
			endif
		iIndex += 1
		EndWhile
	EndIf
EndEvent
<meta title="Raknar_Futanari_equipmentSetData.xml" version="1.0" dataSet="equipmentSet"/>

<!-- Default attributes are applied to the addEquipment and removeEquipment nodes below if no conflicting attribute is set there. -->
<defaults source="FutaFEV.esp"/>


<equipmentSet id="unEquip">
    <condition>
        <unEquip bipedSlot="Beard"/>
    </condition>
</equipmentSet>
<!--
Add or remove addEquipment and removeEquipment entries to control adding and
removing any equipment to the actors before and after animations.

You can also add attributes to the condition node to discriminate which actors
the set is applied to. For example, <condition isFemale="true"> will only
apply the equipment commands to female actors.
-->

<equipmentSet id="Raknar_Futanari_equipmentSet">
    <condition>
        <addEquipment form="E7000822"/>
    </condition>
</equipmentSet>

The biped slot "Beard" is used for both this (erect) armor, and the flaccid version.

Link to comment
3 hours ago, DracoRaknar said:

So, my script needs to catch the actors in any given scene, check them for a keyword, and if they have it, equip a specific item for the duration of the scene. My script is successfully detecting the keyworded actors, but I just can't seem to get AAF to do what I need it to. hopefully someone can spot where i've made an oopsie, code below

 

What does your Papyrus log show?

 

Your XML defines the set as "Raknar_Futanari_equipmentSet" but the code is specifying "Raknar_Futanari_EquipmentSet" (the E is capitalized here but not in the XML).  I am not sure if AAF disregards case for everything so I would make them both the same.

 

Also, if the player is one of the actors, you will need to cast akArgs[2] as Actor to get the player's Doppelganger actor and apply the equipmentset to it rather than to the player.

Link to comment
5 hours ago, EgoBallistic said:

What does your Papyrus log show?

I had forgotten about the debug logging. The papyrus log showed that AAF is smarter than I am. AAF was doing exactly what I told it to, I was not telling it to do things.

When a mod calls Equipmentset, AAF will ONLY strip biped slots specified in <unequip>, in my case, leaving the clothing on.
on top of that, when applying the equipment, AAF applies the base object, without OMOD's. My mod uses OMOD's to change the mesh, the base object without them is invisible.
 

So I had to rewrite most of it to handle the equipping in papyrus, and use a protectedEquipment xml to make AAF ignore it.

It now seems to work properly now, Thanks for your help!

code below just in case someone has the same problem in the future.
 

Spoiler

<meta title="Raknar_Futanari_protectedEquipmentData.xml" version="1.0" dataSet="protectedEquipment"/>
<defaults />

<condition>
    <protectKeyword form="e7022af5" source="FutaFEV.esp"/>
</condition>

Event AAF:AAF_API.OnSceneInit(AAF:AAF_API akSender, Var[] akArgs)

    Debug.Notification("AAF OnSceneInit Event Heard!")
	int Status = akArgs[0] as int
	If( Status == 0)
		; The Actors involved:
		Actor[] actors = Utility.VarToVarArray(akArgs[1]) as Actor[]
	
		Int iElement = Actors.Length
		Int iIndex = 0
		While iIndex < iElement
			if(Actors[iIndex].Hasspell(Raknar_Futanari_Spell))
				Futachar = Actors[iIndex]
				if(FutaChar == PlayerRef)
					FutaChar = (akArgs[2] as Actor)
				EndIf
				RestoreFutaErect(FutaChar)
				;debug.notification("erected")
			endif
		iIndex += 1
		EndWhile

	EndIf
EndEvent

Function RestoreFutaErect (Actor FutaChar)

if (Futachar.GetItemCount(Raknar_Futanari_Erect) == 0)
	Futachar.Additem(Raknar_Futanari_Erect)
endif

int Currentsize = FutaChar.GetValue(Raknar_Futanari_Size) as int
FutaChar.RemoveAllModsFromInventoryItem (Raknar_Futanari_Erect)
 If(Currentsize == 0)
	FutaChar.AttachModToInventoryItem (Raknar_Futanari_Erect, Raknar_FutanariE0)
ElseIf (Currentsize == 1) 
	FutaChar.AttachModToInventoryItem (Raknar_Futanari_Erect, Raknar_FutanariE1)
Elseif (Currentsize == 2)
	FutaChar.AttachModToInventoryItem (Raknar_Futanari_Erect, Raknar_FutanariE2)
Elseif (Currentsize == 3) 
	FutaChar.AttachModToInventoryItem (Raknar_Futanari_Erect, Raknar_FutanariE3)
Elseif (Currentsize == 4)
	FutaChar.AttachModToInventoryItem (Raknar_Futanari_Erect, Raknar_FutanariE4)
Elseif (Currentsize == 5)
	FutaChar.AttachModToInventoryItem (Raknar_Futanari_Erect, Raknar_FutanariE5)
Elseif (Currentsize >= 6)
	FutaChar.AttachModToInventoryItem (Raknar_Futanari_Erect, Raknar_FutanariE6)
EndIf
FutaChar.EquipItem(Raknar_Futanari_Erect,false,true)
EndFunction

 

 

Link to comment
2 hours ago, DracoRaknar said:

I had forgotten about the debug logging. The papyrus log showed that AAF is smarter than I am. AAF was doing exactly what I told it to, I was not telling it to do things.

When a mod calls Equipmentset, AAF will ONLY strip biped slots specified in <unequip>, in my case, leaving the clothing on.
on top of that, when applying the equipment, AAF applies the base object, without OMOD's. My mod uses OMOD's to change the mesh, the base object without them is invisible.
 

So I had to rewrite most of it to handle the equipping in papyrus, and use a protectedEquipment xml to make AAF ignore it.

It now seems to work properly now, Thanks for your help!

code below just in case someone has the same problem in the future

 

Very cool.  Glad I could help, although I think you had the problem well in hand :)

 

Thanks for posting your code.  I have been wanting to automate clamp-ons for synths and found the amount of work required to do it purely in XML kind of daunting.  It never occurred to me to do it in a combination of scripting and XML like you did.  So I'm probably going to borrow some of your solution if you don't mind.

Link to comment
2 hours ago, EgoBallistic said:

Very cool.  Glad I could help, although I think you had the problem well in hand :)

 

Thanks for posting your code.  I have been wanting to automate clamp-ons for synths and found the amount of work required to do it purely in XML kind of daunting.  It never occurred to me to do it in a combination of scripting and XML like you did.  So I'm probably going to borrow some of your solution if you don't mind.

I've just uploaded a new version of my mod, and that contains the full source scripts. Raknar_Futanari_AAFWatcher is the one probably most relevant to you.

 

Link to comment
4 hours ago, Tron91 said:

@EgoBallistic @DracoRaknar Nice to see something good came up from the bug troubleshooting page. Good job and good luck for you both in your future endeavors.

Thanks! Sometimes a fresh set of eyes is all you need to get past a puzzle that's got you stuck. And considering that a decent chunk of my code is repurposed and reworked from other mods, it'd be fairly hypocritical of me not to share mine in turn.

Link to comment

Archived

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

  • 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