Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int NPC_MISC_HOLDING_ITEM = 12;
- const int GHOST_STEALITEM_HOLDING_ITEM = 3;
- const int GHOST_STEALITEM_STEAL_SFX = 43;
- const float GHOST_STEALITEM_DRAGDUR = 1.5;
- ffc script AutoghostBasicThief{
- void run(int enemyid){
- npc ghost = Ghost_InitAutoGhost(this, enemyid);
- item i; itemdata it;
- int a[4];
- 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 ( !a[GHOST_STEALITEM_HOLDING_ITEM] ) {
- i = Screen->LoadItem( a[0] );
- it = Game->LoadItemData(i->ID);
- for ( a[1] = 0; a[1] < SizeOfArray(itemlist); a[1]++){
- if ( it->Family == itemlist[ a[1] ] ) {
- if ( __DistX(ghost,i,4) && __DistY(ghost,i,4) ){
- a[GHOST_STEALITEM_HOLDING_ITEM] = 1;
- for ( a[2] = 0; a[2] < (GHOST_STEALITEM_DRAGDUR * 60); a[2]++ ) {
- i->X = ghost->X;
- i->Y = ghost->Y;
- Ghost_Waitframe2(this,ghost);
- }
- Game->PlaySound(GHOST_STEALITEM_STEAL_SFX);
- Remove(i);
- a[GHOST_STEALITEM_HOLDING_ITEM] = 0;
- }
- }
- }
- }
- }
- Ghost_Waitframe2(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 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement