Mostly Harmless


From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2003 :: Actor >> InventoryAttachment >> WeaponAttachment (Package: Engine)

WeaponAttachment is the class that handles the visual aspect of weapons in the third person. The two main functions used are:

Used to update the properties of the attachment so the client side can correctly spawn effects.
This function handles the generation of muzzle flashes, animation, tracers, ect. on the client side. Super.ThirdPersonEffects should always be called.


Languard: For the weapons included with UT2003, the only thing this class is used for is generating sfx on the client side. In trying to design a melee combat system, I've hammered this class quite a bit, and here's what I've found so far:

  • Changing bCollideActors is not a good idea
    • Originally my thought was to use the Touch message, but this didn't work out that great. Turns out that weapon attachments, being so close to the player model, touch the player model a lot. Especialy when you run up against things. And since Touch can only get called so makes for really spotty hit detection.
  • Animations
    • You can call animations on the weapon attachment from the fire classes rather easily by using xPawn(Instigator).WeaponAttachment.PlayAnim().

I hope this is what was intended for this page. Be gentle, it's my first wiki edit. :D

HaZarD.ep: I'm also working on a melee combat system. I thought about using a DoTrace() function, using the joint the attachment is attached to as StartTrace and the rotation of the weapon for the direction. The range would be long enough just to get to the end of the sword, or sth. like this. What do you think about this?

Foxpaw: I think that theres a couple of problems with using the attachment for anything authoritative:

  1. It's not going to be the in the same position on client and server, so although it would be neat in single player, the combat will seem erratic in multiplayer, as swords will go straight through a person on the client and cause no harm, or a person may completely miss on the client and still kill the person, etc.
  2. The movement on the attachment is dependant on the model and skin. Not only would you need special models for you mod (with the custom swinging animations), but your specific model could give you an advantage. For instance, models with longer arms may end up having longer reach.

What you "could" do is have all players be Karma Ragdolls all the time, and then you could pick up collisions using the Karma system as normal. This would also be very good because it would allow you to have a much more realistic response to impacts and such. However, you will have to write animations in script using impulses, and that would run very slow.

Dok Enkephalin: Maybe you could have the Touch() function only active in the frames that the melee weapon could score a 'telling' hit. The weapon would be extended away from the player during those hitframes.

I haven't looked into it, but I was going to eventually.

Orikalin:I like Dok Enkphalin's idea, but im new to scripting, and last night i made a 3d model for a katar weapon that im making, ive got it completly scripted out, all that is left is the KatarAttach.uc, which i have no idea how to go about doing

i made it using 3ds max and exported using ActorX, so its already got the animation sripted in, but how would i make the character dual weild it, and run low with their arms back holding the 2 katars, someone please help me T_T im so lost