Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
CPLJigsoreQuandary

Trouble with weapons

Recommended Posts

Hey, can someone tell me what I'm doing wrong please?

 

I'm trying to put the shotgun animations from pk_anim1.wad into a new wad that I'm making but I am new to editing these things. I followed Weasel's GunLabs tutorial on how to make a basic gun, and it worked fine until I added the pk sprites. I changed the code accordingly once I added the sprites, but when I fire the shotgun all you see is the first frame, then only the flash, then the first frame again. It skips the animation.

 

This is my code:

 

ACTOR PerkShotgun : Shotgun replaces Shotgun
{
    
    Inventory.PickupMessage "You got the Auto Shotgun! Boom, boom, boom."
    Weapon.AmmoType "Shell"
    Weapon.AmmoUse 1
    Weapon.AmmoGive 16
    Weapon.SlotNumber 3
    AttackSound "weapons/shotgf"
    States
    {
    Spawn:
        SHOT A -1
        Stop
        Ready:
        SHTG A 1 A_WeaponReady
        Loop
    Select:
        SHTG A 1 A_Raise
        Loop
    Deselect:
        SHTG A 1 A_Lower
        Loop
    Fire:
        SHTG A 0 A_GunFlash
        SHTG A 1 A_FireBullets(5.5, 3, 8, 4, "BulletPuff", 1)
        PKSG B 2
        PKSG C 1
        PKSG D 2
        PKSG E 3
        PKSG F 4
        PKSG G 1
        PKSG H 3
        PKSG GFEDCB 2
        PKSG A 1
        PKSG A 7 A_ReFire
        Goto Ready
    Flash:
        SHTF B 3 Bright A_Light2
        SHTF A 2 Bright A_Light1
        Goto LightDone
    }
}

Share this post


Link to post
10 minutes ago, CPLJigsoreQuandary said:

        SHTG A 1 A_FireBullets(5.5, 3, 8, 4, "BulletPuff", 1)

Well, first thing, this frame is too short. It should be five tics long to match the flash.

The fire state reads properly otherwise. There's the missing A_PlaySound, but if AttackSound fills that same role, then that's fine.

Do the sprite names match with what's written in the code? That's the only thing that comes to mind if it's "skipping" the animation.

I notice in the fire state, it starts with SHTG, then goes through PKSG, and calling A_ReFire on one of those sprites in its last frame, which should probably also be SHTG A 7.

Share this post


Link to post
Posted (edited)

I don't see anything wrong with it. I even pulled up an example weapon of my own to compare the two and it looks fine.

Here's mine:

Actor NewShotgun : Shotgun replaces Shotgun
{
//$Sprite SHOTA0
Inventory.PickupSound "Weapons/ShotgunUp"
Weapon.UpSound "Weapons/ShotgunUp"
//DamageType Shotgun
Attacksound "weapons/nwshot"
Decal BulletChip
States
{
 Fire:
 SHTG A 3
 SHTG A 0 A_GunFlash
 SHTG A 7 A_FireBullets (5.9, 4.1, 10, 5, "BulletPuff")
 SHTG BCDE 2
 SHTG FG 0 A_PlaySound ("ShotCock")
 SHTG FG 3
 SHTG G 0 A_FireCustomMissile ("ShotgunCasing", 315+random(-8,8), 0,1,6)
 SHTG EDCB 2
 SHTG A 3
 SHTG A 4 A_ReFire
 Goto Ready
}
}

I know this is functional, and I don't see any real important difference between your code and mine.

The only thing I can think of is the images being offset improperly or corrupted or something. Check the sprites and make sure they appear properly under the "Hud/Weapon" sprite offsets. You should be able to select that in SLADE while looking at a sprite.

Aside from that, I can't see anything wrong.

Share this post


Link to post

I see you have it in a ZIP; it might be because ZIPs need to be the PK3 structure (i think, at least), not the WAD structure. Try putting the sprites in a "sprites" subfolder inside the zip, instead of between markers.

Share this post


Link to post
15 hours ago, 129thVisplane said:

I see you have it in a ZIP; it might be because ZIPs need to be the PK3 structure (i think, at least), not the WAD structure. Try putting the sprites in a "sprites" subfolder inside the zip, instead of between markers.

That did it! Thanks to both of you!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×