ZoriaRPG

Klop Request

May 27th, 2018
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ffc script klop_request //Not sure what else to call it this time.
  2. {
  3.      void run(int target_enemy_id, int split, int num_splits, int msg)
  4.      //There had better only be one enemy of this type on the screen!
  5.      {
  6.           int teloc[3]; //target enemy location
  7.           npc n; teloc[1] = -1; teloc[2] = -1;
  8.           while(1)
  9.           {
  10.                teloc[0] = 0; //wipe every frame
  11.                for ( int q = Screen->NumNPCs(); q > 0; --q; )
  12.                {
  13.                     n = Screen->LoadNPC(q);
  14.                     if ( n->ID == target_npc_id )
  15.                     {
  16.                          teloc[0] = q; teloc[1] = n->X; teloc[2] = n->Y;
  17.                     }
  18.                }
  19.                if ( !teloc[0] ) //no target npc, but we preserve its last coordinates.
  20.                {
  21.                     break;
  22.                }
  23.                Waitframe();
  24.           } //infinite loop ends here.
  25.           if ( split )
  26.           {
  27.                if ( teloc[1] > -1 ) //only if there was a valid target with good coordinates.
  28.                {
  29.                     if ( teloc[2] > -1 )
  30.                     {
  31.                          for ( ; num_splits > 0; --num_splits )
  32.                          {
  33.                               n = Screen->CreateNPC(split_into);
  34.                               n->X = teloc[1];
  35.                               n->Y = teloc[2];
  36.                          }
  37.                     }
  38.                }
  39.           }
  40.           if ( msg )
  41.           {
  42.                Screen->Message(msg);
  43.           }
  44.      }
  45.      this->Data = 0; Quit();
  46. } //runs out of scope
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×