Advertisement
ywkls

Bracelet Script

Nov 28th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. int ComboInFront(int dir){
  2. if(dir==DIR_UP)
  3. return ComboAt(Link->X+8,Link->Y-8);
  4. else if(dir==DIR_DOWN)
  5. return ComboAt(Link->X+8,Link->Y+24);
  6. else if(dir==DIR_LEFT)
  7. return ComboAt(Link->X-8,Link->Y+8);
  8. else if(dir==DIR_RIGHT)
  9. return ComboAt(Link->X+24,Link->Y+8);
  10. }
  11.  
  12. const int POT_1_TILE = 16472;
  13. const int POT_2_TILE = 16494;
  14. const int POT_3_TILE = 16484;
  15. const int I_LVL1_BRACELET= I_BRACELET2;
  16.  
  17. item script BraceletThrow{
  18. void run(int damage){
  19. int loc = ComboInFront(Link->Dir);
  20. if(Link->Item[I_LVL1_BRACELET]
  21. && (Screen->ComboT[loc]== CT_PUSHHEAVY || Screen->ComboT[loc]==CT_BUSHNEXT
  22. ||Screen->ComboT[loc]==CT_PUSHHEAVY2)){
  23. if(CountFFCsRunning(THROW_FFC_SCRIPT)==0
  24. && Link->PressB){
  25. Link->PressB=false;
  26. Link->InputB=false;
  27. int tile;
  28. if(Screen->ComboT[loc]==CT_PUSHHEAVY)
  29. tile= ROCK_TILE;
  30. else if(Screen->ComboT[loc]==CT_BUSHNEXT)
  31. tile= BUSH_TILE;
  32. else if(Screen->ComboT[loc]==CT_PUSHHEAVY2){
  33. if(Screen->ComboI[loc]==CF_SCRIPT1)
  34. tile= POT_1_TILE;
  35. else if(Screen->ComboI[loc]==CF_SCRIPT2)
  36. tile= POT_2_TILE;
  37. }
  38. int Args[8]= {tile,damage};
  39. NewFFCScript(THROW_FFC_SCRIPT,Args);
  40. Link->Action= LA_ATTACKING;
  41. if(Screen->ComboT[loc]== CT_PUSHHEAVY||Screen->ComboT[loc]== CT_PUSHHEAVY2)
  42. Screen->ComboD[loc]= Screen->UnderCombo;
  43. else
  44. Screen->ComboD[loc]++;
  45. if(ComboFI(loc,CF_ARMOSITEM) && !Screen->State[ST_SPECIALITEM]
  46. && Screen->RoomType==RT_SPECIALITEM){
  47. item theitem = Screen->CreateItem(Screen->RoomData);
  48. theitem->X= ComboX(loc);
  49. theitem->Y= ComboY(loc);
  50. theitem->Pickup |= IP_HOLDUP;
  51. theitem->Pickup |= IP_ST_SPECIALITEM;
  52. }
  53. }
  54. }
  55. }
  56. }
  57.  
  58. int NewFFCScript(int scriptNum, float args){
  59. // Invalid script
  60. if(scriptNum<0 || scriptNum>511)
  61. return 0;
  62.  
  63. ffc theFFC;
  64.  
  65. // Find an FFC not already in use
  66. for(int i=FFCS_MIN_FFC; i<=FFCS_MAX_FFC; i++){
  67. theFFC=Screen->LoadFFC(i);
  68.  
  69. if(theFFC->Script!=0 ||
  70. (theFFC->Data!=0 && theFFC->Data!=FFCS_INVISIBLE_COMBO) ||
  71. theFFC->Flags[FFCF_CHANGER])
  72. continue;
  73.  
  74. // Found an unused one; set it up
  75. theFFC->Data=FFCS_INVISIBLE_COMBO;
  76. theFFC->TileWidth = 1;
  77. theFFC->TileHeight = 1;
  78. theFFC->Script=scriptNum;
  79.  
  80. if(args!=NULL){
  81. for(int j=Min(SizeOfArray(args), 8)-1; j>=0; j--)
  82. theFFC->InitD[j]=args[j];
  83. }
  84. theFFC->Flags[FFCF_ETHEREAL]= true;
  85. return i;
  86. }
  87.  
  88. // No FFCs available
  89. return 0;
  90. }
  91.  
  92. const int THROW_FFC_SCRIPT = 53;
  93. const int ROCK_TILE = 4297;
  94. const int BUSH_TILE = 4296;
  95.  
  96. ffc script Thrown_Object{
  97. void run(int tile, int damage){
  98. lweapon throw;
  99. throw= FireLWeapon(LW_SCRIPT7, Link->X+8, Link->Y, __DirtoRad(Link->Dir),
  100. 100, damage, SPR_NULL, SFX_THROW, 0);
  101. SetLWeaponMovement(throw,LWM_THROW,3,LWMF_DIE);
  102. if(tile==ROCK_TILE)
  103. SetLWeaponDeathEffect(throw,LWD_4_FIREBALLS_RANDOM,18);
  104. else if(tile==BUSH_TILE)
  105. SetLWeaponDeathEffect(throw,LWD_4_FIREBALLS_RANDOM,57);
  106. SetLWeaponFlag2(throw,LWF_SHADOW);
  107. while(throw->isValid()){
  108. Screen->FastTile(3,throw->X,throw->Y-throw->Z,tile,0,128);
  109. Waitframe();
  110. }
  111. }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement