Replicating enemy abilities

Luigifan18

Member
So, I'm creating some characters, and one of them, Cassandra Belnades, is supposed to be able to use a special projectile to gain the abilities of whatever enemy it hits. However, I'm at a loss for how to recreate certain enemy abilities...



Right now, I want to allow Cassandra to execute the punching attack of a Crushtacean when she copies one. However, I have no idea how to make the MT_CRUSHCLAW followitem lunge forward a set distance and then retract back to following Cassandra when C1 is pressed... I also want the Crushtacean punch to be able to break bustable walls, including strong ones.

Here's what I have so far...

Crushtacean punch:
if player.mo.copy == MT_CRUSHSTACEAN then --Crushstacean punch
    player.followitem = MT_CRUSHCLAW --have a Crushstacean claw follow the player
    player.followitem.target = player.mo --prevent the claw from harming the player
    player.thokitem = MT_CRUSHCHAIN --attach the claw to the player with a chain
    if player.custom1down == 1 --when custom1 is pressed
    and player.mo.energy >= 6*FRACUNIT then --if the player has energy
        player.mo.energy = $ - 6*FRACUNIT
        S_StartSound(player.mo, sfx_s3k6b, nil)
        --perform Crushstacean rocket punch
    end
end



I'm not sure what to do with the Jet Jaw or Buggle or how to distinguish them. Right now, all I can think of is something involving CA_SWIM and underwatertics.



I know that I want Minus's power to involve burrowing in some fashion; diving to the ground if activated in the air, phasing through FOFs under a certain thickness, breaking bustable floors, passing harmlessly beneath hazards at ground level while embedded in the ground, attacking foes while popping back up, and being forced to pop up once energy runs out. However, I'm not sure how I'd make Cassandra enter an "underground" state to begin with…
 

Attachments

  • Cassandra - Badnik Copy Abilities.txt
    7.7 KB · Views: 78
