Jump to content

Need help for binding variable in .hkx xml


Recommended Posts

I'm new to .hkx xml.

I'm trying to make 1-hand/2-hands switching melee weapon.

I duplicated meshes/Actors/Character/Behavior/MeleeBehavior.hkx as MeleeBehavior1HM2HMSwitch.hkx , unpacked to xml using hkxpack, then editing.

Problem is that newly added variables seems to not able to be bound. Other variables (which I didn't add) can be bound.

 

I added variable as below, and edited each numelements.

 

variableInfos

<hkobject>
  <hkparam name="role">
    <hkobject class="hkbRoleAttribute" name="role" signature="0xfecef669">
      <hkparam name="role">ROLE_DEFAULT</hkparam>
      <hkparam name="flags">FLAG_NONE</hkparam>
    </hkobject>
  </hkparam>
  <hkparam name="type">VARIABLE_TYPE_BOOL</hkparam>
</hkobject>
<hkobject>
  <hkparam name="role">
    <hkobject class="hkbRoleAttribute" name="role" signature="0xfecef669">
      <hkparam name="role">ROLE_DEFAULT</hkparam>
      <hkparam name="flags">FLAG_NONE</hkparam>
    </hkobject>
  </hkparam>
  <hkparam name="type">VARIABLE_TYPE_INT32</hkparam>
</hkobject>

variableInitialValues(wordVariableValues)

<hkobject>
  <hkparam name="value">1</hkparam>
</hkobject>
<hkobject>
  <hkparam name="value">0</hkparam>
</hkobject>

variableNames

<hkcstring>bIsTransformable</hkcstring>
<hkcstring>iTransformMode</hkcstring>

Then hkbVariableBindingSet is below.

<hkobject class="hkbVariableBindingSet" name="#TransformSelectorVBS" signature="0xe942f339">
  <hkparam name="bindings" numelements="1">
    <hkobject>
      <hkparam name="memberPath">selectedGeneratorIndex</hkparam>
      <hkparam name="variableIndex">90</hkparam><!--iTransformMode-->
      <hkparam name="bitIndex">-1</hkparam>
      <hkparam name="bindingType">BINDING_TYPE_VARIABLE</hkparam>
    </hkobject>
  </hkparam>
  <hkparam name="indexOfBindingToEnable">-1</hkparam>
</hkobject>

I'm using this binding for hkbManualSelectorGenerator like as below.

<hkobject class="hkbManualSelectorGenerator" name="#1860" signature="0xeed8d5cd">
  <hkparam name="variableBindingSet">#TransformSelectorVBS</hkparam>
  <hkparam name="userData">0</hkparam>
  <hkparam name="name">TransformSelector</hkparam>
  <hkparam name="generators" numelements="2">
#1860_1HM
#1860_2HM
</hkparam>
  <hkparam name="selectedGeneratorIndex">1</hkparam>
  <hkparam name="indexSelector">null</hkparam>
  <hkparam name="selectedIndexCanChangeAfterActivate">true</hkparam>
  <hkparam name="generatorChangedTransitionEffect">null</hkparam>
</hkobject>

I write below why I think this problem is on variable binding.

I have 4 hkbManualSelectorGenerator now, and using the same binding.

While my variable can't be bound, these selectedGeneratorIndex can take different values (like 1,0,0,0).

With binding other variable (witch I didn't add), these selectedGeneratorIndex take the same value.

I checked this on in-game animations.

 

What should I do to bind my variable correctly?

Thanks in advance.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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