Help creating a custom enemy

Lua:
function A_CreeperChase(actor, var1, var2)
    A_Chase(actor, var1, var2)
    if actor.reactiontime == 0 then
        A_PlayActiveSound(actor, var1, var2)
        actor.reactiontime = actor.info.reactiontime
    end
end
 
function A_CreeperAttack(actor, var1, var2)
    P_DamageMobj(actor.target, actor, actor)
    S_StopSound(actor)
    S_StartSound(nil, actor.info.attacksound)
end
 
//states[S_CREEPERGHOUL_STAND1]
states[S_CREEPERGHOUL_ATK1] = {SPR_CREE, 2, 20, A_CreeperAttack, 1, 7, S_CREEPERGHOUL_CHASE1}
states[S_CREEPERGHOUL_CHASE1] = {SPR_CREE, 1, 4, A_CreeperChase, 1, 1, S_CREEPERGHOUL_CHASE2}
states[S_CREEPERGHOUL_CHASE2] = {SPR_CREE, 0, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE3}
states[S_CREEPERGHOUL_CHASE3] = {SPR_CREE, 1, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE4}
states[S_CREEPERGHOUL_CHASE4] = {SPR_CREE, 0, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE5}
states[S_CREEPERGHOUL_CHASE5] = {SPR_CREE, 1, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE6}
states[S_CREEPERGHOUL_CHASE6] = {SPR_CREE, 0, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE7}
states[S_CREEPERGHOUL_CHASE7] = {SPR_CREE, 1, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE8}
states[S_CREEPERGHOUL_CHASE8] = {SPR_CREE, 0, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE9}
states[S_CREEPERGHOUL_CHASE9] = {SPR_CREE, 1, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE10}
states[S_CREEPERGHOUL_CHASE10] = {SPR_CREE, 0, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE11}
states[S_CREEPERGHOUL_CHASE11] = {SPR_CREE, 1, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE12}
states[S_CREEPERGHOUL_CHASE12] = {SPR_CREE, 0, 4, A_Chase, 1, 1, S_CREEPERGHOUL_CHASE1}
states[S_CREEPERGHOUL_PAIN1] = {SPR_CREE, 0, TICRATE/2, none, 0, 0, S_CREEPERGHOUL_CHASE1}
 
mobjinfo[MT_CREEPERGHOUL] = {
    //$Name Creeper Ghoul
    //$Sprite CREEA0
    doomednum = 1993,
    spawnstate = S_CREEPERGHOUL_CHASE1,
    seestate = S_CREEPERGHOUL_CHASE1,
    meleestate = S_CREEPERGHOUL_ATK1,
    painstate = S_CREEPERGHOUL_PAIN1,
    deathstate = S_CREEPERGHOUL_DEATH1,
    seesound = sfx_creep1,
    activesound = sfx_creep1,
    attacksound = sfx_creep3,
    deathsound = sfx_creep2,
    speed = 35,
    reactiontime = 0,
    radius = 24*FRACUNIT,
    height = 16*FRACUNIT,
    spawnhealth = 4,
    mass = 100,
    flags = MF_SHOOTABLE|MF_SPECIAL|MF_ENEMY
}

1. My enemy's melee state isn't working at all. It works when I make it a MISSILESTATE, but then that causes them to use it from long distances and at complete random.

2. Trying to add a MF2_SHADOW flag completely breaks the monster, making it unable to move despite no errors showing up in the console.
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top