Guest User

ECL wrapper language example

a guest
Jul 21st, 2016
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.62 KB | None | 0 0
  1. anim { "enemy.anm"; "stgenm01.anm"; }
  2. ecli { "default.ecl"; }
  3.  
  4. #define ExampleMacro 10.0f
  5.  
  6. //Note: you cannot have a comment on the same line as code at the moment!
  7.  
  8.  
  9. //=========================================================================================================================================
  10. // BOSS START
  11. //=========================================================================================================================================
  12. sub Boss()
  13. {
  14. var A;
  15.  
  16. //Create the boss using script 0 from anm 2 (stgenm01.anm), and have it run Boss1()
  17. boss 2 0 "Boss1";
  18.  
  19. destruct();
  20. }
  21.  
  22. //=========================================================================================================================================
  23. // NONSPELL ONE
  24. //=========================================================================================================================================
  25. sub Boss1()
  26. {
  27. var angle count add fspeed accel time color wait1 wait2 rang ringcount cfspeed arclayers;
  28.  
  29. //Set the spell counter (the stars in the corner)
  30. setRemainingSpells(4);
  31.  
  32. //Set the life bar amount
  33. setLife(7500);
  34.  
  35. //Set up this "step" of attacks
  36. new attacklist
  37. {
  38. //Add an attack using Boss1Card(), and have it start when the life drops below 1500 or 45 seconds have counted down, and use an orangeish color for its healthbar section
  39. attack 1500 45 Boss1Card argb(255,255,128,0);
  40. }
  41.  
  42. //just a built in macro that sets this sub up as a nonspell
  43. nonspell;
  44.  
  45. //Vars
  46. //A nifty function that sets a variable to a different value depending on the difficulty (int value; use setByDifficultyf for float values)
  47. setByDifficulty($count, 10, 11, 13, 15);
  48. setByDifficulty($time, 2, 1, 1, 1);
  49. setByDifficulty($wait1, 70, 60, 50, 40);
  50. setByDifficulty($wait2, 40, 35, 30, 30);
  51. setByDifficulty($ringcount, 18, 20, 22, 24);
  52. setByDifficulty($arclayers, 2, 2, 3, 3);
  53.  
  54. //add = 1.2f / count
  55. 1.2f;
  56. float($count);
  57. dividef();
  58. movef(%add);
  59.  
  60. //Push different values on the stack depending on the difficulty
  61. !E
  62. 5.0f;
  63. !N
  64. 5.2f;
  65. !H
  66. 5.4f;
  67. !L
  68. 5.6f;
  69. !ENHL
  70. float($count);
  71. dividef();
  72. movef(%accel);
  73.  
  74. //Shots
  75. //Define a shot type
  76. new shot 0
  77. {
  78. //Shoots one shot, once
  79. count = 1 1;
  80. offset = 0.0f 0.0f;
  81. //Just fire a straight line at whatever angle it's set to
  82. aim = NORMAL;
  83. angle = 0.0f;
  84. //Use kunai color 0 (KUNAI is just a constant specific to shot definitions and setShotAppearance, it won't work anywhere else)
  85. graphic = KUNAI 0;
  86. speed = 3.0f;
  87. }
  88.  
  89. new shot 1
  90. {
  91. //Shoots 4 shots if the difficulty is EASY, 4 if it's NORMAL, 6 if it's HARD, or 7 if it's LUNATIC, but only fire them once no matter the difficulty
  92. count = 4 5 6 7 1 1 1 1;
  93. offset = 0.0f 0.0f;
  94. //Fire a circle instead of a line
  95. aim = NORMAL_CIRCLE;
  96. angle = 0.0f;
  97. graphic = KUNAI 1;
  98. //Set the speed to 1.8 if the difficulty is EASY, 2.0 if it's NORMAL, 2.2 if it's HARD, or 2.4 if it's LUNATIC
  99. speed = 1.8f 2.0f 2.2f 2.4f;
  100. }
  101.  
  102. new shot 2
  103. {
  104. count = 4 5 6 7 1 1 1 1;
  105. offset = 0.0f 0.0f;
  106. aim = NORMAL_CIRCLE;
  107. angle = 0.0f;
  108. graphic = KUNAI 2;
  109. speed = 1.8f 2.0f 2.2f 2.4f;
  110. }
  111.  
  112. //Script
  113. //Infinite loops, yay
  114. loop -1 mainLoop
  115. //Charge effect
  116. charge();
  117. wait($wait1);
  118.  
  119. this.angleToPlayer;
  120. float($count);
  121. 2.0f;
  122. dividef();
  123. int([-1.0f]);
  124. float([-1]);
  125. %add;
  126. multiplyf();
  127. subtractf();
  128. movef(%angle);
  129.  
  130. %fspeed = 1.0f;
  131. $color = 0;
  132.  
  133. //Finite loops, yay
  134. loop $count arcLoop
  135. shotSetAngle(0, %angle);
  136. shotSetSpeed(0, %fspeed);
  137.  
  138. shotSetAppearance(0, FIREBALL_RED, 0);
  139. shotFire(0);
  140. shotSetAppearance(0, KUNAI, $color);
  141. shotFire(0);
  142.  
  143. %cfspeed = %fspeed;
  144.  
  145. loop $arclayers arcLayerLoop
  146. %fspeed -= 0.15f;
  147. shotSetSpeed(0, %fspeed);
  148.  
  149. shotSetAppearance(0, FIREBALL_RED, 0);
  150. shotFire(0);
  151. shotSetAppearance(0, KUNAI, $color);
  152. shotFire(0);
  153. endloop arcLayerLoop
  154.  
  155. %fspeed = %cfspeed;
  156.  
  157. %angle += %add;
  158. %fspeed += %accel;
  159. $color;
  160. 1;
  161. add();
  162. 3;
  163. mod();
  164. move($color);
  165. wait($time);
  166. endloop arcLoop
  167.  
  168. //Moves in a random direction within the set movement field
  169. bossMove(30, 4, 8.0f);
  170. wait($wait2);
  171.  
  172. this.angleToPlayer;
  173. float($count);
  174. 1.5f;
  175. dividef();
  176. int([-1.0f]);
  177. float([-1]);
  178. %add;
  179. multiplyf();
  180. addf();
  181. movef(%angle);
  182.  
  183. %fspeed = 1.0f;
  184. loop $count arcLoop2
  185. shotSetAngle(0, %angle);
  186. shotSetSpeed(0, %fspeed);
  187.  
  188. shotSetAppearance(0, FIREBALL_RED, 0);
  189. shotFire(0);
  190. shotSetAppearance(0, KUNAI, $color);
  191. shotFire(0);
  192.  
  193. %cfspeed = %fspeed;
  194.  
  195. loop $arclayers arcLayerLoop2
  196. %fspeed -= 0.15f;
  197. shotSetSpeed(0, %fspeed);
  198.  
  199. shotSetAppearance(0, FIREBALL_RED, 0);
  200. shotFire(0);
  201. shotSetAppearance(0, KUNAI, $color);
  202. shotFire(0);
  203. endloop arcLayerLoop2
  204.  
  205. %fspeed = %cfspeed;
  206.  
  207. %angle -= %add;
  208. %fspeed += %accel;
  209. $color;
  210. 1;
  211. add();
  212. 3;
  213. mod();
  214. move($color);
  215. wait($time);
  216. endloop arcLoop2
  217.  
  218. charge();
  219. wait(30);
  220.  
  221. %rang = randomPi;
  222. loop $ringcount ringLoop
  223. shotSetAngle(1, %rang);
  224. shotSetAppearance(1, FIREBALL_RED, 0);
  225. shotFire(1);
  226. shotSetAppearance(1, KUNAI, 1);
  227. shotFire(1);
  228. wait(3);
  229. 0.0f;
  230. %rang;
  231. subtractf();
  232. shotSetAngle(2, [-1.0f]);
  233. shotSetAppearance(2, FIREBALL_RED, 0);
  234. shotFire(2);
  235. shotSetAppearance(2, KUNAI, 2);
  236. shotFire(2);
  237. !EN
  238. %rang += 0.14f;
  239. !HL
  240. %rang += 0.1f;
  241. !ENHL
  242. wait(1);
  243. endloop ringLoop
  244.  
  245. wait($wait2);
  246.  
  247. bossMove(30, 4, 8.0f);
  248. wait($wait2);
  249.  
  250. endloop mainLoop
  251.  
  252. exit();
  253. }
  254.  
  255. //=========================================================================================================================================
  256. // SPELL ONE
  257. //=========================================================================================================================================
  258. sub Boss1Card()
  259. {
  260. var count add angle1 angle2 n nadd1 nadd2 speed dummy;
  261.  
  262. //A built in macro for spells; Tells the game that this is spell #1, the timer should be set to 45, the spell name should be "Spirit Control 'Possessed Coin'" (THTK doesn't like using escaped quotation marks so always use '), and when the spell ends Boss_Dead() should be called. I don't remember what the 5000000 is for but it's needed by the engine; I might abstract it away later on.
  263. spell 1 45 5000000 "Spirit Control 'Possessed Coin'" Boss_Dead;
  264.  
  265. //Vars
  266. setByDifficulty($count, 30, 34, 38, 45);
  267.  
  268. pi(2.0f);
  269. float($count);
  270. dividef();
  271. movef(%add);
  272.  
  273. pi(8.0f);
  274. float($count);
  275. dividef();
  276. movef(%nadd1);
  277.  
  278. pi(6.0f);
  279. float($count);
  280. dividef();
  281. movef(%nadd2);
  282.  
  283. //Shots
  284. new shot 0
  285. {
  286. count = 2 2 3 3 1 1 1 1;
  287. offset = 0.0f 0.0f;
  288. aim = NORMAL_CIRCLE;
  289. angle = 0.0f;
  290. graphic = KUNAI 0;
  291. speed = 2.0f;
  292. //Automated pattern timeline!
  293. //Accelerate by 0.05 over 40 frames, once, and wait until it's done before continuing.
  294. pattern : 0 1 ACCELERATE 40 1 0.05f NULLF;
  295. //Change graphic to 19 and color 0, and continue without waiting.
  296. pattern : 1 0 CHANGE_GRAPHIC 19 0 NULLF NULLF;
  297. //Change angle relative to player to 0.0 and change speed to 1.5 every 2 frames, 20 times, and wait until it's done before continuing.
  298. pattern : 2 1 CHANGE_BY_PLAYER 2 20 0.0f 1.5f;
  299. //Change graphic to 4 and color 0, and continue without waiting.
  300. pattern : 3 0 CHANGE_GRAPHIC 4 0 NULLF NULLF;
  301. //Accelerate by 0.05 over 40 frames, once, and wait until it's done before continuing.
  302. pattern : 4 0 ACCELERATE 40 1 0.05f NULLF;
  303. }
  304.  
  305. new shot 1
  306. {
  307. count = 3 3 4 4 1 1 1 1;
  308. offset = 0.0f 0.0f;
  309. aim = NORMAL_CIRCLE;
  310. angle = 0.0f;
  311. graphic = KUNAI 1;
  312. speed = 2.0f;
  313. pattern : 0 1 ACCELERATE 40 1 0.05f NULLF;
  314. }
  315.  
  316. new shot 2
  317. {
  318. count = 4 4 5 5 2 2 2 2;
  319. offset = 0.0f 0.0f;
  320. aim = NORMAL_CIRCLE;
  321. angle = 0.0f;
  322. graphic = KUNAI 2;
  323. speed = 2.0f;
  324. pattern : 0 1 ACCELERATE 40 1 0.04f NULLF;
  325. }
  326.  
  327. new shot 3
  328. {
  329. count = 2 2 3 3 1 1 1 1;
  330. offset = 0.0f 0.0f;
  331. aim = NORMAL_CIRCLE;
  332. angle = 0.0f;
  333. graphic = 19 1;
  334. speed = 2.0f;
  335. pattern : 0 1 ACCELERATE 40 1 0.05f NULLF;
  336. pattern : 1 0 CHANGE_GRAPHIC 19 1 NULLF NULLF;
  337. pattern : 2 1 CHANGE_BY_PLAYER 2 20 0.0f 1.5f;
  338. pattern : 3 0 CHANGE_GRAPHIC 19 1 NULLF NULLF;
  339. pattern : 4 0 ACCELERATE 40 1 0.05f NULLF;
  340. }
  341.  
  342. new shot 4
  343. {
  344. count = 3 3 4 4 1 1 1 1;
  345. offset = 0.0f 0.0f;
  346. aim = NORMAL_CIRCLE;
  347. angle = 0.0f;
  348. graphic = FIREBALL_RED 0;
  349. speed = 2.0f;
  350. pattern : 0 1 ACCELERATE 40 1 0.05f NULLF;
  351. }
  352.  
  353. new shot 5
  354. {
  355. count = 4 4 5 5 2 2 2 2;
  356. offset = 0.0f 0.0f;
  357. aim = NORMAL_CIRCLE;
  358. angle = 0.0f;
  359. graphic = FIREBALL_RED 0;
  360. speed = 2.0f;
  361. pattern : 0 1 ACCELERATE 40 1 0.04f NULLF;
  362. }
  363.  
  364. //Script
  365. loop -1 mainLoop
  366. %angle1 = randomPi;
  367. %angle2 = randomPi;
  368. %n = randomPi;
  369. loop $count circleLoop
  370. circleXY(%speed, %dummy, %n, 1.5f);
  371. shotSetSpeed(0, %speed);
  372. shotSetAngle(0, %angle1);
  373. shotFire(0);
  374. shotSetSpeed(3, %speed);
  375. shotSetAngle(3, %angle1);
  376. shotFire(3);
  377. shotSetSpeed(1, %speed);
  378. shotSetAngle(1, %angle2);
  379. shotFire(1);
  380. shotSetSpeed(4, %speed);
  381. shotSetAngle(4, %angle2);
  382. shotFire(4);
  383. %n += %nadd1;
  384. %angle1 += %add;
  385. %angle2 -= %add;
  386. endloop circleLoop
  387. wait(40);
  388. doEffect(0, SPIRAL_PINK);
  389. wait(60);
  390. %angle1 = randomPi;
  391. %angle2 = randomPi;
  392. %n = randomPi;
  393. loop $count circleLoop2
  394. circleXY(%speed, %dummy, %n, 1.5f);
  395. shotSetSpeed(2, %speed);
  396. shotSetAngle(2, %angle1);
  397. shotFire(2);
  398. shotSetSpeed(5, %speed);
  399. shotSetAngle(5, %angle1);
  400. shotFire(5);
  401. shotSetSpeed(1, %speed);
  402. shotSetAngle(1, %angle2);
  403. shotFire(1);
  404. shotSetSpeed(4, %speed);
  405. shotSetAngle(4, %angle2);
  406. shotFire(4);
  407. %n += %nadd2;
  408. %angle1 += %add;
  409. %angle2 -= %add;
  410. endloop circleLoop2
  411. wait(40);
  412. endloop mainLoop
  413.  
  414. //exit
  415. exit();
  416. }
  417.  
  418. //=========================================================================================================================================
  419. // BOSS DEATH
  420. //=========================================================================================================================================
  421. sub Boss_Dead()
  422. {
  423. var ;
  424. setFlag(68);
  425. spellBreak();
  426. bossDeath();
  427. destruct();
  428. }
  429.  
  430. //=========================================================================================================================================
  431. // MAIN
  432. //=========================================================================================================================================
  433. sub main()
  434. {
  435. var A B C;
  436. setFlag(16);
  437. ins_0();
  438. //wait(60);
  439. //dialogueStart(0);
  440. wait(360);
  441. waitForSubs();
  442. spawn("Boss", -144.0f, -16.0f, 40, 10000, POWER);
  443. waitForSubs();
  444. nextStage();
  445. //dialogueStart(1);
  446. //waitForSubs();
  447. wait(60);
  448. destruct();
  449. }
Add Comment
Please, Sign In to add comment