Guest User

Fully working script

a guest
May 8th, 2020
6
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #TouhouDanmakufu[Single]
  2. #ScriptVersion[3]
  3. #Title["004 pastebin edit"]
  4. #Text[""]
  5. //#Image[]
  6. //#BGM["./whatever.mp3"]
  7.  
  8. #include "script/default_system/Default_ShotConst.txt"
  9.  
  10. let objBoss;
  11. let objScene = GetEnemyBossSceneObjectID();
  12. let frame = -60;
  13. let angleT = 0;
  14.  
  15. @Event {
  16. alternative(GetEventType())
  17. case(EV_REQUEST_LIFE) {
  18. SetScriptResult(500);
  19. }
  20. case(EV_REQUEST_TIMER) {
  21. SetScriptResult(60);
  22. }
  23. case(EV_REQUEST_SPELL_SCORE) {
  24. SetScriptResult(15000);
  25. }
  26. }
  27.  
  28. @Initialize {
  29. objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  30. ObjEnemy_Regist(objBoss);
  31. ObjMove_SetDestAtFrame(objBoss, GetCenterX(), 60, 30);
  32.  
  33. ObjEnemyBossScene_StartSpell(objScene);
  34.  
  35. TDrawLoop;
  36. TFinalize;
  37. }
  38.  
  39.  
  40. @MainLoop {
  41. ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32);
  42. ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 24);
  43.  
  44. frame++;
  45. if (frame % 12 == 0) {
  46. fire;
  47. }
  48. yield;
  49. }
  50.  
  51. //-----------------------------------------------------------------------------------------------------------------------
  52.  
  53. task fire{
  54. if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0) {
  55. return;
  56. } //Default kill to prevent (0,0) spawning
  57. let bulletmult = 3;
  58. loop (bulletmult) {
  59. let objShot1 = CreateShotA2(ObjMove_GetX(objBoss) + 40 * cos(angleT), ObjMove_GetY(objBoss) + 40 * sin(angleT), 0.6, angleT, (0.2/60), 1.1, DS_BALL_S_RED, 20);
  60. ObjMove_SetAngularVelocity(objShot1, 0.4);
  61. BulletCommands1(objShot1);
  62. angleT += 360/bulletmult;
  63. }
  64. angleT += 19.1;
  65. }
  66.  
  67. task BulletCommands1(obj){
  68. wait(120);
  69. ObjShot_SetGraphic(obj, DS_BALL_S_BLUE);
  70. ObjMove_SetAngularVelocity(obj, -0.4);
  71. wait(200);
  72. ObjShot_SetGraphic(obj, DS_BALL_S_RED);
  73. ObjMove_SetAngularVelocity(obj, 0.4);
  74. }
  75.  
  76. task TDrawLoop {
  77. let imgExRumia = GetCurrentScriptDirectory() ~ "ExRumia.png";
  78. ObjPrim_SetTexture(objBoss, imgExRumia);
  79.  
  80. ObjSprite2D_SetSourceRect(objBoss, 64, 1, 127, 64);
  81. ObjSprite2D_SetDestCenter(objBoss);
  82. }
  83.  
  84. //-----------------------------------------------------------------------------------------------------------------------
  85. // Funclib copied so it works
  86.  
  87. function GetCenterX() {
  88. return GetStgFrameWidth() / 2;
  89. }
  90.  
  91. function GetCenterY() {
  92. return GetStgFrameHeight() / 2;
  93. }
  94.  
  95. function wait(n) {
  96. loop(n) {
  97. yield;
  98. }
  99. }
  100.  
  101. function rand_int(min, max) {
  102. return round(rand(min, max));
  103. }
  104.  
  105. task TFinalize {
  106. while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0) {
  107. yield;
  108. }
  109.  
  110. if(ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT) + ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0) { // this IF and anything in it will cause the spell to actually award score
  111. AddScore(truncate(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE) / 10) * 10);
  112. }
  113.  
  114. Obj_Delete(objBoss);
  115. DeleteShotAll(TYPE_ALL, TYPE_IMMEDIATE);
  116. SetAutoDeleteObject(true);
  117. CloseScript(GetOwnScriptID());
  118. return;
  119. }
RAW Paste Data