Jump to content

Armos (LttP)

Overview
Creator: Saffith Added: 29 Apr 2014 Tags: Enemy, FFC Downloads: 89
Rating[?]: No rating
View Script Download Example
(1.62 MB)
Information

Description Setup Reviews Comments

floundermaj  

Edited 05 January 2015 - 11:57 AM
This script is included with the Pure Tileset that I am using for my quest. It works well, but I noticed that it does not work with Flag 10 (Armos/Chest->Item). I believe this is due to the Armos combo being triggered and removed by the script. I've modified it to fix this. Code is below, my additions are in the 'for' loop at the end of the script.
// --------- Armos (LTTP) ---------

const int ARMOS_JUMP_HEIGHT = 1.5;

// npc->Attribute[] indices
const int ARMOS_ATTR_START_SOUND = 0;
const int ARMOS_ATTR_JUMP_SOUND = 1;

ffc script Armos_LttP
{
    void run(int enemyID)
    {
        npc ghost;
        float step;
        int jumpSound;
        
        // Initialize - come to life and set the combo
        ghost=Ghost_InitAutoGhost(this, enemyID);
        Ghost_SetFlag(GHF_NORMAL);
        Ghost_SetFlag(GHF_KNOCKBACK_4WAY);
        Ghost_SetFlag(GHF_FAKE_Z);
        Game->PlaySound(ghost->Attributes[ARMOS_ATTR_START_SOUND]);
        SpawnAnimation(this, ghost);
        
        step=ghost->Step/100;
        jumpSound=ghost->Attributes[ARMOS_ATTR_JUMP_SOUND];
        
        // Just jump toward Link forever
        while(true)
        {
            if(Ghost_Z==0 && Ghost_Jump<=0)
            {
                Ghost_Jump=ARMOS_JUMP_HEIGHT;
                Game->PlaySound(jumpSound);
            }
            
            Ghost_MoveTowardLink(step, 3);
            Ghost_Waitframe(this, ghost, true, true);
        }
    }
    
    // A modified version of Ghost_SpawnAnimationFlicker(). This removes the
    // Armos combo near the end of the animation.
    void SpawnAnimation(ffc this, npc ghost)
    {
        int combo=this->Data;
        bool collDet=ghost->CollDetection;
        int xOffset=ghost->DrawXOffset;
	item ArmosItem;
        
        Ghost_SetPosition(this, ghost);
        ghost->CollDetection=false;
        
        // Alternate drawing offscreen and in place for 64 frames
        for(int i=0; i<32; i++)
        {
            this->Data=0;
            ghost->DrawXOffset=32768;
            Ghost_SetPosition(this, ghost);
            Ghost_WaitframeLight(this, ghost);
            
            this->Data=combo;
            ghost->DrawXOffset=xOffset;
            Ghost_SetPosition(this, ghost);
            Ghost_WaitframeLight(this, ghost);
            
            // The combo has to be removed shortly before the animation
            // finishes; otherwise, it's possible to spawn two of them.
            if(i==29)
            {
                Screen->ComboD[ComboAt(this->X, this->Y)]=Screen->UnderCombo;
                Screen->ComboC[ComboAt(this->X, this->Y)]=Screen->UnderCSet;
				if(Screen->ComboF[ComboAt(this->X, this->Y)]==CF_ARMOSITEM&&Screen->RoomType==RT_SPECIALITEM&&Screen->State[ST_SPECIALITEM]==false)
				{
					ArmosItem=Screen->CreateItem(Screen->RoomData);
					ArmosItem->X=this->X; ArmosItem->Y=this->Y;
					ArmosItem->DrawStyle=DS_NORMAL; ArmosItem->Pickup=(IP_HOLDUP|IP_ST_SPECIALITEM);
				}				
            }
        }
        
        this->Data=combo;
        ghost->CollDetection=collDet;
        ghost->DrawXOffset=xOffset;
    }
}//!End ffc script Armos_LttP
This works well. Just set the flag, room type and catch all as normal, and the item will spawn where the Armos was. Also, once the item is picked up it will not spawn again.
 

LinkFan212  

Posted 16 August 2014 - 02:03 PM
I have a wondering question. I don't know if I did something wrong or not, but when I tap the armos, it's not a solid block. It makes the SFX, and it all works properly, but when I just tap the combo I can walk over it. Is this supposed to happen, or did I do something wrong? (Btw the combo is a full solid combo, I checked)

Thanks!