Jump to content

How to change sprites from Caco


Spenkie

Recommended Posts

Alright, let me just clarify that I am completely new to modding doom, but I thought it would be funny if I replaced the sprites of the Cacodemon with the face of some random guy for a shitpost mod. I think I'm supposed to use Inheritance, but it's not exactly working. To clarify, I am using Zscript and I copy-pasted and tweaked this code from this site:https://github.com/ZDoom/gzdoom/blob/master/wadsrc/static/zscript/actors/doom/cacodemon.zs

 

 

 

//===========================================================================
//
// Cacodemon
//
//===========================================================================
class MyCacodemon : Cacodemon
{
    Default
    {
        Health 400;
        Radius 31;
        Height 56;
        Mass 400;
        Speed 8;
        PainChance 128;
        Monster;
        +FLOAT +NOGRAVITY
        SeeSound "caco/sight";
        PainSound "caco/pain";
        DeathSound "caco/death";
        ActiveSound "caco/active";
        Obituary "$OB_CACO";
        HitObituary "$OB_CACOHIT";
        Tag "$FN_CACO";
    }
    States
    {
    Spawn:
        HEAD A 10 A_Look;
        Loop;
    See:
        HEAD A 3 A_Chase;
        Loop;
    Missile:
        HEAD B 5 A_FaceTarget;
        HEAD C 5 A_FaceTarget;
        HEAD D 5 BRIGHT A_HeadAttack;
        Goto See;
    Pain:
        HEAD E 3;
        HEAD E 3 A_Pain;
        HEAD F 6;
        Goto See;
    Death:
        HEAD G 8;
        HEAD H 8 A_Scream;
        HEAD I 8;
        HEAD J 8;
        HEAD K 8 A_NoBlocking;
        HEAD L -1 A_SetFloorClip;
        Stop;
    Raise:
        HEAD L 8 A_UnSetFloorClip;
        HEAD KJIHG 8;
        Goto See;
    }
}

//===========================================================================
//
// Cacodemon plasma ball
//
//===========================================================================
class MyCacodemon : Cacodemon
{
    Default
    {
        Radius 6;
        Height 8;
        Speed 10;
        FastSpeed 20;
        Damage 5;
        Projectile;
        +RANDOMIZE
        +ZDOOMTRANS
        RenderStyle "Add";
        Alpha 1;
        SeeSound "caco/attack";
        DeathSound "caco/shotx";
    }
    States
    {
    Spawn:
        BAL2 AB 4 BRIGHT;
        Loop;
    Death:
        BAL2 CDE 6 BRIGHT;
        Stop;
    }
}


//===========================================================================
//
// Code (must be attached to Actor)
//
//===========================================================================

extend class Actor
{
    void A_HeadAttack()
    {
        let targ = target;
        if (targ)
        {
            if (CheckMeleeRange())
            {
                int damage = random[pr_headattack](1, 6) * 10;
                A_StartSound (AttackSound, CHAN_WEAPON);
                int newdam = target.DamageMobj (self, self, damage, "Melee");
                targ.TraceBleed (newdam > 0 ? newdam : damage, self);
            }
            else
            {
                // launch a missile
                SpawnMissile (targ, "CacodemonBall");
            }
        }
    }
}

 

 

I just want to use my custom sprites instead of a regular Cacodemon. I don't want to change anything else but the Cacodemon and I don't understand why it won't work. I'm doing this using SLADE, if that's any help.

Share this post


Link to post

If the class extension is part of your code, then that's probably why your game isn't starting. First of all, you can't extend the base actor class, and second is that A_HeadAttack() already exists. So just remove that.

 

Also your custom projectile is called MyCacodemon as well, should probably change that, since it makes no sense and also will produce a conflict. And it should inherit from CacodemonBall instead. Then to have your Cacodemon fire it's custom projectile, use A_CustomComboAttack() instead of the hardcoded A_HeadAttack(). Passing "random[pr_headattack](1, 6) * 10" as the functions' damage parameter will also allow it to do the exact same melee damage as the Cacodemon.

Share this post


Link to post

If all you're doing is a sprite replacement you don't need any ZScript, just put the sprites in a WAD with the same lump names as the original sprites you're replacing.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...