• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

KF Having a problem with textures for first person weapon

Avarice

Grizzled Veteran
Jan 28, 2014
64
0
Im new to kf modding knowledge in other coding languages so not completely unknowing of what im doing.


Anyways a friend wanted us to have a server so i went to make one, got it up, etc. But hit a snag, i was told to always try to limit loaded files, so i decided to try. The same freind wanted the zabuza sword for the server. So I tryed to pull the textures from the the 3 files(animations, textures, and static mesh), after rebinding the the swords file to the new file, i came up with a snag.

In 3rd person, i can see the sword, in trader i can, in hud i can. In first person i can not, I will paste all the code and hopefully someone can tell me what i did wrong, or which one controls the first person texture then i can figure it out from there



ZabuzasSword.u
Code:
class ZabuzasSword extends KFMeleeGun;

defaultproperties
{
     weaponRange=90.000000
     BloodSkinSwitchArray=0
     BloodyMaterialRef="DeathsDoor.1"
     bSpeedMeUp=True
     Weight=2.000000
     StandardDisplayFOV=75.000000
     TraderInfoTexture=Texture'DeathsDoor_T.zabuza_shop'
     bIsTier2Weapon=True
     MeshRef="DeathsDoor_T.Zabuzas"
     SkinRefs(0)="DeathsDoor.1"
     SelectSoundRef="KF_KatanaSnd.Katana_Select"
     HudImageRef="KillingFloor2HUD.WeaponSelect.katana_unselected"
     SelectedHudImageRef="DeathsDoor_T.zabuza_selected"
     FireModeClass(0)=Class'DeathsDoor.ZabuzasSwordFire'
     FireModeClass(1)=Class'DeathsDoor.ZabuzasSwordFireB'
     AIRating=0.400000
     CurrentRating=0.600000
     Description="Zabuzas Kubikiribocho Sword."
     DisplayFOV=75.000000
     Priority=110
     GroupOffset=4
     PickupClass=Class'DeathsDoor.ZabuzasSwordPickup'
     BobDamping=8.000000
     AttachmentClass=Class'DeathsDoor.ZabuzasSwordAttachment'
     IconCoords=(X1=246,Y1=80,X2=332,Y2=106)
     ItemName="Kubikiribocho"
}

ZabuzasSwordFire
Code:
class ZabuzasSwordFire extends KFMeleeFire;
var() array<name> FireAnims;

simulated event ModeDoFire()
{
    local int AnimToPlay;

    if(FireAnims.length > 0)
    {
        AnimToPlay = rand(FireAnims.length);
        FireAnim = FireAnims[AnimToPlay];
    }

    Super.ModeDoFire();

}

defaultproperties
{
     FireAnims(0)="Fire"
     FireAnims(1)="Fire2"
     FireAnims(2)="fire3"
     FireAnims(3)="Fire4"
     FireAnims(4)="Fire5"
     FireAnims(5)="Fire6"
     MeleeDamage=135
     ProxySize=0.150000
     weaponRange=130.000000
     DamagedelayMin=0.320000
     DamagedelayMax=0.320000
     hitDamageClass=Class'DeathsDoor.DamTypeZabuzasSword'
     HitEffectClass=Class'KFMod.AxeHitEffect'
     MeleeHitSoundRefs(0)="KF_KatanaSnd.Katana_HitFlesh"
     WideDamageMinHitAngle=0.200000
     FireRate=0.670000
     BotRefireRate=0.850000
}

ZabuzasSwordFireB
Code:
class ZabuzasSwordFireB extends KFMeleeFire;

defaultproperties
{
     MeleeDamage=350
     ProxySize=0.150000
     weaponRange=95.000000
     DamagedelayMin=0.650000
     DamagedelayMax=0.650000
     hitDamageClass=Class'DeathsDoor.DamTypeZabuzasSword'
     HitEffectClass=Class'KFMod.AxeHitEffect'
     MeleeHitSoundRefs(0)="KF_AxeSnd.Axe_HitFlesh"
     WideDamageMinHitAngle=0.650000
     bWaitForRelease=True
     FireAnim="HardAttack"
     FireRate=1.000000
     BotRefireRate=0.850000
}
ZabuzasSword

Code:
class ZabuzasSwordPickup extends KFWeaponPickup;

