User Tag List

Results 1 to 10 of 42

Thread: ghost.zh - A header file for ghosted enemy scripts

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I shall exalt myself over all Armagedddon Games bigjoe's Avatar
    Join Date
    Apr 2000
    Age
    39
    Posts
    5,622
    Mentioned
    87 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,576
    Level
    24
    vBActivity - Bars
    Lv. Percent
    94.01%
    I have a suggestion for a function:

    GhostWaitframeR

    This would be the same as GhostWaitframeN but it would allow you to specify a location relative to the NPC. (Negative or positive integers.)

    The reason I suggest this is that when I try to do that manually using GhostWaitframeM, both npc and ffc fly diagonally until they disappear. I guess its because they both have to be the same in the function.


  2. #2
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.55%
    I was thinking about adding something like that at one point, but I couldn't come up with anything I liked. The idea being that you might not want the hitbox to match the enemy's appearance, which ended up as SetOffsets() instead. Do you have a different purpose in mind?

    Another possibility is that it could acknowledge the npc->DrawOffset variables and position the FFC where the enemy would normally be drawn. What do you think of that?

    Edit: Actually, come to think of it, could you just use the npc->HitOffsets?

  3. #3
    I shall exalt myself over all Armagedddon Games bigjoe's Avatar
    Join Date
    Apr 2000
    Age
    39
    Posts
    5,622
    Mentioned
    87 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,576
    Level
    24
    vBActivity - Bars
    Lv. Percent
    94.01%
    I think I've found a pretty reasonable workaround.. but what I was trying to do was make the FFC follow a position relative to the NPC. The collision would still be the same as the FFC, just the position would be different. This is to make a bigger enemy that behaves exactly like the small one(but has the larger collision)

    My workaround will use two separate npcs.


  4. #4
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.55%
    Updated.

    • All ffc->Misc[] data has been moved to npc->Misc[]. Any scripts accessing these directly or using GotHit() will have to be updated.
    • npc->Misc[GHI_BASE_CSET] is no longer needed; npc->CSet is used instead.
    • Added SetCSet() and RevertCSet().
    • GhostInitWait2() has changed; the argument specifying which enemy to use is no longer needed. Instead, it finds the first one that's not already in use by another script. The old version of the function is deprecated, and the obsolete argument is ignored.
    • Added flags to make enemies ignore solid combos, water, and pits.
    • npc->TileWidth and npc->TileHeight are now set by the Init functions and Transform(), so shadows should be drawn in the right place in beta 18 and up.
    • Added DrawSpawnAnimation(), which lets you show the enemy spawning graphic that gets cut off by the Init functions.
    • If GH_BLANK_TILE is set and the enemy used has a frame rate of 0 (or 256, since ZC changes 0 to 256), the enemy's tile will be set to a clear one automatically. This way, you can give the enemy a visible tile so it shows up in the enemy panel in ZQuest's large mode.
    • Added an internal EWeapon flag that marks the weapon as having been spawned by ghost.zh. This allows other scripts to use all but one element of eweapon->Misc[] without causing confusion.
    • Reworked SpawnNPC() to increase the minimum distance from Link.
    • ghost_zh_readme.txt has been renamed ghost.txt to match other header files' documentation.


    Edit: Sorry, quick update. I screwed up the arguments to SetCSet() and RevertCSet(). They worked, but they were inconsistent with other functions, and I'm trying to avoid that. Anyway, it's fixed now.

  5. #5
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.55%
    All right, big update. Complete overhaul, in fact. Here are the biggest changes this version:

    Most enemy properties are now handled by global variables. There are only two standard Waitframe functions, Ghost_Waitframe and Ghost_Waitframe2. There's also a Ghost_WaitframeLight, but that'll generally be used only when the enemy is inactive. A lot of things that used to require a function can now be done just be setting one of the global variables. You can, for instance, set Ghost_HP to set the enemy's HP, set Ghost_CSet to change its CSet, or set Ghost_Data to change its combo, even if GHF_4WAY is set.

    There are two major new eweapon death options. First, you can create a dummy eweapon with whatever properties you like, including its own scripted movement, and have an eweapon spawn copies of it on death. Second, you can set up an FFC to run a script where the eweapon died, so you can do whatever you like there.

    Finally, the biggest new addition, AutoGhost. With appropriately written enemy scripts, the global script can set up FFCs automatically when enemies appear. That means scripted enemies can be used as easily as built-in ones, with no manual FFC setup at all. This requires at least RC2.

    This version is not backward compatible with existing scripts. However, there is a separate file, ghost_legacy.zh, included for this purpose.

    Also, thanks to Blaman/SpacemanDan for putting up with me through this. I know I can get a bit impatient at times. :p

    ghost.zh
    Demo quest and sample scripts
    AutoGhost enemies
    AutoGhost setup demo video
    Last edited by Saffith; 08-16-2011 at 12:16 PM.

  6. #6
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.55%
    Another update.
    • Added script versions of some of ZC's built-in movement functions
    • Added EWM_DRIFT and EWM_DRIFT_WAIT
    • The hitbox adjustments made by Ghost_SetHitOffsets() are now taken into account by Ghost_CanMove()


    Edit: Quickly followed by a bugfix update. :p
    Last edited by Saffith; 08-16-2011 at 12:16 PM.

  7. #7
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.55%
    Another update.

    • There's now built-in support for multi-FFC enemies like Iflyte.
    • It's now possible to use Screen->DrawCombo rather than making the FFC itself visible. There are three advantages to this:
      • Enemies will correctly be drawn above layers 2 and 4 rather than 1 and 3 (currently, FFCs do appear above layers 2 and 4, but that's a bug).
      • Enemies disappear when the screen is scrolling.
      • Multi-FFC enemies don't actually require multiple FFCs.
    • Enemy blocking combos and flags are now respected.
      • Added GHF_FLYING_ENEMY, which controls whether ground/jumping or flying enemy blockers are checked.
      • Ghost_CanMove and Ghost_CanMovePixel now take an optional argument indicating whether the enemy is in the air; this defaults to Ghost_Z>0.
    • Added flags to restrict an enemies movement to water, including or excluding shallow water.
    • Added a setting to make all Z-axis movement actually use the Y axis.
    • Added a setting to make enemies flicker instead of flash.
    • You can now use an alternate number (-1 by default) instead of GH_INVISIBLE_COMBO to make enemies use the invisible combo.
    • GHF_ flags can no longer be ORed together; they must be set individually. Unfortunate, but it can't be helped; I ran out of bits.
    • Ghost_SetFlags and the init functions with a flags argument are deprecated.
    • Ghost_WaitframeLight now takes ffc and npc arguments. The old version is deprecated and may not work correctly with existing scripts if DrawCombo is enabled.

  8. #8
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.55%
    Updated.

    • For the sake of maintainability, ghost.zh has been split into multiple files. You still only need to import ghost.zh itself; it imports all the others.
    • Drawing has been moved to the global script, so enemies won't disappear when the screen freezes.
    • The multi-FFC functions have been replaced. I kind of hate to do that, but they sucked, and no one was using them, anyway.
    • Directions 8-15 should be handled correctly now.
    • Ghost_Explode has been replaced by Ghost_DeathAnimation. This will allow scripts in which the animation is determined by a misc. attribute to support new animations as they're added.
    • Added functions to suspend and resume ghost.zh scripts.
    • Added functions to find random spawn points.
    • Added functions to simplify reading attributes.
    • Shadows can now be animated.
    • The "Is Flashing" and "Is Flickering" enemy flags work now.


    Global scripts will need updated. See the "global" section of ghost.txt or ghost_zh/scripts.zh for the current set of functions.

    I was going to redo movement this time, but it's taking longer than I expected. I'll be sure to get that next time.

  9. #9
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.55%
    Finally, another update. It's mostly internal changes and some bug fixes, but there's some new stuff.
    This will break existing save files.

    • Added Ghost_FloaterWalk(), the movement type used by peahats and keese
    • Added EWF_ROTATE_360
    • Added settings to change how big an enemy must be to use large shadows
    • Added an option to use scripted shadows rather than built-in ones when possible
    • Added new Ghost_Waitframe() variants to simplify usage; you can now leave out quitOnDeath and clearOnDeath (they'll both be true) or specify a death animation
    • The global script functions have been consolidated into three; you'll need to update the global script, but it should never be necessary for future updates
    Last edited by Saffith; 11-21-2013 at 01:20 PM.

  10. #10
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    41
    Posts
    3,389
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,436
    Level
    24
    vBActivity - Bars
    Lv. Percent
    70.55%
    Another update, finally. Just some bug fixes.
    - AutoGhost() now avoids using changers
    - Fixed issues with diagonal movement in 8-way walking functions
    - Corrected flashing CSets and timing
    - The exploding and flashing death animation works correctly now
    - SuspendGhostZHScripts() affects legacy Waitframe functions

    Also, it appears I failed to post about the previous update here. Here are the changes from that one:
    - AutoGhost no longer runs when ghost.zh is suspended
    - Large enemies should no longer try to walk into walls when using four-way walking functions
    - FindUnusedFFC is aware of GH_INVISIBLE_COMBO now
    - The exploding death animation should no longer cause errors if the enemy fails to stay alive for the duration of the animation
    - And it no longer stops the enemy from dropping an item

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social