Friday, October 5, 2012

Appendix.B-Import Custom Weapon in melee

1.Create a class extends Weapon
2.Create a class extends UTWeaponAttachment
3.Set FirstPersonMesh、PickupMesh

A. 產生MeleeWeapon.uc:

class MeleeWeapon extends UTWeapon abstract;

DefaultProperties

{

}

使用Abstract 是為避免出現在PickupFactory,因為它並未作任何新功能。

B.產生WeaponSword.uc:

class WeaponSword extends MeleeWeapon;

DefaultProperties

{

Begin Object Name=PickupMesh

SkeletalMesh=SkeletalMesh'GDC_Materials.Meshes.SK_ExportSword2'

End Object

Begin Object Name=FirstPersonMesh

SkeletalMesh=SkeletalMesh'GDC_Materials.Meshes.SK_ExportSword2'

AnimSets(0)=AnimSet'GDC_Materials.Meshes.SwordAnimset'

End Object

InstantHitDamage(0)=75.0

InstantHitDamage(1)=35.0

DefaultAnimSpeed=0.9

AttachmentClass=class'MeleeAttachment'

ShotCost(0)=0

ShotCost(1)=0

MessageClass=class'UTPickupMessage'

DroppedPickupClass=class'UTDroppedPickup'

MaxAmmoCount=1

AmmoCount=1

WeaponRange=100

}

但需要注意的是AnimSets(0)在這package是沒有設定要給玩家揮動武器的AnimSets所以攻擊時並不會產生攻擊動畫,ShotCast(0)=0武器不用消費子彈,這也可以運用在一般的槍上,AttachmentClass 這指向接下來要做MeleeAttachment.uc。

C.產生MeleeAttachment.uc:

class MeleeAttachment extends UTWeaponAttachment;

DefaultProperties

{

Begin Object Name=SkeletalMeshComponent0

SkeletalMesh=SkeletalMesh'GDC_Materials.Meshes.SK_ExportSword2'

End Object

WeaponClass=class'KiGame.WeaponSword'

MuzzleFlashSocket=MuzzleFlashSocket

}

SkeletalMesh、WeaponClass、MuzzleFlashSocket設定好後就可以在人物產生武器外觀和種類並置於指定的Socket點上

 

Done

No comments:

Post a Comment