Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Zelda 1 Style Random drops
- //v0.1
- //For 2.55
- //By: ZoriaRPG
- //17th February, 2019
- script typedef ffc class;
- class script Z1enemydrop
- {
- void run(){}
- int killcount;
- const int DROPSET_A = 0;
- const int DROPSET_B = 1;
- const int DROPSET_C = 2;
- const int DROPSET_D = 3;
- const int DROPSET_X = 4;
- const int DROPSET_M = 5; MAGIC, 100%
- const int DROP_X_OFS = 0;
- const int DROP_Y_OFS = 0;
- int chances[] = {31,41,59,41, 0, 100};
- int lists[4*10]=
- {
- I_RUPEE, I_HEART, I_RUPEE, I_FAIRY, I_RUPEE, I_HEART, I_HEART, I_RUPEE, I_HEART, I_HEART,
- I_BOMB, I_RUPEE, I_CLOCK, I_RUPEE, I_HEART, I_BOMB, I_RUPEE, I_BOMB, I_HEART, I_HEART,
- I_RUPEE, I_HEART, I_RUPEE, I_RUPEE5, I_HEART, I_CLOCK, I_RUPEE, I_RUPEE, I_RUPEE, I_RUPEE5,
- I_HEART, I_FAIRY. I_RUPEE, I_HEART, I_FAIRY, I_HEART, I_HEART, I_HEART, I_RUPEE, I_HEART
- };
- //The dropset that a given enemy uses; SPLITTERS NEED SPECIAL HANDLING?
- int enemydropsets[]=
- {
- //guys
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- //enemies start here
- DROPSET_A, DROPSET_B, DROPSET_A, DROPSET_B, DROPSET_A,
- DROPSET_C, DROPSET_C, DROPSET_A, DROPSET_A, DROPSET_B,
- DROPSET_D, DROPSET_C, DROPSET_D, DROPSET_D, DROPSET_X,
- //GHINI2 ?PHANTOM
- DROPSET_C, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_C, DROPSET_X, DROPSET_C, DROPSET_C,
- DROPSET_B, DROPSET_D, DROPSET_X, DROPSET_C, DROPSET_B,
- DROPSET_D, DROPSET_X, DROPSET_B, DROPSET_X, DROPSET_B,
- DROPSET_C, DROPSET_B, DROPSET_A, DROPSET_D, DROPSET_D,MOLDORM
- DROPSET_D, DROPSET_D, DROPSET_D, DROPSET_D, DROPSET_D,
- DROPSET_D, DROPSET_X, DROPSET_X, DROPSET_D, DROPSET_D,
- DROPSET_D, DROPSET_D, DROPSET_D, DROPSET_D, DROPSET_D, //LANMOLA
- DROPSET_C, DROPSET_D, DROPSET_D, DROPSET_X, DROPSET_C,
- DROPSET_C, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_B, DROPSET_D, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_B, DROPSET_D, DROPSET_D, DROPSET_D,
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_B,
- DROPSET_A, DROPSET_C, DROPSET_C, DROPSET_D, DROPSET_D,
- DROPSET_D, DROPSET_M, DROPSET_A, DROPSET_A, DROPSET_D,
- DROPSET_D, DROPSET_D, DROPSET_D, DROPSET_A, DROPSET_D,
- DROPSET_D, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_C, DROPSET_D, DROPSET_D, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_D, DROPSET_A, DROPSET_B, DROPSET_B,
- DROPSET_B, DROPSET_B, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_B, DROPSET_A, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X, DROPSET_X,
- DROPSET_X, DROPSET_X, DROPSET_C, DROPSET_X, DROPSET_C,
- DROPSET_A, DROPSET_X, DROPSET_X, DROPSET_D, DROPSET_D,
- DROPSET_M, DROPSET_C, DROPSET_D, DROPSET_D, DROPSET_M,
- DROPSET_X, DROPSET_X, DROPSET_X
- };
- int getChance(int enemyid)
- {
- return chances[enemydropsets[enemyid]];
- }
- bool canDrop(int enemy_id)
- {
- return ( Rand(1,100) <= getChance(enemy_id) );
- }
- void doDrop(npc n)
- {
- if ( n->HP > 0 ) return; //wait until dead
- bool ignore = false;
- switch(n->Family)
- {
- case NPCT_MOLDORM:
- case NPCT_MANHANDLA:
- case NPCT_GLEEOK:
- case NPCT_LANMOLA:
- case NPCT_PATRA:
- {
- if ( !n->isCore ) ignore = true; break;
- }
- case NPCT_DODONGO: ignore = true; break; //These never drop items, AFAIK.
- default: break;
- }
- if ( !ignore )
- {
- if ( canDrop(n->ID) )
- {
- item drp = Screen->CreateItem(lists[enemydropsets[n->ID]+killcount]);
- drp->X = n->X + DROP_X_OFS; drp->Y = n->Y + DROP_Y_OFS;
- drp->Pickup = IP_TIMEOUT;
- ( killcount < 9 ) ? ++killcount : killcount = 0;
- }
- }
- }
- void resetKillcount()
- {
- if ( Link->InvFrames ) killcount = 0;
- }
- }
- link script LinkZ1
- {
- void run()
- {
- while(1)
- {
- Z1enemydrop.resetKillcount();
- for ( int q = Screen->NumNPCs(); q > 0; --q )
- {
- npc n = Screen->LoadNPC(q);
- Z1enemydrop.doDrop(n);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement