Advertisement
ZoriaRPG

RPG NPC Stuff

Nov 3rd, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. script typedef ffc class;
  2.  
  3. class script enemy
  4. {
  5.     void run(){}
  6.    
  7.     void draw(npc n, int offset)
  8.     {
  9.         npcdata nd = Game->LoadNPCData(n->ID);
  10.         //get npcdta tile information
  11.         //draw tileblocks
  12.     }
  13.     bool animate(npc n, int effect)
  14.     {
  15.         //drawing of special effects
  16.         int ofs = 0;
  17.         switch(effect)
  18.         {
  19.             //cases, attack, spell, and so forth, as modifiers to draw()
  20.             //these will assign values to ofs;
  21.             default: break;
  22.         }
  23.         draw(n,ofs);
  24.     }
  25.     int intelligence(npc n)
  26.     {
  27.         int id = n->ID;
  28.         int action = determine_action(id);
  29.         switch(action)
  30.         {
  31.             case ATTACK:
  32.             {
  33.                 int atk = choose_attack(id);
  34.                 int target = choose_target();
  35.                 attack(target);
  36.                 break;
  37.             }
  38.             case SPELL:
  39.             {
  40.                 int sp = choose_spell(id);
  41.                 int target = choose_target();
  42.                 case(sp,target);
  43.             }
  44.             case RUN: try_runaway(id); break;
  45.             case DEFEND: parry(id); break;
  46.             default: break;
  47.         }
  48.     }
  49.     int choose_attack(int id)
  50.     {
  51.         int attacklist[16]; npcdata nd = Game->LoadNPCData(id);
  52.         int listPos = 0;
  53.         for ( int q = npcATTACK_MIN; q < npcATTACK_MAX; ++q)
  54.         {
  55.             if (nd->Attributes[q] > 0 ) attacklist[listPos] = nd->Attributes[q];
  56.             ++listPos;
  57.         }
  58.         return attackList[Rand(0,listPos)];
  59.     }
  60.     int choose_spell(int id)
  61.     {
  62.         int attacklist[16]; npcdata nd = Game->LoadNPCData(id);
  63.         int listPos = 0;
  64.         for ( int q = npcSPELL_MIN; q < npcSPELL_MAX; ++q)
  65.         {
  66.             if (nd->Attributes[q] > 0 ) attacklist[listPos] = nd->Attributes[q];
  67.             ++listPos;
  68.         }
  69.         return attackList[Rand(0,listPos)];
  70.     }
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement