Me niether. It seems that there is no object flag to mark something as being "carriable". I'm trying to make a character that is being carried by Tails be elgible to carry something else, like Flight Formation in Sonic Heroes. I'll have to look into this further.Try this it's for making projectiles.
https://wiki.srb2.org/wiki/Projectile
I don't see anything really useful though...
addHook("ThinkFrame", do
for player in players.iterate
if player.mo
and not (player.pflags & PF_NIGHTSMODE) //No Nights Mode Hanger
if (player.pflags & PF_CARRIED & PF_GLIDING) //Gliders and carried players get a hanger
player.mo.hang = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BLACKEGGMAN_MISSILE)
player.mo.hang.target = player.mo
if not (player.pflags & PF_CARRIED & PF_GLIDING)
player.mo.hang = P_RemoveMobj(mobj_t mobj)
end
end
end
Well, how do you expect to reference objects you delete? (You can respawn new ones using the same variable name as the first one spawned. You just can't change or read ("reference") attributes from non-existant objects.)Monster Iestyn brought to my attention that I could use a custom object, so I did. I tried to make it so that the invisible hanger (modified Brak Eggman missile) would spawn if you are gliding or flying, and would delete itself when you aren't gliding or flying. Do delete it, I'd have to use P_RemoveMobj, but as the wiki says, "The object cannot be referenced again in Lua after using this." I want it to respawn when the player is gliding or flying. Is there any workaroud to this?
addHook("ThinkFrame", do
for player in players.iterate
if player.mo
and not (player.pflags & PF_NIGHTSMODE) //No Nights Mode Hanger
if (player.pflags & PF_CARRIED & PF_GLIDING) //Gliders and carried players get a hanger
player.mo.hang = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BLACKEGGMAN_MISSILE)
player.mo.hang.target = player.mo
if not (player.pflags & PF_CARRIED & PF_GLIDING)
player.mo.hang = P_RemoveMobj(MT_BLACKEGGMAN_MISSILE)
end
end
end
Well,Thanks Zappy, so this code is ok for what I'm trying to do?
Code:addHook("ThinkFrame", do for player in players.iterate if player.mo and not (player.pflags & PF_NIGHTSMODE) //No Nights Mode Hanger if (player.pflags & PF_CARRIED & PF_GLIDING) //Gliders and carried players get a hanger player.mo.hang = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BLACKEGGMAN_MISSILE) player.mo.hang.target = player.mo if not (player.pflags & PF_CARRIED & PF_GLIDING) player.mo.hang = P_RemoveMobj(MT_BLACKEGGMAN_MISSILE) end end end
addHook("MobjThinker", do
for player in players.iterate
if player.mo
and not (player.pflags & PF_NIGHTSMODE) //No Nights Mode Hanger
if (player.pflags & PF_CARRIED or player.pflags & PF_GLIDING) //Gliders and carried players get a hanger
if player.hang == nil
player.hang = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BLACKEGGMAN_MISSILE)
player.hang.target = player.mo
if not (player.pflags & PF_CARRIED & PF_GLIDING)
P_RemoveObj(player.hang)
player.hang = nil
end
end
end
end)
FREESLOT
S_HANGON_1
S_HANGON_2
SPR_HANG
Object MT_BLACKEGGMAN_MISSILE
MapThingNum = -1
SpawnState = S_HANGON_1
SpawnHealth = 9999
SeeState = 0
SeeSound = sfx_None
ReactionTime = 8
AttackSound = 0
PainState = S_NULL
PainChance = 0
PainSound = sfx_None
MeleeState = S_NULL
MissileState = S_NULL
DeathState = S_NULL
XDeathState = S_NULL
DeathSound = sfx_None
Speed = 0
Radius = 16*FRACUNIT
Height = 5*FRACUNIT
Mass = 100
Damage = 0
ActiveSound = 0
Flags = MF_RUNSPAWNFUNC|MF_SPECIAL|MF2_DONTDRAW
RaiseState = 0
State S_HANGON_1
SpriteName = HANG
SpriteFrame = A
Duration = 1
Next = S_HANGON_2
Action None
State S_HANGON_2
SpriteName = HANG
SpriteFrame = A
Duration = 70
Next = S_HANGON_2
Action A_CapeChase
Hm. Actually, you might want to check "if not player.hang == nil" before removing the object, I forgot that. And I'm pretty sure that's not exactly how MobjThinker works. If you're lazy, you can replace "do" at the start with "function()". If you're not, you can replace "do" with "function(mobj)", replace "for player in players.iterate" with "local player = mobj.player", remove one of the "end"s at the end, and add ", MT_PLAYER" between the last "end" and the closing bracket. If you do the second method, you can remove the "if player.mo" line, and change "and" to "if" in the Nights mode check thing. Also, you forgot an "end" for the "if player.hang == nil" check.Thanks and done, Zappy.
Code:addHook("MobjThinker", do for player in players.iterate if player.mo and not (player.pflags & PF_NIGHTSMODE) //No Nights Mode Hanger if (player.pflags & PF_CARRIED or player.pflags & PF_GLIDING) //Gliders and carried players get a hanger if player.hang == nil player.hang = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BLACKEGGMAN_MISSILE) player.hang.target = player.mo if not (player.pflags & PF_CARRIED & PF_GLIDING) P_RemoveObj(player.hang) player.hang = nil end end end end)
*Shrug* I'm not a Sanic Oopsie Control (Sonic Object Configuration/SOC) guy, I'm a Lua guy, and even then I'm not that good at being one. But I don't see anything wrong with the MainCfg thing you have there, other than possibly you have "duration 70" instead of 1 for S_HANGON_2 (the CapeChase only executes every 70th tic currently). That should not cause a crash, though.Also, my SRB2 freezes while trying to load the MAINCFG. It was working fine before I added the freeslots.
Code:FREESLOT S_HANGON_1 S_HANGON_2 SPR_HANG Object MT_BLACKEGGMAN_MISSILE -Snip- State S_HANGON_1 -Snip- State S_HANGON_2 SpriteName = HANG SpriteFrame = A Duration = 70 Next = S_HANGON_2 Action A_CapeChase
Thanks and done, Zappy.
Also, my SRB2 freezes while trying to load the MAINCFG. It was working fine before I added the freeslots.Code:addHook("MobjThinker", do for player in players.iterate if player.mo and not (player.pflags & PF_NIGHTSMODE) //No Nights Mode Hanger if (player.pflags & PF_CARRIED or player.pflags & PF_GLIDING) //Gliders and carried players get a hanger if player.hang == nil player.hang = P_SpawnMobj(player.mo.x, player.mo.y, player.mo.z, MT_BLACKEGGMAN_MISSILE) player.hang.target = player.mo if not (player.pflags & PF_CARRIED & PF_GLIDING) P_RemoveObj(player.hang) player.hang = nil end end end end)
Code:FREESLOT S_HANGON_1 S_HANGON_2 SPR_HANG Object MT_BLACKEGGMAN_MISSILE MapThingNum = -1 SpawnState = S_HANGON_1 SpawnHealth = 9999 SeeState = 0 SeeSound = sfx_None ReactionTime = 8 AttackSound = 0 PainState = S_NULL PainChance = 0 PainSound = sfx_None MeleeState = S_NULL MissileState = S_NULL DeathState = S_NULL XDeathState = S_NULL DeathSound = sfx_None Speed = 0 Radius = 16*FRACUNIT Height = 5*FRACUNIT Mass = 100 Damage = 0 ActiveSound = 0 Flags = MF_RUNSPAWNFUNC|MF_SPECIAL|MF2_DONTDRAW RaiseState = 0 State S_HANGON_1 SpriteName = HANG SpriteFrame = A Duration = 1 Next = S_HANGON_2 Action None State S_HANGON_2 SpriteName = HANG SpriteFrame = A Duration = 70 Next = S_HANGON_2 Action A_CapeChase
MT_BLACKEGGMAN_MISSILE exists in Sonic Robo Blast 2 itself, unless a post-2.1.0 update removed 2.0 Brak EggHead's missile objects. I don't see how it should have any effect.All I can see is that MT_BLACKEGGMAN_MISSILE is missing from the FREESLOT, maybe if you add that it might fix it, but I am not entirely sure