defaultproperties
{
     Weight=2.000000
     PowerValue=90
     SpeedValue=90
     RangeValue=10
     Description="Kubikiribocho"
     ItemName="Kubikiribocho"
     ItemShortName="Kubikiribocho"
     CorrespondingPerkIndex=4
     InventoryType=Class'DeathsDoor.ZabuzasSword'
     PickupMessage="You got the Kubikiribōchō."
     PickupSound=Sound'KF_AxeSnd.Axe_Pickup'
     PickupForce="AssaultRiflePickup"
     StaticMesh=StaticMesh'DeathsDoor_SM.Zabuzas'
     CollisionRadius=27.000000
     CollisionHeight=5.000000
}
ZabuzasSwordAttachment
Code:
class ZabuzasSwordAttachment extends KFMeleeAttachment;

defaultproperties
{
     MovementAnims(0)="JogF_Katana"
     MovementAnims(1)="JogB_Katana"
     MovementAnims(2)="JogL_Katana"
     MovementAnims(3)="JogR_Katana"
     TurnLeftAnim="TurnL_Katana"
     TurnRightAnim="TurnR_Katana"
     CrouchAnims(0)="CHWalkF_Katana"
     CrouchAnims(1)="CHWalkB_Katana"
     CrouchAnims(2)="CHWalkL_Katana"
     CrouchAnims(3)="CHWalkR_Katana"
     CrouchTurnRightAnim="CH_TurnR_Katana"
     CrouchTurnLeftAnim="CH_TurnL_Katana"
     IdleCrouchAnim="CHIdle_Katana"
     IdleWeaponAnim="Idle_Katana"
     IdleRestAnim="Idle_Katana"
     IdleChatAnim="Idle_Katana"
     IdleHeavyAnim="Idle_Katana"
     IdleRifleAnim="Idle_Katana"
     FireAnims(0)="FastAttack1_Katana"
     FireAnims(1)="FastAttack2_Katana"
     FireAnims(2)="FastAttack3_Katana"
     FireAnims(3)="FastAttack4_Katana"
     FireAltAnims(0)="HardAttack1_Katana"
     FireAltAnims(1)="HardAttack1_Katana"
     FireAltAnims(2)="HardAttack1_Katana"
     FireAltAnims(3)="HardAttack1_Katana"
     FireCrouchAnims(0)="CHFastAttack1_Katana"
     FireCrouchAnims(1)="CHFastAttack2_Katana"
     FireCrouchAnims(2)="CHFastAttack3_Katana"
     FireCrouchAnims(3)="CHFastAttack4_Katana"
     FireCrouchAltAnims(0)="CHHardAttack1_Katana"
     FireCrouchAltAnims(1)="CHHardAttack1_Katana"
     FireCrouchAltAnims(2)="CHHardAttack1_Katana"
     FireCrouchAltAnims(3)="CHHardAttack1_Katana"
     HitAnims(0)="HitF_Katana"
     HitAnims(1)="HitB_Katana"
     HitAnims(2)="HitL_Katana"
     HitAnims(3)="HitR_Katana"
     PostFireBlendStandAnim="Blend_Katana"
     PostFireBlendCrouchAnim="CHBlend_Katana"
     MeshRef="DeathsDoor_A.Zabuzas_3"
}
 
Alright ill give it a try. i ended up getting the sword shape to show without the texture, i tryed to pull the stuff from inside the included sound/textures and such and add them to mine and didnt know if i did it right. Thanks


Also, mods, can yall please fix this annoying waiting to post thing. I behave dont worry :)
 
Upvote 0
Sometimes there's a problem with KFMeleeGun that doesn't load assets properly (for what reason I do not know; probably something to do with the player controller...).

For my Power Up Pack's machete, I had to write a function that would load textures that would be called in the weapon's tick if the texture == None. You won't have to write as much since you're probably only using 1 or 2 textures.

https://www.dropbox.com/s/cx7vska6932xcvu/CyberMachete.uc[url]https://www.dropbox.com/s/cx7vska6932xcvu/CyberMachete.uc[/URL]

You'll need to adapt the functions to your code, but it's usable. The functions you should look at are:

WeaponTick()
InitMaterials()
Destroyed()
PreTravelCleanUp()

Your weapon tick should be something like this:
Code:
[COLOR=Lime]//Put these at the top of your class.[/COLOR]
var Material MySkin;
var Material MySkinBloody;

simulated function WeaponTick(float dt)
{
        super.WeaponTick(dt);
        if(MySkin == None || MySkinsBlood == None){
                InitMaterials();
              [COLOR=SeaGreen]  [COLOR=Lime]//'x' being whatever array your weapon's skin is supposed to be on.[/COLOR][/COLOR]
                Skins[[COLOR=Lime]x[/COLOR]] = MySkin;
                BloodyMaterial = MySkinBloody;
                
        }
}
 
Upvote 0