header general

[SUBMISSION] Familiar

  • DeVloek
  • DeVloek's Avatar
  • Arachnotron
  • Arachnotron
More
7 months 1 week ago - 7 months 1 week ago #31 by DeVloek
Replied by DeVloek on topic [SUBMISSION] Familiar (formerly Dark Genie)

I saw those Familiar sprites too

Oh good, I thought I was going crazy. I knew what I saw but I spent 10 more minutes spawning Gfamiliars around a Spiderboss and it never happened again.

I think later today I'll have some time to take a look at the code, if Gothic doesn't get back to you first. I usually have difficulties parsing other people's code that isn't commented line for line, but maybe I can see whats wrong. Might be a misnamed particle sprite or something like that.

oh btw the credits text also still refers to the Dark Genie.
Last edit: 7 months 1 week ago by DeVloek.

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar
  • Arachnotron
  • Arachnotron
More
7 months 1 week ago - 7 months 1 week ago #32 by DeVloek
Replied by DeVloek on topic [SUBMISSION] Familiar (formerly Dark Genie)
I was able to reproduce the bug. This happens when you spawn a Gfamiliar right next to another actor:

When the Gfamiliar wakes up it'll spawn FamiliarRockpiece. But if this rockpiece can't spawn because another actor (a spidermastermind for example) is blocking the way, it'll enter its death state immediately. In the death state there is no frame number specified, the # tells the actor to use the last used frame and this is not the rockpiece, but presumably one from the wake up animation of the Gfamiliar. If you comment out both FNIX "#" lines (300 and 302), the bug is gone.

edit: you can easily fix this by giving FamiliarRockpiece the THRUACTORS flag
Last edit: 7 months 1 week ago by DeVloek.

Please Log in or Create an account to join the conversation.

  • 9Rifleman
  • 9Rifleman's Avatar Topic Author
  • Chaingunner
  • Chaingunner
More
7 months 1 week ago #33 by 9Rifleman
Replied by 9Rifleman on topic [SUBMISSION] Familiar
Updated, thanks for the help! I suppose when this is added, Gothic should add you two in credits as co-authors at this point :)

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar
  • Arachnotron
  • Arachnotron
More
7 months 1 week ago #34 by DeVloek
Replied by DeVloek on topic [SUBMISSION] Familiar
hah no worries, I'm always glad to help with things that are interesting to me :)

Please Log in or Create an account to join the conversation.

  • Gothic
  • Gothic's Avatar
  • Moderator
  • Moderator
More
7 months 3 days ago #35 by Gothic
Replied by Gothic on topic [SUBMISSION] Familiar
I'm experiencing the same bug with the rocks if I spawn a familiar next to a wall. It can be fixed by replacing the "TNT1 A" on its spawn state with "FNIX S" (or T-U-V-W). If this happens, they will always spawn with that initial sprite, but it's better than looking like more Familiars.
Alternatively, you could separate the rocks into 5 different classes like the original FireDemonRocks . I was trying to reduce them to a single class to avoid having multiple similar classes, but I see this can cause some problems.

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar
  • Arachnotron
  • Arachnotron
More
7 months 3 days ago - 7 months 3 days ago #36 by DeVloek
Replied by DeVloek on topic [SUBMISSION] Familiar

It can be fixed by replacing the "TNT1 A" on its spawn state with "FNIX S" (or T-U-V-W). If this happens, they will always spawn with that initial sprite, but it's better than looking like more Familiars.
Another, zscript-exclusive method is to randomize the initial sprite for the rock piece like this:
Code:
class FamiliarRockPiece : FireDemonRock1 { Default { +THRUACTORS; } States { Spawn: TNT1 A 1 NoDelay { frame = random(18,22); } Fly: FNIX "#" 1; Loop; Death: FNIX "#" 5 A_SmBounce(); XDeath: FNIX "#" 200; Stop; } }
frame = 0 is FNIX A, frame = 18 is FNIX S. [strike]Note that the initial spawn frame has to have a duration of at least 1, if it's 0 and the rock piece is blocked when spawning, it will fall thru right to the death state and use the wrong sprites again[/strike] edit: ok turns out that's actually not true, the death state will always be entered if the rockpiece spawns inside a wall. See one of my posts below for an actual fix.
Last edit: 7 months 3 days ago by DeVloek. Reason: some clarification

Please Log in or Create an account to join the conversation.

  • Gothic
  • Gothic's Avatar
  • Moderator
  • Moderator
More
7 months 3 days ago #37 by Gothic
Replied by Gothic on topic [SUBMISSION] Familiar

Another, zscript-exclusive method to randomize the initial sprite for the rock piece like this:
Still experiencing the bug.

I didn't know about the "frame" property, I tried using with the old code:
Code:
class FamiliarRockPiece : FireDemonRock1 { Default { +THRUACTORS } States { Spawn: FNIX S 1 NoDelay { switch(TID) { case 1337: frame = 18; break; case 1338: frame = 19; break; case 1339: frame = 20; break; case 1340: frame = 21; break; case 1341: frame = 22; break; } } Fly: FNIX "#" 1; Loop; Death: FNIX "#" 5 A_SmBounce(); XDeath: FNIX "#" 200; Stop; } }

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar
  • Arachnotron
  • Arachnotron
More
7 months 3 days ago - 7 months 3 days ago #38 by DeVloek
Replied by DeVloek on topic [SUBMISSION] Familiar

I didn't know about the "frame" property, I tried using with the old code:
Hm ok so I took a look at the original code, it seems like the TID is used to spawn one of each rock piece (S to W, in that order), not randomized. [strike]The code I posted above spawns random rocks no matter what[/strike], but that may not be the intention.

edit: OK turns out my code didn't work either, the spawn state is always skipped when the rockpiece tries to spawn inside a wall. But after some fiddling I managed to make it work as originally intended:
Code:
class FamiliarRockPiece : FireDemonRock1 { Default { +THRUACTORS; } States { Spawn: FNIX "#" 1 NoDelay { frame = TID - 1319; } Loop; Death: FNIX "#" 5 { frame = TID - 1319; A_SmBounce(); } XDeath: FNIX "#" 200; Stop; } }
frame = TID - 1319; means that when the rockpiece was assigned a TID of 1337 (this happens in the CA_FamSpawnRock function), frame 18 will be used, a TID of 1338 uses frame 19 and so on. The same line is added to the Death state, so if a rockpiece enters its death state because it has skipped the spawn state upon spawning inside or very close to a wall, the frame will be changed according to the TID regardless.

I have tested this code by summoning dozens of Gfamiliars inside or very close to walls, it seems to work fine everytime now.
Last edit: 7 months 3 days ago by DeVloek.

Please Log in or Create an account to join the conversation.

  • 9Rifleman
  • 9Rifleman's Avatar Topic Author
  • Chaingunner
  • Chaingunner
More
7 months 3 days ago #39 by 9Rifleman
Replied by 9Rifleman on topic [SUBMISSION] Familiar
Thanks a lot, guys! I'm not sure I would ever figure this out.

Updated the code and the two sprites.

Please Log in or Create an account to join the conversation.

  • Gothic
  • Gothic's Avatar
  • Moderator
  • Moderator
More
7 months 3 days ago #40 by Gothic
Replied by Gothic on topic [SUBMISSION] Familiar
Who made the SLAVE sound?

Please Log in or Create an account to join the conversation.