User Tag List

Page 1 of 3 1 2 3 LastLast
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
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    37
    Posts
    3,384
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,239
    Level
    24
    vBActivity - Bars
    Lv. Percent
    37.66%

    ghost.zh - A header file for ghosted enemy scripts

    Some functions for ghosted enemy scripts. Requires at least RC2.

    ghost.zh and demo
    AutoGhost setup demo video

    In the demo quest, the cheat codes are just 1, 2, 3, and 4.

    Any bugs or suggestions, let me know.
    Last edited by Saffith; 09-16-2016 at 02:25 PM.

  2. #2
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    33
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,001
    Level
    17
    vBActivity - Bars
    Lv. Percent
    74.24%
    Oooh, very neat. This should make boss writing slightly easier!

    Edit: Hmm, if you do this:

    Code:
    eweapon bomb = FireAimedEWeapon(EW_BOMB, this->X + 8, this->Y + 8, 0, 100, 4, false, 7, false, 38);
    SetEWeaponMovement(bomb, EWM_THROW, 5);
    SetEWeaponDeathEffect(bomb, EWD_EXPLODE, 4);
    bomb->CollDetection = false; //so that the bomb itself doesn't hit Link
    The explosion on death travels slowly to the left... No idea why, since it clearly sets the explosion to step 0!
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  3. #3
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    37
    Posts
    3,384
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,239
    Level
    24
    vBActivity - Bars
    Lv. Percent
    37.66%
    I think that one's a bug in ZC. Seems to do it no matter what.

  4. #4
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    37
    Posts
    3,384
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,239
    Level
    24
    vBActivity - Bars
    Lv. Percent
    37.66%
    Updated for builds 1174 and up. Handles stunning better now, and a couple of small bugs are fixed.

  5. #5
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    37
    Posts
    3,384
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,239
    Level
    24
    vBActivity - Bars
    Lv. Percent
    37.66%
    Another update. Added a new init method, improvements to stunning and thrown eweapons.

    Does anyone besides me actually use this, or have any interest in doing so? I could write up a tutorial, if it'd be helpful.

    (Edit: Small update: fixed a minor issue in the demo and a significant mistake in the documentation.)

    (Another edit: Gah, I broke knockback last time. Fixed now. Added a couple more functions while I was at it.)

  6. #6
    Triforce Knight bigjoe's Avatar
    Join Date
    Apr 2000
    Age
    35
    Posts
    5,590
    Mentioned
    84 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,275
    Level
    24
    vBActivity - Bars
    Lv. Percent
    43.66%
    This header seems pretty useful..

    Here's something I made with it
    Code:
    //This script creates an enemy that walks left to right between solid combos,
    //similar to a Goomba from Super Mario Bros.
    //Set D0 to 0 to start right and 1 to start left.
    //D1 = Enemy type to use for ghosting
    ffc script goomba_left_right
    {
    
        void run(bool startleft, int enemtype)
        {
        npc goomba;
        int timer;
        bool left;
        bool right;
        
        if(startleft){left = true; right = false;} else {right = true; left = false;}
    
        goomba=GhostInitCreate(this, enemtype);
        SetFlags(this, GHF_NORMAL);
    
        timer = 2;
        
        for(int i=0; true; i++)
        {
            if(i==timer)
            {
            i=0;
    
            if(!right && left && CanMove(this,goomba,2,1,0)) Move(this,goomba,-1,0,0); else right = true;
            if(right && CanMove(this,goomba,3,1,0))Move(this,goomba,1,0,0); else { left = true; right = false;}
    
            }
    
            GhostWaitframeF(this, goomba, true, true);
        }
        
        
    }
    }
    And the up/down one for good measure.

    Code:
    //This script creates an enemy that walks down and up between solid combos,
    //Set D0 to 0 to start down and 1 to start up.
    //D1 = Enemy type to use for ghosting
    
    ffc script goomba_up_down
    {
    
        void run(bool startup, int enemtype)
        {
        npc goomba;
        int timer;
        bool up;
        bool down;
        
        if(startup){up = true; down = false;} else {down = true; up = false;}
    
        goomba=GhostInitCreate(this, enemtype);
        SetFlags(this, GHF_NORMAL);
    
        timer = 2;
        
        for(int i=0; true; i++)
        {
            if(i==timer)
            {
            i=0;
    
            if(!down && up && CanMove(this,goomba,0,1,0)) Move(this,goomba,0,-1,0); else down = true;
            if(down && CanMove(this,goomba,1,1,0))Move(this,goomba,0,1,0); else { up = true; down = false;}
    
            }
    
            GhostWaitframeF(this, goomba, true, true);
        }
        
        
    }
    }
    If you're going to use these, be sure to import "ghost.zh"!

    EDIT: I am a very poor scripter, so a tutorial on how to put together a custom boss with this would be very nice

  7. #7
    Floormaster Imzogelmo's Avatar
    Join Date
    Sep 2005
    Location
    Earth, currently
    Age
    41
    Posts
    387
    Mentioned
    7 Post(s)
    Tagged
    3 Thread(s)
    vBActivity - Stats
    Points
    1,320
    Level
    12
    vBActivity - Bars
    Lv. Percent
    36.73%
    I recommend this be stickied.

    EDIT:

    I found a... well, an oddity let's say.
    When using Ghost_CanMove with the diagonal directions, it's possible to get wrong results.
    The reason is that it simply composes the two other directions. For example, say you're doing this:

    Ghost_CanMove(DIR_LEFTUP,1,0);

    The result will be essentially (Ghost_CanMove(DIR_LEFT,1,0) && Ghost_CanMove(DIR_UP,1,0));
    However, if the enemy found itself in a scenario like this:

    |X|
    ___ *

    Then both LEFT and UP are true, but LEFTUP is not.

    Thus, oddity.
    Last edited by Imzogelmo; 08-30-2011 at 05:21 PM.

  8. #8
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    37
    Posts
    3,384
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,239
    Level
    24
    vBActivity - Bars
    Lv. Percent
    37.66%
    Blargh. All right, shouldn't be hard to fix.

  9. #9
    Is this the end?
    ZC Developer
    Saffith's Avatar
    Join Date
    Jan 2001
    Age
    37
    Posts
    3,384
    Mentioned
    178 Post(s)
    Tagged
    6 Thread(s)
    vBActivity - Stats
    Points
    6,239
    Level
    24
    vBActivity - Bars
    Lv. Percent
    37.66%
    A long overdue update.

    - Finally added handling for sideview screens
    - Improved movement functions a bit (in particular, 4-way walking should work much better now)
    - Added GHF_FULL_TILE_MOVEMENT, which makes the enemy consider a combo completely solid if any quadrant of it is
    - Various bug fixes


    I'm still only so happy with the movement functions. I was thinking about rewriting them completely, but that's proven rather tricky, so it'll have to wait for the next version.
    There's no handling yet for the No Ground Enemies combo and flag. I might just have GHF_NO_FALL control that, or maybe it could depend on the enemy type being Other (Floating). Any other ideas?

  10. #10
    Friends Furever XMuppetSB's Avatar
    Join Date
    Dec 2005
    Location
    San Antonio, Texas
    Age
    30
    Posts
    1,931
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    6,185
    Level
    24
    vBActivity - Bars
    Lv. Percent
    28.78%
    Is this going to affect the ghosted enemy scripts I'm using in my quest? Because if so, would you mind updating the ones you included in your AutoGhost Enemies Pack?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 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