const int NPC_MISC_HOLDING_ITEM = 12; const int NPC_MISC_GHOST_HOLDING_ITEM = 3; ffc script AutoghostStealItem{ void run(int npc_ID, int stealsfx, float dragdur){ npc ghost = Ghost_InitAutoGhost(this, enemyid); //Init the enemy, and set tis properties... item i; itemdata it; int q; int w; int e; int r; int a[5]; if ( !dragdur ) dragdur = 1; int itemlist[]={ IC_RUPEE, IC_HEART, IC_ARROWAMMO, IC_MAGIC, IC_BOMBAMMO}; while(true){ for ( a[0] = 1; a[0] <= Screen->NumItems(); a[0]++){ if ( !n->Misc[NPC_MISC_HOLDING_ITEM]) { i = Screen->LoadItem(w); it = Game->LoadItemData(i->ID); for ( a[1] = 0; a[1] < SizeOfArray(itemlist); a[1]++){ if ( it->Family == itemlist[e] ) { if ( __DistX(ghost,i,4) && __DistY(ghost,i,4) ){ ghost->Misc[NPC_MISC_HOLDING_ITEM] = 1; for ( a[2] = 0; a[2] < (dragdur * 60); a[2] ++ ) { i->X = n->X; i->Y = n->Y; Ghost_Waitframe(this,ghost); } Game->PlaySound(stealsfx); Remove(i); ghost->Misc[NPC_MISC_HOLDING_ITEM] = 0; } } } } } Ghost_Waitframe(this,ghost); } } bool __DistX(npc a, item b, int distance) { int dist; if ( a->X > b->X ) dist = a->X - b->X; else dist = b->X - a->X; return ( dist <= distance ); } bool __DistY(npc a, item b, int distance) { int dist; if ( a->Y > b->Y ) dist = a->Y - b->Y; else dist = b->Y - a->Y; return ( dist <= distance ); } }