Jump to content

[WIP] A multitail whip as a weapon with havoc physics


thor

Recommended Posts

It's not perfect yet but it works :P

 

Here is the proof :

 

 

How does it work ? It's a complex setup.

 

You need 4 nif files :

- one is a virtual weapon, take a sword and remove the geometry but keep the collision shape.

- second is the whip in the sheathed position as a piece of armor attached to the weaponsword bone

- third is the whip in the drawn position as a piece of armor attached to the right hand bone

- last one is the ground model

 

The good news is that you actually built only one model of the whip in 3ds, linked to the hand bone, and using HDT Autopilot just like hair in the tutorial to create the xml file.

Export the nif file, save your work, unlink the whip, move/rotate it to sheathed position and link it to weaponsword bone, save your work and export the other nif file. The same xml file is used for both. Unlink again, move to ground and export ground model.

 

In the CK you will need 4 objects :

 

A Weapon with the ground model and this script :

Scriptname HDTweapon2Script extends ObjectReference 

; the virtual version
weapon property WeapVirtual auto


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
  if akNewContainer as Actor
    akNewContainer.addItem(WeapVirtual,1,true)
    Delete()
  endif
endevent  

With this script it is replaced by the virtual weapon when picked by an actor.

 

 

 

A weapon with the virtual model. This is the object that will have the combat data. It has this script :

Scriptname HDTweaponScript extends ObjectReference  

; Unsheathed version
Armor Property WeapOut  Auto  
; Sheathed version
Armor Property WeapSheathed  Auto
; ground version
weapon property WeapGround auto


; add/remove armor versions when weapon is taken/dropped
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
  if akOldContainer.getitemcount(WeapOut) > 0
    akOldContainer.removeItem(WeapOut,1,true)
  endif
  if akOldContainer.getitemcount(WeapSheathed) > 0
    akOldContainer.removeItem(WeapSheathed,1,true)
  endif
  if akNewContainer as Actor
    if akNewContainer.getitemcount(WeapOut) == 0
      akNewContainer.addItem(WeapOut,1,true)
    endif
    if akNewContainer.getitemcount(WeapSheathed) == 0
      akNewContainer.addItem(WeapSheathed,1,true)
    endif
  else
    akNewContainer.addItem(WeapGround,1,true)
    Delete()
  endif
endevent  

Event OnEquipped(Actor akActor)
  akActor.EquipItem(WeapSheathed,false,true)
endevent

Event OnUnequipped(Actor akActor)
  akActor.UnEquipItem(WeapSheathed,false,true)
  akActor.UnEquipItem(WeapOut,false,true)
endevent

With this script :

 -it is replaced by ground model when dropped by actor

- it creates the armor versions when picked by actor

- it equips sheathed version when equipped

- it unequips both armor versions when unequipped

 

 

The two armor versions of the whip. They have the same enchantment with this script on the magiceffect :

Scriptname HDTweaponEffectScript extends activemagiceffect  

; Unsheathed version
Armor Property WeapOut  Auto  
; Sheathed version
Armor Property WeapSheathed  Auto

Actor property MyOwner Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
  if akTarget == game.getplayer()
      ; this event is supposed to work for player
      ; draw begin
      RegisterForActorAction(7)
      ; Sheathe End
      RegisterForActorAction(10)
  else
      ; NPC equipped this weapon
      MyOwner = akTarget
      registerforupdate(0.5)
  endif
endevent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
  UnRegisterforupdate()
  UnRegisterForActorAction(7)
  UnRegisterForActorAction(10)
endevent

; this event only works for player
Event OnActorAction(int actionType, Actor akActor, Form source, int slot)
debug.notification("action")
  if actionType == 7
    game.getplayer().EquipItem(WeapOut,false,true)
  endif
  if actionType == 10
    game.getplayer().EquipItem(WeapSheathed,false,true)
  endif
endevent

Event OnUpdate()
  debug.notification("update")
  if MyOwner.IsWeaponDrawn() && MyOwner.IsEquipped(WeapSheathed)
    MyOwner.EquipItem(WeapOut,false,true)
  endif
  if ( MyOwner.IsWeaponDrawn() == false ) && MyOwner.IsEquipped(WeapOut)
    MyOwner.EquipItem(WeapSheathed,false,true)
  endif
endevent

The script registers for "draw begin" and "sheathe end" events to switch between armor versions.

Since this only works for player it uses IsWeaponDrawn in OnUpdate block for NPCs

Link to comment

Unfortunately this method won't work for longer objects, like maces/long whips :(

 

The static havok collision box that registers if a weapon hit an actor wouldn't follow the actual havok physics motion .

 

But still good working adding physics to weapons!

Link to comment

Unfortunately this method won't work for longer objects, like maces/long whips :(

 

The static havok collision box that registers if a weapon hit an actor wouldn't follow the actual havok physics motion .

 

But still good working adding physics to weapons!

 

This post made me extremely sad. I wished that dreams will come true, someday.

 

 

 

2v1qmiv.jpg

635025662806479831.png

 

 

Link to comment

Looks awesome!

 

Just one question, does bodies hit by a HDT weapon behave any different from when affected by a normal weapon? Can it, for example, apply havok impulse to HDT body to cause appropriate breasts movement?

I have tested a slow animation on a target wearing a hdt skirt.

With the virtual weapon alone there is no effect

With the hdt weapon it applies an havok impulse on the skirt

 

But with the quick movement of a strike it does not always work. I think that the game computes havok collisions once per frame but does not interpolate for possible collisions between two frames.

So it the instant of the impact corresponds to a frame in the anim it will have an effect but if it is in the middle of two frames it will have no effect.

Link to comment

 

Looks awesome!

 

Just one question, does bodies hit by a HDT weapon behave any different from when affected by a normal weapon? Can it, for example, apply havok impulse to HDT body to cause appropriate breasts movement?

I have tested a slow animation on a target wearing a hdt skirt.

With the virtual weapon alone there is no effect

With the hdt weapon it applies an havok impulse on the skirt

 

But with the quick movement of a strike it does not always work. I think that the game computes havok collisions once per frame but does not interpolate for possible collisions between two frames.

So it the instant of the impact corresponds to a frame in the anim it will have an effect but if it is in the middle of two frames it will have no effect.

 

 

Thanks for the explanation. Even though it's not perfect, I'm glad to know that it sometimes works the way I hoped it to work.

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