Last edited:
Since the first post, I've made some updates to the script. Now my big problems are figuring out how to get the Minus digging power to actually work right, how to throw the Unidus' spikeballs or get them to orbit a decent distance away from Cassandra, how to stop Cassandra from being hurt by some of her own projectiles (like the Dragonbomber mine (which I finagled a solution of spawning far away from Cassandra) or Brak Eggman's flamethrower), and how to get the Brak Eggman sniping and missile attacks to work at all. Oh, and I still suspect that the Crushtacean punch isn't working right, I haven't actually tested it.
 

Attachments

  • CL_Cassandra-Belnades.pk3
    2.1 MB · Views: 64
Last edited:
The Egg Mobile copy ability can't fire the lasers, and I have no clue why...

Cassandra's Egg Mobile copy ability:
states[S_PLAY_CASSANDRA_EGGMOBILELASERSWEEP] = {
    sprite = SPR_PLAY_TRNSF,
    frame = FF_FULLBRIGHT|F,
    tics = 2*TICRATE,
    action = A_Boss1Laser,
    var1 = MT_LASER,
    var2 = 4,
    nextstate = S_PLAY_FALL
}
states[S_PLAY_CASSANDRA_EGGMOBILELASERSALVO] = {
    sprite = SPR_PLAY_TRNSF,
    frame = FF_FULLBRIGHT|F,
    tics = 2*TICRATE,
    action = A_Boss1Laser,
    var1 = MT_LASER,
    var2 = 2,
    nextstate = S_PLAY_FALL
}

addHook("PlayerThink", function(player)
    if player.mo and player.mo.valid then
    
        if player.mo.skin ~= "cassandra_b" then
            return
        end
        
        if player.mo.egglasercooldown == nil then
            player.mo.egglasercooldown = 0
        end
        
        if player.mo.egglasercooldown > 0 then
            if (leveltime%TICRATE) then
                player.mo.egglasercooldown = $ - 1*TICRATE
            end
        end
        
        if player.mo.firingmahlazor == nil then
            player.mo.firingmahlazor = 0
        end
        
        if player.mo.firingmahlazor > 0 then
            if (leveltime%TICRATE) then
                player.mo.firingmahlazor = $ - 1*TICRATE
            end
        end
        
        if player.mo.copy == MT_EGGMOBILE then --Egg Mobile
            if player.mo.copyduration == 1 then
                print("You copied the Egg Mobile! Press and hold C1 to enter flight mode! While in flight mode, press and hold Jump to ascend or Spin to descend!","While out of flight mode, press C2 to shoot a simple laser. While in flight mode, press C2 to initiate a sweeping laser attack!","While out of flight mode, press C3 to conjure a spikeball. While in flight mode, press C3 to initiate a big sweeping laser attack!")
            end
            if player.custom1down > 1
            and player.mo.energy >= 5*FRACUNIT
            and P_IsObjectOnGround(player.mo) == false then
                player.pflags = $&~PF_JUMPED --prevent air actions and shield actions during Buzz flight
            end
            if player.custom1down > 1
            and ((player.cmd.buttons & BT_JUMP == 0 and player.cmd.buttons & BT_SPIN == 0)
            or (player.cmd.buttons & BT_JUMP >= 1 and player.cmd.buttons & BT_SPIN >= 1)) --if neither or both of Jump and Spin are being held
            and player.mo.energy >= 5*FRACUNIT then --if the player has energy
                player.mo.flags = $1|MF_NOGRAVITY --player flies like the Egg Mobile
                if not (leveltime%TICRATE) then
                    player.mo.energy = $ - 5*FRACUNIT
                end
                P_SetObjectMomZ(player.mo, 0, false) --player hovers in the air
                player.mo.copypoweruse = 1 --prevent energy recharge during flight
            end
            if player.custom1down > 1
            and player.cmd.buttons & BT_JUMP >= 1
            and player.cmd.buttons & BT_SPIN == 0 --if Jump is being held, but Spin is not
            and player.mo.energy >= 5*FRACUNIT then --if the player has energy
                player.mo.flags = $1|MF_NOGRAVITY --player flies like the Egg Mobile
                if not (leveltime%TICRATE) then
                    player.mo.energy = $ - 5*FRACUNIT
                end
                P_SetObjectMomZ(player.mo, 5*FRACUNIT, false) --player slowly ascends
                player.mo.copypoweruse = 1 --prevent energy recharge during flight
            end
            if player.custom1down > 1
            and player.cmd.buttons & BT_JUMP == 0
            and player.cmd.buttons & BT_SPIN >= 1 --if Spin is being held, but Jump is not
            and player.mo.energy >= 5*FRACUNIT then --if the player has energy
                player.mo.flags = $1|MF_NOGRAVITY --player flies like the Egg Mobile
                if not (leveltime%TICRATE) then
                    player.mo.energy = $ - 5*FRACUNIT
                end
                P_SetObjectMomZ(player.mo, -5*FRACUNIT, false) --player slowly descends
                player.mo.copypoweruse = 1 --prevent energy recharge during flight
            end
            if (player.custom1down == 0 or player.mo.energy < 5*FRACUNIT)
            and player.mo.firingmahlazor == 0 then
                player.mo.flags = $&~MF_NOGRAVITY --stop flying
                player.mo.copypoweruse = 0 --allow energy to recharge while not flying
                if P_IsObjectOnGround(player.mo) == false then
                    player.pflags = $1|PF_JUMPED --re-enable air and shield actions if they haven't been used (PF_THOKKED is *not* removed)
                end
            end
            if player.custom2down == 1
            and player.custom1down == 0
            and player.mo.energy >= 7*FRACUNIT/4
            and player.mo.egglasercooldown == 0 then
                player.mo.energy = $ - 7*FRACUNIT/4
                local egglaser = P_SpawnPlayerMissile(player.mo, MT_LASER, 0)
                player.mo.egglasercooldown = 3*TICRATE/4
            end
            if player.custom2down == 1
            and player.custom1down > 1
            and player.mo.energy >= 25*FRACUNIT/2
            and P_IsObjectOnGround(player.mo) == false
            and player.mo.egglasercooldown == 0 then
                player.mo.energy = $ - 25*FRACUNIT/2
                player.mo.state = S_PLAY_CASSANDRA_EGGMOBILELASERSWEEP
                player.mo.firingmahlazor = 2*TICRATE
                player.mo.egglasercooldown = 2*TICRATE
            end
            if player.custom3down == 1
            and player.custom1down == 0
            and player.mo.energy >= 10*FRACUNIT then
                player.mo.energy = $ - 10*FRACUNIT
                local spikemine = P_SpawnMobjFromMobj(player.mo, P_RandomRange(-3000, 3000)*FRACUNIT, P_RandomRange(-3000, 3000)*FRACUNIT, P_RandomRange(-3000, 3000)*FRACUNIT, MT_SPIKEBALL)
            end
            if player.custom3down == 1
            and player.custom1down > 1
            and player.mo.energy >= 25*FRACUNIT
            and P_IsObjectOnGround(player.mo) == false
            and player.mo.egglasercooldown == 0 then
                player.mo.energy = $ - 25*FRACUNIT
                player.mo.state = S_PLAY_CASSANDRA_EGGMOBILELASERSALVO
                player.mo.firingmahlazor = 2*TICRATE
                player.mo.egglasercooldown = 2*TICRATE
            end
            if player.mo.firingmahlazor > 0 then
                player.mo.flags = $1|MF_NOGRAVITY
                player.mo.flags2 = $1|MF2_FIRING
                player.mo.copypoweruse = 1
                P_SetObjectMomZ(player.mo, 0, false)
                player.pflags = $1|PF_FULLSTASIS --can't move during big laser attacks
            end
            if player.mo.firingmahlazor > 0
            and P_PlayerInPain(player) == true --if the player gets hurt while firing the big laser
                player.mo.firingmahlazor = 0 --immediately stop
            end
            if player.mo.firingmahlazor == 0 then
                player.mo.flags2 = $&~MF2_FIRING
            end
        end
        
        if player.mo.copy ~= MT_EGGMOBILE then
            player.mo.egglasercooldown = 0
            player.mo.firingmahlazor = 0
        end
 

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

Back
Top