Jump to content

Photo

Bigger enemy


  • Please log in to reply
16 replies to this topic

#16 Zakyrus

Zakyrus

    Newbie

  • Members

Posted 01 June 2012 - 09:35 AM

QUOTE(MoscowModder @ Mar 22 2012, 04:58 PM) View Post

I have one of those lying around...
Set the enemy's Misc Attribute 10 to 2 for a 2x2 enemy.

This isn't compatible with AutoGhost, though. It would be pretty cool if BB89 (or anyone else) could make one that uses the AutoGhost library.
CODE
global script BigEnemies
{
    void run()
    {
        while(true)
        {
            ExtendEnemies();
            Waitframe();
        }
    }
    
    void ExtendEnemies
    {
        npc enemy;
        
        for(int i=Screen->NumNPCs(); i>0; i--)
        {
            enemy=Screen->LoadNPC(i);
            
            if(enemy->Extend==0 && enemy->Attributes[10]!=0)
            {
                if(enemy->Attributes[10]==1)
                    enemy->Extend=1;
                else if(enemy->Attributes[10]==2)
                    enemy->Extend=2;
            }
        }
    }
}



Cool, do you mean that autoghost and this can't be in the same mod, or you cant use them both in the same screen? Thanks.

~Z


#17 Saffith

Saffith

    IPv7 user

  • Members

Posted 01 June 2012 - 09:48 AM

They both use misc. attribute 11 to determine whether they should handle enemies. Easy to fix, though:

CODE
const int IDX_EXTENDED=14;

global script BigEnemies
{
    void run()
    {
        while(true)
        {
            ExtendEnemies();
            Waitframe();
        }
    }
    
    void ExtendEnemies()
    {
        npc enemy;
        
        for(int i=Screen->NumNPCs(); i>0; i--)
        {
            enemy=Screen->LoadNPC(i);
            
            if(enemy->Misc[IDX_EXTENDED]==1)
                continue;
            
            if(enemy->Extend==0 && enemy->Attributes[10]!=0 && enemy->Attributes[11]==0)
            {
                if(enemy->Attributes[10]==1)
                    enemy->Extend=1;
                else if(enemy->Attributes[10]==2)
                    enemy->Extend=2;
                enemy->Misc[IDX_EXTENDED]=1;
            }
        }
    }
}

An AutoGhost enemy also has misc. attribute 12 set. This one only extends the enemy if it isn't, so they won't get confused.
I also made it mark which enemies have already been extended, which should make it faster.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users