how do i make this script work

SonicHacker141

battle network-er
so i used a script from STC Fleetway (it's reusable) and tried to make my mega buster replace it, and the code keeps destroying it.
also here is the code:
freeslot(
"SPR2_VICT", (im doing smth related to this, just mega man teleporting)
"SPR2_SHOT",
"SPR2_MBUST",

states[S_PLAY_MEGAMAN_SHOOTSTATE] = {
sprite = SPR_PLAY,
frame = SPR2_SHOT|FF_SEMIBRIGHT|A,
tics = 35,
action = A_None,
//action = A_Boss1Laser,
//var1 = MT_LASER,
//var2 = 3,
nextstate = S_PLAY_STND

addHook("PlayerThink", function(player)
if (player.cmd.buttons == BT_FIRENORMAL)
and (player.mo.state ~= S_PLAY_MEGAMAN_SHOOTSTATE)
and (player.mo.skin == "megaman")
player.mo.state = S_PLAY_MEGAMAN_SHOOTSTATE
P_SpawnPlayerMissile(player.mo, SPR2_MBST, MF2_SUPERFIRE)
end
end)
 
I think might have the same problem. I tried to make a projectile and it just disappears immediately. Except it still exists in memory for some reason.

Though first, shouldn't your missile be MT_MBST, instead of SPR2_MBST? (I'd, uh, like to make sure we have the same problem here.)
Post automatically merged:

Got it. For some reason, the object SPR2_MBST or MT_MBST, whatever the projectile is, needs the MF_NOBLOCKMAP set to not instantly vanish. Apparently even turret projectiles use this flag, even though they explode on contact with ground.

Here's the code for my projectile
Lua:
mobjinfo[MT_CUSTOMMISSILE] = {
    MapThingNum = -1,
    spawnstate = S_INIT,
    deathstate = S_NULL,
    deathsound = sfx_trghit,
    spawnhealth = 5000,
    mass = 10,
    speed = FRACUNIT,
    radius = 24*FRACUNIT,
    height = 24*FRACUNIT,
    flags = MF_SPECIAL|MF_MISSILE|MF_NOBLOCKMAP ---- <<< here
}

states[S_INIT] = {
    sprite = SPR_CANG,
    frame =  FF_FULLBRIGHT|FF_TRANS40|A,
    tics = 100,
    nextstate = S_INKSPAWN,
}

addHook("ThinkFrame", function()
    for player in players.iterate do
        if player.mo.skin ~= "sonic" then
            continue
        end
       
        if not player.tossed then
            player.tossed = {}
        end
       
        if not (player.cmd.buttons & BT_USE) then
            player.spintapready = true
            player.spintapping = false
        elseif player.spintapready then
            player.spintapping = true
            player.spintapready = false
        else
            player.spintapping = false
        end
       
        if player.spintapping then
        table.insert(player.tossed, 1, P_SpawnPlayerMissile(player.mo, MT_CUSTOMMISSILE, MF2_DONTRESPAWN))
            if player.tossed[6] and player.tossed[6].valid then
                P_RemoveMobj(player.tossed[6])
            end
            table.remove(player.tossed, 6)
        end
    end
end)
 
Last edited:

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

Back
Top