Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.81 KB | None | 0 0
  1. import "std.zh"
  2. import "stdExtra.zh"
  3. import "ffcscript.zh"
  4. import "string.zh"
  5. import "ghost.zh"
  6. import "LW_ZH/lweapons.zh"
  7. import "ElegyShortCuts.z"
  8.  
  9. int ElegyVars[65536];
  10.  
  11. const int CURR_CHARACTER = 0;
  12. const int CHARACTER_OFFSET = 6;
  13. const int CURR_LEVEL = 6;
  14. const int KO_STATE = 12;
  15. const int MAX_HP = 18;
  16. const int MAX_MP = 24;
  17. const int CURRENT_HP = 30;
  18. const int CURRENT_MP = 36;
  19. const int IN_PARTY = 42;
  20. const int LEVEL_EXP = 48;
  21. const int CURR_STATUS = 54;
  22. const int MUTE_TIMER = 60;
  23. const int REGEN_TIMER = 66;
  24. const int ATK_UP_TIMER = 72;
  25. const int ATK_DN_TIMER = 78;
  26. const int DEF_UP_TIMER = 84;
  27. const int DEF_DN_TIMER = 90;
  28. const int STAT_P_ATK = 96;
  29. const int STAT_P_DEF = 102;
  30. const int STAT_M_ATK = 108;
  31. const int STAT_M_DEF = 114;
  32. const int POISON_TIMER = 120;
  33. const int STOP_TIMER = 126;
  34. const int HOVER_TIMER = 132;
  35. const int POISON_WORK = 138;
  36. const int REGEN_WORK = 144;
  37.  
  38.  
  39. global script Init{
  40. void run(){
  41. Start_HP_SetUp();
  42. ElegyVars[CURR_CHARACTER]= BRANDI;
  43. ElegyVars[IN_PARTY]= 1;
  44. for(int i = 0;i<=5;i++){
  45. ElegyVars[CURR_LEVEL+i]= 1;
  46. ElegyVars[KO_STATE+i]= 1;
  47. }
  48. }
  49. }
  50.  
  51. //Values of array Character_State. For dead or alive.
  52. const int IS_DEAD = 0;
  53. const int IS_ALIVE = 1;
  54.  
  55. //Indices of characters. Named after characters for easier tracking.
  56. const int BRANDI = 0;
  57. const int HENRI = 1;
  58. const int RHEA =2;
  59. const int KYLE = 3;
  60. const int FAYN = 4;
  61. const int GARY = 5;
  62.  
  63. bool LevelUp = false;//Used to determine if character has leveled up. Not yet implemented.
  64.  
  65. //Two variables to make HP and MP increases random.
  66. int HP_RANDOMIZER;
  67. int MP_RANDOMIZER;
  68.  
  69. void Death(){
  70. int NumCharactersDead;
  71. if(Current_HP(Curr_Character())<=0)SetKO_State(Curr_Character(),IS_DEAD);
  72. for(int i=0;i<=5;i++)
  73. if(PartyMember(i) && KO(i))NumCharactersDead++;
  74. if(NumCharactersDead>=3){
  75. Link->CollDetection = false;//Turn off collision detction so we can't be hurt right now.
  76. Game->PlaySound(SFX_SPIRAL);//Play death sound.
  77. WaitNoAction(60);
  78. Link->HP=0;//Kill Link.
  79. Link->CollDetection = true;//Turn collision detection back on.
  80. Game->NumDeaths++;//Track how many times you've died.
  81. for(int i=0;i<=5;i++){
  82. if(PartyMember(i) && KO(i)){
  83. SetKO_State(ElegyVars[i],IS_ALIVE);
  84. ElegyVars[CURRENT_HP+i] = ElegyVars[MAX_HP+i];
  85. }
  86. }
  87. NumCharactersDead= 0;
  88. Game->ShowSaveQuitScreen();//End the game.
  89. Game->End();
  90. }
  91. }
  92.  
  93. //Damp all inputs and prevent collision detection if character is dead.
  94. void KO(){
  95. CustomNoAction();
  96. Link->CollDetection = false;
  97. }
  98.  
  99. //Kills all of Link's inputs
  100. void CustomNoAction(){
  101. Link->InputUp = false; Link->PressUp = false;
  102. Link->InputDown = false; Link->PressDown = false;
  103. Link->InputLeft = false; Link->PressLeft = false;
  104. Link->InputRight = false; Link->PressRight = false;
  105. Link->InputR = false; Link->PressR = false;
  106. Link->InputL = false; Link->PressL = false;
  107. Link->InputA = false; Link->PressA = false;
  108. Link->InputB = false; Link->PressB = false;
  109. Link->InputEx1 = false; Link->PressEx1 = false;
  110. Link->InputEx2 = false; Link->PressEx2 = false;
  111. Link->InputStart = false; Link->PressStart = false;
  112. }
  113.  
  114. global script OnContinue{
  115. void run(){
  116. SetCurrentHP(Curr_Character(),Max_HP(Curr_Character()));
  117. SetKO_State(Curr_Character(),IS_ALIVE);
  118. }
  119. }
  120.  
  121. global script OnExit{
  122. void run(){
  123. SetCurrentHP(Curr_Character(),Max_HP(Curr_Character()));
  124. SetKO_State(Curr_Character(),IS_ALIVE);
  125. }
  126. }
  127.  
  128. void Counter_Set(){
  129. Game->Counter[CR_SCRIPT1] = Current_HP(Curr_Character());
  130. Game->Counter[CR_SCRIPT2] = Abs(Current_MP(Curr_Character()));
  131. Game->Counter[CR_SCRIPT3] = Max_HP(Curr_Character());
  132. Game->Counter[CR_SCRIPT4] = Max_MP(Curr_Character());
  133. }
  134.  
  135. //Used to randomize HP and MP when game starts.
  136. void Start_HP_SetUp(){
  137. //Determine random factor.
  138. HP_RANDOMIZER= Rand(1,100);
  139. MP_RANDOMIZER= Rand(1,100);
  140. //Set Max HP and MP.
  141. ElegyVars[MAX_HP]= Rand(200,300)+(ElegyVars[CURR_LEVEL]*HP_RANDOMIZER);
  142. ElegyVars[MAX_HP+GARY]= Rand(300,500)+(ElegyVars[CURR_LEVEL+GARY]*HP_RANDOMIZER);
  143. ElegyVars[MAX_HP+RHEA]= Rand(250,350)+(ElegyVars[CURR_LEVEL+RHEA] *HP_RANDOMIZER);
  144. ElegyVars[MAX_HP+HENRI]= Rand(300,500)+(ElegyVars[CURR_LEVEL+HENRI] *HP_RANDOMIZER);
  145. ElegyVars[MAX_HP+KYLE]= Rand(300,500)+(ElegyVars[CURR_LEVEL+KYLE] *HP_RANDOMIZER);
  146. ElegyVars[MAX_HP+FAYN]= Rand(200,300)+(ElegyVars[CURR_LEVEL+FAYN] *HP_RANDOMIZER);
  147. ElegyVars[MAX_MP] = Rand(50,150)+(ElegyVars[CURR_LEVEL] * MP_RANDOMIZER);
  148. ElegyVars[MAX_MP+HENRI]= Rand(50,100)+(ElegyVars[CURR_LEVEL+HENRI] *MP_RANDOMIZER);
  149. ElegyVars[MAX_MP+FAYN]= Rand(50,150)+(ElegyVars[CURR_LEVEL+FAYN] *MP_RANDOMIZER);
  150. ElegyVars[MAX_MP+RHEA] = Rand(50,150)+(ElegyVars[CURR_LEVEL+RHEA] *MP_RANDOMIZER);
  151. ElegyVars[MAX_MP+KYLE]= Rand(50,100)+(ElegyVars[CURR_LEVEL+KYLE] *MP_RANDOMIZER);
  152. ElegyVars[MAX_MP+GARY]= Rand(50,100)+(ElegyVars[CURR_LEVEL+GARY] *MP_RANDOMIZER);
  153. //Set Current HP and MP to max.
  154. SetCurrentHP(BRANDI,ElegyVars[MAX_HP]);
  155. SetCurrentHP(GARY,ElegyVars[MAX_HP+GARY]);
  156. SetCurrentHP(RHEA,ElegyVars[MAX_HP+RHEA]);
  157. SetCurrentHP(HENRI,ElegyVars[MAX_HP+HENRI]);
  158. SetCurrentHP(FAYN,ElegyVars[MAX_HP+FAYN]);
  159. SetCurrentHP(KYLE,ElegyVars[MAX_HP+KYLE]);
  160. SetCurrentMP(BRANDI,ElegyVars[MAX_MP]);
  161. SetCurrentMP(KYLE,ElegyVars[MAX_MP+KYLE]);
  162. SetCurrentMP(FAYN,ElegyVars[MAX_MP+FAYN]);
  163. SetCurrentMP(HENRI,ElegyVars[MAX_MP+HENRI]);
  164. SetCurrentMP(GARY,ElegyVars[MAX_MP+GARY]);
  165. SetCurrentMP(RHEA,ElegyVars[MAX_MP+RHEA]);
  166. }
  167.  
  168. //Handles Levelling up. Not yet implemented.
  169. void LevelUp(){
  170. if(Level_Exp(Curr_Character())>(Curr_Level(Curr_Character() * 100))){
  171. ElegyVars[CURR_LEVEL+Curr_Character()]++;
  172. SetMaxHP(Curr_Character(),HP_RANDOMIZER);
  173. SetMaxMP(Curr_Character(),MP_RANDOMIZER);
  174. SetLevelExp(Curr_Character(),(Curr_Level(Curr_Character()) * 100),false);
  175. IncreaseLevel(Curr_Character());
  176. }
  177. }
  178.  
  179. global script Active{
  180. void run(){
  181. //Two variables to track Link's HP and MP.
  182. int LastHP = Link->HP;
  183. int LastMP = Link->MP;
  184. StartGhostZH();
  185. while(true){
  186. Death();
  187. UpdateGhostZH1();
  188. //Handles character appearance.
  189. if(!Link->Invisible){
  190. Character_Handler();
  191. Counter_Set();
  192. }
  193. LevelUp();
  194. //Handles character death.
  195. //Create numbers above enemies when they're damaged.
  196. EnemyDamage();
  197. UpdateLWZH1();
  198. Waitdraw();
  199. UpdateLWZH2();
  200. UpdateGhostZH2();
  201. //Track Link's HP and MP.
  202. //If it changes, affect current character's HP and MP.
  203. if(Link->HP!=LastHP||Link->MP!= LastMP)
  204. Character_HP_MP(LastHP,LastMP);
  205. StatusEffects();
  206. //Change these every frame so it is current.
  207. LastHP = Link->HP;
  208. LastMP = Link->MP;
  209. Waitframe();
  210. }
  211. }
  212. }
  213.  
  214. //Not yet implemented.
  215. int PLOT_COUNTER = CR_SCRIPT5;//Counter to track progression in plot.
  216. int AFFECTION_COUNTER = CR_SCRIPT6;//Counter to track affection.
  217.  
  218. //Change current character HP and MP as Link's HP and MP changes.
  219. void Character_HP_MP(int LastHP, int LastMP){
  220. //Two variables to track changes in HP and MP.
  221. int LostHP = LastHP-Link->HP;
  222. int LostMP = LastMP-Link->MP;
  223. //Determine which character is on screen.
  224. //Affect only them.
  225. if(Current_HP(Curr_Character())>0){
  226. if((Current_HP(Curr_Character())-LostHP)>1)
  227. ReSetCurrentHP(Curr_Character(),LostHP,false);
  228. else
  229. SetCurrentHP(Curr_Character(),0);
  230. if((Current_MP(Curr_Character())-LostMP)>1)
  231. ReSetCurrentMP(Curr_Character(),LostMP,false);
  232. else
  233. SetCurrentMP(Curr_Character(),0);
  234. }
  235. else{
  236. SetCurrentHP(Curr_Character(),0);
  237. SetKO_State(Curr_Character(),IS_DEAD);
  238. }
  239. Link->HP = LastHP;
  240. Link->MP = LastMP;
  241. }
  242.  
  243. // Set this to the font colour you want. It is set to 1 (white) by default.
  244. const int DMG_FONTCOL=1;
  245. // Set this to three different unused slots for the npc->Misc[] values. If you don't have any other script using those, the default values are fine.
  246. const int DMG_MISC1=1;
  247. const int DMG_MISC2=2;
  248. const int DMG_MISC3=3;
  249.  
  250. void EnemyDamage(){
  251. int offset;
  252. for(int i=1;i<=Screen->NumNPCs();i++){
  253. npc enem=Screen->LoadNPC(i);
  254. if(enem->Misc[DMG_MISC1]==0){
  255. enem->Misc[DMG_MISC1]=1;
  256. enem->Misc[DMG_MISC2]=enem->HP;
  257. enem->Misc[DMG_MISC3]=0;
  258. }
  259. if(enem->Misc[DMG_MISC1]!=0&&enem->HP<enem->Misc[DMG_MISC2]){
  260. enem->Misc[DMG_MISC1]=45;
  261. enem->Misc[DMG_MISC3]=enem->Misc[DMG_MISC2]-enem->HP;
  262. enem->Misc[DMG_MISC2]=enem->HP;
  263. }
  264. if(enem->Misc[DMG_MISC1]>1){
  265. if(enem->Misc[DMG_MISC3]>9){offset=0;}
  266. else{offset=4;}
  267. if(enem->Misc[DMG_MISC1]%3!=0)Screen->DrawInteger(6, enem->X+offset, enem->Y-18+(enem->Misc[DMG_MISC1]/5), FONT_Z1, DMG_FONTCOL, -1, -1, -1, enem->Misc[DMG_MISC3], 0, 128);
  268. enem->Misc[DMG_MISC1]--;
  269. }
  270. }
  271. }
  272.  
  273. //Combos for normal and attacking animations.
  274. const int BRANDI_COMBO = 992;
  275. const int HENRI_COMBO = 976;
  276. const int RHEA_COMBO = 928;
  277. const int KYLE_COMBO = 960;
  278. const int FAYN_COMBO = 1008;
  279. const int GARY_COMBO = 944;
  280. const int RHEA_ATTACK_COMBO= 2480;
  281. const int BRANDI_ATTACK_COMBO = 2496;
  282. const int HENRI_ATTACK_COMBO = 2512;
  283. const int GARY_ATTACK_COMBO = 2528;
  284. const int KYLE_ATTACK_COMBO = 2544;
  285. const int FAYN_ATTACK_COMBO = 2560;
  286.  
  287. //Items which tell game a character is in the party.
  288. const int BRANDI_ITEM = 144;
  289. const int HENRI_ITEM = 145;
  290. const int RHEA_ITEM = 148;
  291. const int FAYN_ITEM = 149;
  292. const int KYLE_ITEM = 146;
  293. const int GARY_ITEM = 147;
  294.  
  295. //Changes appearance based on character you're playing as.
  296. void Character_Handler(){
  297. if(Curr_Character() ==BRANDI){
  298. //Shift to another character if they're in the party.
  299. if(Link->PressEx3){
  300. if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  301. else if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  302. else if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  303. else if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  304. else if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  305. }
  306. else if(Link->PressEx4){
  307. if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  308. else if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  309. else if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  310. else if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  311. else if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  312. }
  313. //If character is dead, do nothing.
  314. if(KO(BRANDI))
  315. KO();
  316. //Change appearance based on your actions.
  317. else{
  318. Link->CollDetection = true;
  319. if(Link->Action == LA_NONE||Link->Action == LA_WALKING||Link->Action ==LA_SCROLLING){
  320. if(Link->Dir == DIR_DOWN && !Link->InputDown && !Link->PressDown)
  321. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_COMBO+9, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  322. else if(Link->PressDown ||Link->InputDown)
  323. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_COMBO+1, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  324. else if(Link->Dir == DIR_LEFT && !Link->PressLeft && !Link->InputLeft)
  325. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_COMBO+10, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  326. else if(Link->PressLeft ||Link->InputLeft)
  327. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_COMBO+2, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  328. else if(Link->Dir == DIR_RIGHT && !Link->PressRight && !Link->InputRight)
  329. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_COMBO+11, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  330. else if(Link->PressRight ||Link->InputRight)
  331. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_COMBO+3, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  332. else if(Link->Dir == DIR_UP && !Link->PressUp && !Link->InputUp)
  333. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_COMBO+8, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  334. else if(Link->PressUp ||Link->InputUp)
  335. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_COMBO, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  336. }
  337. if(Link->Action == LA_ATTACKING||Link->Action ==LA_CASTING){
  338. if(Link->Dir == DIR_UP)
  339. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_ATTACK_COMBO, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  340. else if(Link->Dir== DIR_DOWN)
  341. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_ATTACK_COMBO+1, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  342. else if(Link->Dir==DIR_LEFT)
  343. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_ATTACK_COMBO+2, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  344. else if(Link->Dir==DIR_RIGHT)
  345. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_ATTACK_COMBO+3, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  346. }
  347. else if(Link->Action ==LA_HOLD1LAND)
  348. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_ATTACK_COMBO+8, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  349. else if(Link->Action ==LA_HOLD2LAND)
  350. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_ATTACK_COMBO+9, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  351. else if(Link->Action ==LA_GOTHURTLAND|| Link->Action== LA_DYING){
  352. Screen->DrawCombo(1, drawX, drawY-16, BRANDI_ATTACK_COMBO+10, 1, 2, 8, -1, -1, 0, 0, 0, 48, 0, true, 64);
  353. }
  354. }
  355. }
  356. else if(Curr_Character() ==HENRI){
  357. if(Link->PressEx3){
  358. if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  359. else if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  360. else if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  361. else if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  362. else if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  363. }
  364. else if(Link->PressEx4){
  365. if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  366. else if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  367. else if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  368. else if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  369. else if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  370. }
  371. if(KO(HENRI))
  372. KO();
  373. else{
  374. Link->CollDetection = true;
  375. if(Link->Action == LA_NONE||Link->Action == LA_WALKING||Link->Action ==LA_SCROLLING){
  376. if(Link->Dir == DIR_DOWN && !Link->InputDown && !Link->PressDown)
  377. Screen->DrawCombo(1, drawX, drawY-16, HENRI_COMBO+9, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  378. else if(Link->PressDown ||Link->InputDown)
  379. Screen->DrawCombo(1, drawX, drawY-16, HENRI_COMBO+1, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  380. else if(Link->Dir == DIR_LEFT && !Link->PressLeft && !Link->InputLeft)
  381. Screen->DrawCombo(1, drawX, drawY-16, HENRI_COMBO+10, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  382. else if(Link->PressLeft ||Link->InputLeft)
  383. Screen->DrawCombo(1, drawX, drawY-16, HENRI_COMBO+2, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  384. else if(Link->Dir == DIR_RIGHT && !Link->PressRight && !Link->InputRight)
  385. Screen->DrawCombo(1, drawX, drawY-16, HENRI_COMBO+11, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  386. else if(Link->PressRight ||Link->InputRight)
  387. Screen->DrawCombo(1, drawX, drawY-16, HENRI_COMBO+3, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  388. else if(Link->Dir == DIR_UP && !Link->PressUp && !Link->InputUp)
  389. Screen->DrawCombo(1, drawX, drawY-16, HENRI_COMBO+8, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  390. else if(Link->PressUp ||Link->InputUp)
  391. Screen->DrawCombo(1, drawX, drawY-16, HENRI_COMBO, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  392. }
  393. if(Link->Action == LA_ATTACKING||Link->Action ==LA_CASTING){
  394. if(Link->Dir == DIR_UP)
  395. Screen->DrawCombo(1, drawX, drawY-16, HENRI_ATTACK_COMBO, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  396. else if(Link->Dir== DIR_DOWN)
  397. Screen->DrawCombo(1, drawX, drawY-16, HENRI_ATTACK_COMBO+1, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  398. else if(Link->Dir==DIR_LEFT)
  399. Screen->DrawCombo(1, drawX, drawY-16, HENRI_ATTACK_COMBO+2, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  400. else if(Link->Dir==DIR_RIGHT)
  401. Screen->DrawCombo(1, drawX, drawY-16, HENRI_ATTACK_COMBO+3, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  402. }
  403. else if(Link->Action ==LA_HOLD1LAND)
  404. Screen->DrawCombo(1, drawX, drawY-16, HENRI_ATTACK_COMBO+8, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  405. else if(Link->Action ==LA_HOLD2LAND)
  406. Screen->DrawCombo(1, drawX, drawY-16, HENRI_ATTACK_COMBO+9, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  407. else if(Link->Action ==LA_GOTHURTLAND|| Link->Action== LA_DYING){
  408. Screen->DrawCombo(1, drawX, drawY-16, HENRI_ATTACK_COMBO+10, 1, 2, 8, -1, -1, 0, 0, 0, 48, 0, true, 64);
  409. }
  410. }
  411. }
  412. else if(Curr_Character() == RHEA){
  413. if(Link->PressEx3){
  414. if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  415. else if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  416. else if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  417. else if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  418. else if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  419. }
  420. else if(Link->PressEx4){
  421. if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  422. else if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  423. else if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  424. else if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  425. else if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  426. }
  427. if(KO(RHEA))
  428. KO();
  429. else{
  430. Link->CollDetection = true;
  431. if(Link->Action == LA_NONE||Link->Action == LA_WALKING||Link->Action ==LA_SCROLLING){
  432. if(Link->Dir == DIR_DOWN && !Link->InputDown && !Link->PressDown)
  433. Screen->DrawCombo(1, drawX, drawY-16, RHEA_COMBO+9, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  434. else if(Link->PressDown ||Link->InputDown)
  435. Screen->DrawCombo(1, drawX, drawY-16, RHEA_COMBO+1, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  436. else if(Link->Dir == DIR_LEFT && !Link->PressLeft && !Link->InputLeft)
  437. Screen->DrawCombo(1, drawX, drawY-16, RHEA_COMBO+10, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  438. else if(Link->PressLeft ||Link->InputLeft)
  439. Screen->DrawCombo(1, drawX, drawY-16, RHEA_COMBO+2, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  440. else if(Link->Dir == DIR_RIGHT && !Link->PressRight && !Link->InputRight)
  441. Screen->DrawCombo(1, drawX, drawY-16, RHEA_COMBO+11, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  442. else if(Link->PressRight ||Link->InputRight)
  443. Screen->DrawCombo(1, drawX, drawY-16, RHEA_COMBO+3, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  444. else if(Link->Dir == DIR_UP && !Link->PressUp && !Link->InputUp)
  445. Screen->DrawCombo(1, drawX, drawY-16, RHEA_COMBO+8, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  446. else if(Link->PressUp ||Link->InputUp)
  447. Screen->DrawCombo(1, drawX, drawY-16, RHEA_COMBO, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  448. }
  449. if(Link->Action == LA_ATTACKING||Link->Action ==LA_CASTING){
  450. if(Link->Dir == DIR_UP)
  451. Screen->DrawCombo(1, drawX, drawY-16, RHEA_ATTACK_COMBO, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  452. else if(Link->Dir== DIR_DOWN)
  453. Screen->DrawCombo(1, drawX, drawY-16, RHEA_ATTACK_COMBO+1, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  454. else if(Link->Dir==DIR_LEFT)
  455. Screen->DrawCombo(1, drawX, drawY-16, RHEA_ATTACK_COMBO+2, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  456. else if(Link->Dir==DIR_RIGHT)
  457. Screen->DrawCombo(1, drawX, drawY-16, RHEA_ATTACK_COMBO+3, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  458. }
  459. else if(Link->Action ==LA_HOLD1LAND)
  460. Screen->DrawCombo(1, drawX, drawY-16, RHEA_ATTACK_COMBO+8, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  461. else if(Link->Action ==LA_HOLD2LAND)
  462. Screen->DrawCombo(1, drawX, drawY-16, RHEA_ATTACK_COMBO+9, 1, 2, 1, -1, -1, 0, 0, 0, -1, 0, true, 128);
  463. else if(Link->Action ==LA_GOTHURTLAND|| Link->Action== LA_DYING){
  464. Screen->DrawCombo(1, drawX, drawY-16, RHEA_ATTACK_COMBO+10, 1, 2, 1, -1, -1, 0, 0, 0, 48, 0, true, 64); }
  465. }
  466. }
  467. else if(Curr_Character() ==GARY){
  468. if(Link->PressEx3){
  469. if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  470. else if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  471. else if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  472. else if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  473. else if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  474. }
  475. else if(Link->PressEx4){
  476. if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  477. else if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  478. else if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  479. else if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  480. else if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  481. }
  482. if(KO(GARY))
  483. KO();
  484. else{
  485. Link->CollDetection = true;
  486. if(Link->Action == LA_NONE||Link->Action == LA_WALKING||Link->Action ==LA_SCROLLING){
  487. if(Link->Dir == DIR_DOWN && !Link->InputDown && !Link->PressDown)
  488. Screen->DrawCombo(1, drawX, drawY-16, GARY_COMBO+9, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  489. else if(Link->PressDown ||Link->InputDown)
  490. Screen->DrawCombo(1, drawX, drawY-16, GARY_COMBO+1, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  491. else if(Link->Dir == DIR_LEFT && !Link->PressLeft && !Link->InputLeft)
  492. Screen->DrawCombo(1, drawX, drawY-16, GARY_COMBO+10, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  493. else if(Link->PressLeft ||Link->InputLeft)
  494. Screen->DrawCombo(1, drawX, drawY-16, GARY_COMBO+2, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  495. else if(Link->Dir == DIR_RIGHT && !Link->PressRight && !Link->InputRight)
  496. Screen->DrawCombo(1, drawX, drawY-16, GARY_COMBO+11, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  497. else if(Link->PressRight ||Link->InputRight)
  498. Screen->DrawCombo(1, drawX, drawY-16, GARY_COMBO+3, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  499. else if(Link->Dir == DIR_UP && !Link->PressUp && !Link->InputUp)
  500. Screen->DrawCombo(1, drawX, drawY-16, GARY_COMBO+8, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  501. else if(Link->PressUp ||Link->InputUp)
  502. Screen->DrawCombo(1, drawX, drawY-16, GARY_COMBO, 1, 2,6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  503. }
  504. if(Link->Action == LA_ATTACKING||Link->Action ==LA_CASTING){
  505. if(Link->Dir == DIR_UP)
  506. Screen->DrawCombo(1, drawX, drawY-16, GARY_ATTACK_COMBO, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  507. else if(Link->Dir== DIR_DOWN)
  508. Screen->DrawCombo(1, drawX, drawY-16, GARY_ATTACK_COMBO+1, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  509. else if(Link->Dir==DIR_LEFT)
  510. Screen->DrawCombo(1, drawX, drawY-16, GARY_ATTACK_COMBO+2, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  511. else if(Link->Dir==DIR_RIGHT)
  512. Screen->DrawCombo(1, drawX, drawY-16, GARY_ATTACK_COMBO+3, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  513. }
  514. else if(Link->Action ==LA_HOLD1LAND)
  515. Screen->DrawCombo(1, drawX, drawY-16, GARY_ATTACK_COMBO+8, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  516. else if(Link->Action ==LA_HOLD2LAND)
  517. Screen->DrawCombo(1, drawX, drawY-16, GARY_ATTACK_COMBO+9, 1, 2, 6, -1, -1, 0, 0, 0, -1, 0, true, 128);
  518. else if(Link->Action ==LA_GOTHURTLAND|| Link->Action== LA_DYING){
  519. Screen->DrawCombo(1, drawX, drawY-16, GARY_ATTACK_COMBO+10, 1, 2, 6, -1, -1, 0, 0, 0, 48, 0, true, 64);
  520. }
  521. }
  522. }
  523. else if(Curr_Character() ==FAYN){
  524. if(Link->PressEx3){
  525. if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  526. else if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  527. else if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  528. else if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  529. else if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  530. }
  531. else if(Link->PressEx4){
  532. if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  533. else if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  534. else if(PartyMember(KYLE))ElegyVars[CURR_CHARACTER] = KYLE;
  535. else if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  536. else if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  537. }
  538. if(KO(FAYN))
  539. KO();
  540. else{
  541. Link->CollDetection = true;
  542. if(Link->Action == LA_NONE||Link->Action == LA_WALKING||Link->Action ==LA_SCROLLING){
  543. if(Link->Dir == DIR_DOWN && !Link->InputDown && !Link->PressDown)
  544. Screen->DrawCombo(1, drawX, drawY-16, FAYN_COMBO+9, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  545. else if(Link->PressDown ||Link->InputDown)
  546. Screen->DrawCombo(1, drawX, drawY-16, FAYN_COMBO+1, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  547. else if(Link->Dir == DIR_LEFT && !Link->PressLeft && !Link->InputLeft)
  548. Screen->DrawCombo(1, drawX, drawY-16, FAYN_COMBO+10, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  549. else if(Link->PressLeft ||Link->InputLeft)
  550. Screen->DrawCombo(1, drawX, drawY-16, FAYN_COMBO+2, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  551. else if(Link->Dir == DIR_RIGHT && !Link->PressRight && !Link->InputRight)
  552. Screen->DrawCombo(1, drawX, drawY-16, FAYN_COMBO+11, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  553. else if(Link->PressRight ||Link->InputRight)
  554. Screen->DrawCombo(1, drawX, drawY-16, FAYN_COMBO+3, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  555. else if(Link->Dir == DIR_UP && !Link->PressUp && !Link->InputUp)
  556. Screen->DrawCombo(1, drawX, drawY-16, FAYN_COMBO+8, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  557. else if(Link->PressUp ||Link->InputUp)
  558. Screen->DrawCombo(1, drawX, drawY-16, FAYN_COMBO, 1, 2, 8, -1, -1, 0, 0, 0, -1, 0, true, 128);
  559. }
  560. if(Link->Action == LA_ATTACKING||Link->Action ==LA_CASTING){
  561. if(Link->Dir == DIR_UP)
  562. Screen->DrawCombo(1, drawX, drawY-16, FAYN_ATTACK_COMBO, 1, 2, 0, -1, -1, 0, 0, 0, -1, 0, true, 128);
  563. else if(Link->Dir== DIR_DOWN)
  564. Screen->DrawCombo(1, drawX, drawY-16, FAYN_ATTACK_COMBO+1, 1, 2, 0, -1, -1, 0, 0, 0, -1, 0, true, 128);
  565. else if(Link->Dir==DIR_LEFT)
  566. Screen->DrawCombo(1, drawX, drawY-16, FAYN_ATTACK_COMBO+2, 1, 2, 0, -1, -1, 0, 0, 0, -1, 0, true, 128);
  567. else if(Link->Dir==DIR_RIGHT)
  568. Screen->DrawCombo(1, drawX, drawY-16, FAYN_ATTACK_COMBO+3, 1, 2, 0, -1, -1, 0, 0, 0, -1, 0, true, 128);
  569. }
  570. else if(Link->Action ==LA_HOLD1LAND)
  571. Screen->DrawCombo(1, drawX, drawY-16, FAYN_ATTACK_COMBO+8, 1, 2, 0, -1, -1, 0, 0, 0, -1, 0, true, 128);
  572. else if(Link->Action ==LA_HOLD2LAND)
  573. Screen->DrawCombo(1, drawX, drawY-16, FAYN_ATTACK_COMBO+9, 1, 2, 0, -1, -1, 0, 0, 0, -1, 0, true, 128);
  574. else if(Link->Action ==LA_GOTHURTLAND|| Link->Action== LA_DYING){
  575. Screen->DrawCombo(1, drawX, drawY-16, FAYN_ATTACK_COMBO+10, 1, 2, 0, -1, -1, 0, 0, 0, 48, 0, true, 64);
  576. }
  577. }
  578. }
  579. else if(Curr_Character() ==KYLE){
  580. if(Link->PressEx3){
  581. if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  582. else if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  583. else if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  584. else if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  585. else if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  586. }
  587. else if(Link->PressEx4){
  588. if(PartyMember(BRANDI))ElegyVars[CURR_CHARACTER] = BRANDI;
  589. else if(PartyMember(HENRI))ElegyVars[CURR_CHARACTER] = HENRI;
  590. else if(PartyMember(FAYN))ElegyVars[CURR_CHARACTER] = FAYN;
  591. else if(PartyMember(GARY))ElegyVars[CURR_CHARACTER] = GARY;
  592. else if(PartyMember(RHEA))ElegyVars[CURR_CHARACTER] = RHEA;
  593. }
  594. if(KO(KYLE))
  595. KO();
  596. else{
  597. Link->CollDetection = true;
  598. if(Link->Action == LA_NONE||Link->Action == LA_WALKING||Link->Action ==LA_SCROLLING){
  599. if(Link->Dir == DIR_DOWN && !Link->InputDown && !Link->PressDown)
  600. Screen->DrawCombo(1, drawX, drawY-16, KYLE_COMBO+9, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  601. else if(Link->PressDown ||Link->InputDown)
  602. Screen->DrawCombo(1, drawX, drawY-16, KYLE_COMBO+1, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  603. else if(Link->Dir == DIR_LEFT && !Link->PressLeft && !Link->InputLeft)
  604. Screen->DrawCombo(1, drawX, drawY-16, KYLE_COMBO+10, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  605. else if(Link->PressLeft ||Link->InputLeft)
  606. Screen->DrawCombo(1, drawX, drawY-16, KYLE_COMBO+2, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  607. else if(Link->Dir == DIR_RIGHT && !Link->PressRight && !Link->InputRight)
  608. Screen->DrawCombo(1, drawX, drawY-16, KYLE_COMBO+11, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  609. else if(Link->PressRight ||Link->InputRight)
  610. Screen->DrawCombo(1, drawX, drawY-16, KYLE_COMBO+3, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  611. else if(Link->Dir == DIR_UP && !Link->PressUp && !Link->InputUp)
  612. Screen->DrawCombo(1, drawX, drawY-16, KYLE_COMBO+8, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  613. else if(Link->PressUp ||Link->InputUp)
  614. Screen->DrawCombo(1, drawX, drawY-16, KYLE_COMBO, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  615. }
  616. if(Link->Action == LA_ATTACKING||Link->Action ==LA_CASTING){
  617. if(Link->Dir == DIR_UP)
  618. Screen->DrawCombo(1, drawX, drawY-16, KYLE_ATTACK_COMBO, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  619. else if(Link->Dir== DIR_DOWN)
  620. Screen->DrawCombo(1, drawX, drawY-16, KYLE_ATTACK_COMBO+1, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  621. else if(Link->Dir==DIR_LEFT)
  622. Screen->DrawCombo(1, drawX, drawY-16, KYLE_ATTACK_COMBO+2, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  623. else if(Link->Dir==DIR_RIGHT)
  624. Screen->DrawCombo(1, drawX, drawY-16, KYLE_ATTACK_COMBO+3, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  625. }
  626. else if(Link->Action ==LA_HOLD1LAND)
  627. Screen->DrawCombo(1, drawX, drawY-16, KYLE_ATTACK_COMBO+8, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  628. else if(Link->Action ==LA_HOLD2LAND)
  629. Screen->DrawCombo(1, drawX, drawY-16, KYLE_ATTACK_COMBO+9, 1, 2, 7, -1, -1, 0, 0, 0, -1, 0, true, 128);
  630. else if(Link->Action ==LA_GOTHURTLAND|| Link->Action== LA_DYING){
  631. Screen->DrawCombo(1, drawX, drawY-16, KYLE_ATTACK_COMBO+10, 1, 2, 7, -1, -1, 0, 0, 0, 48, 0, true, 64);
  632. }
  633. }
  634. }
  635. //Tells game who is in the party.
  636. if(Link->Item[KYLE_ITEM])SetPartyMember(KYLE);
  637. if(Link->Item[RHEA_ITEM])SetPartyMember(RHEA);
  638. if(Link->Item[GARY_ITEM])SetPartyMember(GARY);
  639. if(Link->Item[FAYN_ITEM])SetPartyMember(FAYN);
  640. if(Link->Item[BRANDI_ITEM])SetPartyMember(BRANDI);
  641. if(Link->Item[HENRI_ITEM])SetPartyMember(HENRI);
  642. }
  643.  
  644. item script SelfHeal{
  645. void run(int dummy, int HealingAmount, int healsfx, int MPCost){
  646. if(MPCost!=0 && Current_MP(Curr_Character())>=MPCost){
  647. ReSetCurrentHP(Curr_Character(),HealingAmount,true);
  648. if(Current_HP(Curr_Character())>=Max_HP(Curr_Character()))
  649. SetCurrentHP(ElegyVars[CURR_CHARACTER],Max_HP(Curr_Character()));
  650. ReSetCurrentMP(Curr_Character(),MPCost,false);
  651. Game->PlaySound(healsfx);
  652. }
  653. else if(MPCost == 0 && Virtual_Inv[I_POTION]>=1){
  654. ReSetCurrentHP(Curr_Character(),HealingAmount,true);
  655. if(Current_HP(Curr_Character())>=Max_HP(Curr_Character()))
  656. SetCurrentHP(ElegyVars[CURR_CHARACTER],Max_HP(Curr_Character()));
  657. Virtual_Inv[I_POTION]--;
  658. Game->PlaySound(healsfx);
  659. }
  660. else Game->PlaySound(SFX_ERROR);
  661. }
  662. }
  663.  
  664. int Virtual_Inv[65536];
  665.  
  666. const int I_POTION = 0;
  667. const int I_PARTY_HEAL = 1;
  668. const int I_ETHER = 2;
  669. const int I_PHOENIX_DN = 3;
  670.  
  671. item script PartyHeal{
  672. void run(int dummy, int HealingAmount, int healsfx, int MPCost){
  673. if(MPCost!=0 && Current_MP(Curr_Character())>=MPCost){
  674. for(int i = 0;i<6;i++){
  675. if(PartyMember(i) && !KO(i))ReSetCurrentHP(i,HealingAmount,true);
  676. if(Current_HP(i)>=Max_HP(i))SetCurrentHP(i,Max_HP(i));
  677. }
  678. ReSetCurrentMP(Curr_Character(),MPCost,false);
  679. Game->PlaySound(healsfx);
  680. }
  681. else if(MPCost == 0 && Virtual_Inv[I_PARTY_HEAL]>=1){
  682. for(int i = 0;i<6;i++){
  683. if(PartyMember(i) && !KO(i))ReSetCurrentHP(i,HealingAmount,true);
  684. if(Current_HP(i)>=Max_HP(i))SetCurrentHP(i,Max_HP(i));
  685. }
  686. Virtual_Inv[I_PARTY_HEAL]--;
  687. Game->PlaySound(healsfx);
  688. }
  689. else Game->PlaySound(SFX_ERROR);
  690. }
  691. }
  692.  
  693. item script SelfEther{
  694. void run(int dummy, int HealingAmount, int healsfx){
  695. if(Virtual_Inv[I_ETHER]>=1){
  696. ReSetCurrentHP(Curr_Character(),HealingAmount,true);
  697. if(Current_MP(Curr_Character())>=Max_MP(Curr_Character()))
  698. SetCurrentMP(Curr_Character(),Max_MP(Curr_Character()));
  699. Virtual_Inv[I_ETHER]--;
  700. Game->PlaySound(healsfx);
  701. }
  702. else Game->PlaySound(SFX_ERROR);
  703. }
  704. }
  705.  
  706. item script PhoenixDown{
  707. void run(int dummy,int ReviveAmount, int ReviveSfx,int MPCost){
  708. if(MPCost!=0 && Current_MP(Curr_Character())>=MPCost){
  709. for(int i= 0;i<6;i++){
  710. if(PartyMember(i) && KO(i)){
  711. SetKO_State(i,IS_ALIVE);
  712. ReSetCurrentHP(i,ReviveAmount,true);
  713. if(Current_HP(i)>=Max_HP(i))
  714. SetCurrentHP(i,Max_HP(i));
  715. Game->PlaySound(ReviveSfx);
  716. }
  717. }
  718. ReSetCurrentMP(Curr_Character(),MPCost,false);
  719. }
  720. else if(MPCost == 0 && Virtual_Inv[I_PHOENIX_DN]>=1){
  721. for(int i= 0;i<6;i++){
  722. if(PartyMember(i) && KO(i)){
  723. SetKO_State(i,IS_ALIVE);
  724. ReSetCurrentHP(i,ReviveAmount,true);
  725. if(Current_HP(i)>=Max_HP(i))
  726. SetCurrentHP(i,Max_HP(i));
  727. Game->PlaySound(ReviveSfx);
  728. }
  729. }
  730. Virtual_Inv[I_PHOENIX_DN]--;
  731. }
  732. else Game->PlaySound(SFX_ERROR);
  733. }
  734. }
  735.  
  736. item script CounterItemPickup{
  737. void run(int CounterToIncrease,int Amount){
  738. Virtual_Inv[CounterToIncrease]+=Amount;
  739. }
  740. }
  741.  
  742. item script SimpleMessage{
  743. void run(int Message){
  744. Screen->Message(Message);
  745. }
  746. }
  747.  
  748. item script Inventory{
  749. void run(int Message, int ItemToSet){
  750. Screen->Message(Message);
  751. Virtual_Inv[ItemToSet]= 1;
  752. }
  753. }
  754.  
  755. const int LW_MISC_ELEMENTAL_TYPE = 0;
  756.  
  757. const int LW_TYPE_NON_ELEMENTAL = 0;
  758. const int LW_TYPE_FIRE = 1;
  759. const int LW_TYPE_WATER = 2;
  760. const int LW_TYPE_WIND = 3;
  761. const int LW_TYPE_EARTH = 4;
  762.  
  763. item script Substitute_Item{
  764. void run(int Message,int item_to_give){
  765. Screen->Message(Message);
  766. item TradeSeqItem;
  767. //Create the item and place it at Link's location.
  768. TradeSeqItem = Screen->CreateItem(item_to_give);
  769. TradeSeqItem->X = Link->X;
  770. TradeSeqItem->Y = Link->Y;
  771. TradeSeqItem->Pickup |= IP_HOLDUP;
  772. }
  773. }
  774.  
  775. const int SFX_ERROR = 0;
  776.  
  777. item script DirectionalMagicAttack{
  778. void run(int dummy, int type,int MPCost,int sprite, int damage,int element, int Sfx){
  779. if(Current_MP(Curr_Character())>=MPCost){
  780. lweapon lw = FireScriptedLWeapon(type, Link->X+FixedInFrontX(Link->Dir,2), Link->Y+FixedInFrontY(Link->Dir,2),
  781. sprite, 200, damage,0);
  782. lw->Misc[LW_MISC_ELEMENTAL_TYPE]= element;
  783. Game->PlaySound(Sfx);
  784. ReSetCurrentMP(Curr_Character(),MPCost,false);
  785. }
  786. else
  787. Game->PlaySound(SFX_ERROR);
  788. }
  789. }
  790.  
  791. item script OmniDirMagicAttack{
  792. void run(int dummy, int type,int MPCost,int sprite, int speed, int damage,int element, int Sfx){
  793. if(Current_MP(Curr_Character())>=MPCost){
  794. for(float i = 0;i<360;i+=45){
  795. lweapon lw = FireIndependentLWeapon(type, (Link->X+8)+32*Cos(i*45), (Link->Y+16)+32*Sin(i*45),
  796. i/45,sprite, speed, damage,0);
  797. lw->Misc[LW_MISC_ELEMENTAL_TYPE]= element;
  798. }
  799. Game->PlaySound(Sfx);
  800. ReSetCurrentMP(Curr_Character(),MPCost,false);
  801. }
  802. else
  803. Game->PlaySound(SFX_ERROR);
  804. }
  805. }
  806.  
  807. item script DirectionalPhysAttack{
  808. void run(int dummy, int type,int sprite,int speed, int damage,int element, int Sfx){
  809. lweapon lw = FireScriptedLWeapon(type, Link->X+FixedInFrontX(Link->Dir,2), Link->Y+FixedInFrontY(Link->Dir,2),
  810. sprite, speed, damage,0);
  811. lw->Misc[LW_MISC_ELEMENTAL_TYPE]= element;
  812. Game->PlaySound(Sfx);
  813. }
  814. }
  815.  
  816. item script OmniDirPhysAttack{
  817. void run(int dummy,int type,int sprite, int speed, int damage,int element, int Sfx){
  818. int rightway;
  819. float angle;
  820. for(float i = 0;i<=315;i+=45){
  821. rightway = i/45;
  822. if(rightway==0)
  823. angle = 270;
  824. else if(rightway==1)
  825. angle = 90;
  826. else if(rightway==2)
  827. angle = 180;
  828. else if(rightway==3)
  829. angle = 0;
  830. else if(rightway==4)
  831. angle = 225;
  832. else if(rightway==5)
  833. angle = 315;
  834. else if(rightway==6)
  835. angle = 135;
  836. else
  837. angle = 45;
  838. lweapon lw = FireIndependentLWeapon(type, (Link->X+8)+32*Cos(angle), (Link->Y+16)+32*Sin(angle),
  839. i/45,sprite, speed, damage,0);
  840. lw->Misc[LW_MISC_ELEMENTAL_TYPE]= element;
  841. }
  842. Game->PlaySound(Sfx);
  843. }
  844. }
  845.  
  846. item script StatusBuff{
  847. void run(int dummy, int MPCost, int Sprite, int Sfx, int Buff){
  848. if(Current_MP(Curr_Character())>=MPCost){
  849. Game->PlaySound(Sfx);
  850. ReSetCurrentMP(Curr_Character(),MPCost,false);
  851. if(!CharacterStatus(Curr_Character(),Buff))
  852. SetCharacterStatus(Buff);
  853. lweapon lw = FireIndependentLWeapon(LW_SCRIPT1, Link->X, Link->Y-16,
  854. 270,Sprite, 0, 0,0);
  855. }
  856. else
  857. Game->PlaySound(SFX_ERROR);
  858. }
  859. }
  860.  
  861. item script StatusHeal{
  862. void run(int dummy, int MPCost, int Sprite, int Sfx, int Buff){
  863. if(Current_MP(Curr_Character())>=MPCost){
  864. Game->PlaySound(Sfx);
  865. ReSetCurrentMP(Curr_Character(),MPCost,false);
  866. if(CharacterStatus(Curr_Character(),Buff))
  867. UnSetCharacterStatus(Buff);
  868. lweapon lw = FireIndependentLWeapon(LW_SCRIPT1, Link->X, Link->Y-16,
  869. 270,Sprite, 0, 0,0);
  870. }
  871. else
  872. Game->PlaySound(SFX_ERROR);
  873. }
  874. }
  875.  
  876. //Positive Status Effects
  877.  
  878. //Buff Type Constants
  879.  
  880. const int LB_HOVER = 00000000001b;//Hover, avoid pits and spikes.
  881. const int LB_DEF = 00000000010b;//Damage is reduced.
  882. const int LB_ATK = 00000000100b;//Attack is increased.
  883. const int LB_REGEN = 00000001000b;//Regen.
  884.  
  885. //Debuff type constants.
  886.  
  887. const int LDB_POISON = 00000010000b;//You are poisoned.
  888. const int LDB_STOP = 00000100000b;//You can't move.
  889. const int LDB_MUTE = 00001000000b;//You can't use magic.
  890.  
  891. //Array
  892.  
  893. void StatusEffects(){
  894. if(CharacterStatus(Curr_Character(),LB_HOVER))
  895. __UpdateLinkHover(Curr_Character());
  896. if(CharacterStatus(Curr_Character(),LB_DEF))
  897. __UpdateLinkDef(Curr_Character());
  898. if(CharacterStatus(Curr_Character(),LB_ATK))
  899. __UpdateLinkAtk(Curr_Character());
  900. if(CharacterStatus(Curr_Character(),LDB_POISON))
  901. __UpdateLinkPoison(Curr_Character());
  902. if(CharacterStatus(Curr_Character(),LDB_STOP))
  903. __UpdateLinkStop(Curr_Character());
  904. if(CharacterStatus(Curr_Character(),LB_REGEN))
  905. __UpdateLinkRegen(Curr_Character());
  906. if(CharacterStatus(Curr_Character(),LDB_MUTE))
  907. __UpdateLinkMute(Curr_Character());
  908. }
  909.  
  910. void __UpdateLinkAtk(int Character){
  911. if(ElegyVars[ATK_UP_TIMER+Character]==0)
  912. ElegyVars[ATK_UP_TIMER+Character]= MAX_BUFF_TIME;
  913. else{
  914. ElegyVars[STAT_M_ATK+Character]*=2;
  915. ElegyVars[STAT_P_ATK+Character]*=2;
  916. ElegyVars[ATK_UP_TIMER+Character]--;
  917. if(ElegyVars[ATK_UP_TIMER+Character]<5){
  918. UnSetCharacterStatus(Character,LB_ATK);
  919. ElegyVars[STAT_M_ATK+Character]/=2;
  920. ElegyVars[STAT_P_ATK+Character]/=2;
  921. ElegyVars[ATK_UP_TIMER+Character]=0;
  922. }
  923. }
  924. }
  925.  
  926. void __UpdateLinkDef(int Character){
  927. if(ElegyVars[DEF_UP_TIMER+Character]==0)
  928. ElegyVars[DEF_UP_TIMER+Character]= MAX_BUFF_TIME;
  929. else{
  930. ElegyVars[STAT_M_DEF+Character]*=2;
  931. ElegyVars[STAT_P_DEF+Character]*=2;
  932. ElegyVars[DEF_UP_TIMER+Character]--;
  933. if(ElegyVars[DEF_UP_TIMER+Character]<5){
  934. UnSetCharacterStatus(Character,LB_DEF);
  935. ElegyVars[STAT_M_DEF]/=2;
  936. ElegyVars[STAT_P_DEF]/=2;
  937. ElegyVars[DEF_UP_TIMER]=0;
  938. }
  939. }
  940. }
  941.  
  942. const int MAX_BUFF_TIME = 300;
  943.  
  944. void __UpdateLinkHover(int Character){
  945. if(ElegyVars[HOVER_TIMER]==0)ElegyVars[HOVER_TIMER]=MAX_BUFF_TIME;
  946. else{
  947. ElegyVars[HOVER_TIMER]--;
  948. Link->Z = 1;
  949. Link->Jump = 0;
  950. if(ElegyVars[HOVER_TIMER]<5){
  951. UnSetCharacterStatus(Character,LB_HOVER);
  952. ElegyVars[HOVER_TIMER]= 0;
  953. }
  954. }
  955. }
  956.  
  957. const int POISON_INTERVAL = 30;
  958.  
  959. void __UpdateLinkPoison(int Character){
  960. if(ElegyVars[POISON_TIMER+Character]==0)
  961. ElegyVars[POISON_TIMER+Character]=MAX_BUFF_TIME;
  962. else{
  963. ElegyVars[POISON_WORK+Character] = (ElegyVars[POISON_WORK+Character]+1)%POISON_INTERVAL;
  964. if(ElegyVars[POISON_WORK]==0){
  965. Game->PlaySound(SFX_OUCH);
  966. ElegyVars[POISON_TIMER+Character]--;
  967. ReSetCurrentHP(Character,(Max_HP(Character)/60),false);
  968. }
  969. if(ElegyVars[POISON_TIMER+Character]<5){
  970. UnSetCharacterStatus(Character,LDB_POISON);
  971. ElegyVars[POISON_TIMER+Character]=0;
  972. }
  973. }
  974. }
  975.  
  976. const int SFX_HEAL = 0;//Sound made when healing.
  977.  
  978. void __UpdateLinkRegen(int Character){
  979. if(ElegyVars[REGEN_TIMER+Character]==0)
  980. ElegyVars[REGEN_TIMER+Character]=MAX_BUFF_TIME;
  981. else{
  982. ElegyVars[REGEN_WORK+Character] = (ElegyVars[REGEN_WORK+Character]+1)%POISON_INTERVAL;
  983. if(ElegyVars[REGEN_WORK+Character]==0){
  984. Game->PlaySound(SFX_HEAL);
  985. ElegyVars[REGEN_TIMER+Character]--;
  986. if(Current_HP(Character)<Max_HP(Character))
  987. ReSetCurrentHP(Character,(Max_HP(Character)/60),true);
  988. else
  989. SetCurrentHP(Character,Max_HP(Character));
  990. }
  991. if(ElegyVars[REGEN_TIMER+Character]<5){
  992. UnSetCharacterStatus(Character,LB_REGEN);
  993. ElegyVars[REGEN_TIMER+Character]=0;
  994. }
  995. }
  996. }
  997.  
  998. const int MAX_STOP_TIME = 180;
  999.  
  1000. void __UpdateLinkStop(int Character){
  1001. if(ElegyVars[STOP_TIMER+Character]==0)
  1002. ElegyVars[STOP_TIMER+Character]=MAX_STOP_TIME;
  1003. else{
  1004. ElegyVars[STOP_TIMER+Character]--;
  1005. CustomNoAction();
  1006. if(ElegyVars[STOP_TIMER+Character]<5){
  1007. UnSetCharacterStatus(Character,LDB_STOP);
  1008. ElegyVars[STOP_TIMER+Character]=0;
  1009. }
  1010. }
  1011. }
  1012.  
  1013. void __UpdateLinkMute(int Character){
  1014. if(ElegyVars[MUTE_TIMER+Character]==0)
  1015. ElegyVars[MUTE_TIMER+Character]=MAX_STOP_TIME;
  1016. else{
  1017. ElegyVars[MUTE_TIMER+Character]--;
  1018. InvertMP(Character);
  1019. if(ElegyVars[MUTE_TIMER+Character]<5){
  1020. UnSetCharacterStatus(Character,LDB_MUTE);
  1021. InvertMP(Character);
  1022. ElegyVars[MUTE_TIMER+Character]=0;
  1023. }
  1024. }
  1025. }
  1026.  
  1027. // to draw while Scrolling
  1028. int scrollDir;
  1029. int scrollCounter;
  1030. int drawX;
  1031. int drawY;
  1032.  
  1033. void ScrollFix(){
  1034. //function by Saffith
  1035. if(Link->Action==LA_SCROLLING){
  1036. if(scrollDir==-1){
  1037. if(Link->Y>160){
  1038. scrollDir=DIR_UP;
  1039. scrollCounter=45;
  1040. }
  1041. else if(Link->Y<0){
  1042. scrollDir=DIR_DOWN;
  1043. scrollCounter=45;
  1044. }
  1045. else if(Link->X>240){
  1046. scrollDir=DIR_LEFT;
  1047. scrollCounter=65;
  1048. }
  1049. else{
  1050. scrollDir=DIR_RIGHT;
  1051. scrollCounter=65;
  1052. }
  1053. }
  1054. if(scrollDir==DIR_UP && scrollCounter<45 && scrollCounter>4)
  1055. drawY+=4;
  1056. else if(scrollDir==DIR_DOWN && scrollCounter<45 && scrollCounter>4)
  1057. drawY-=4;
  1058. else if(scrollDir==DIR_LEFT && scrollCounter<65 && scrollCounter>4)
  1059. drawX+=4;
  1060. else if(scrollDir==DIR_RIGHT && scrollCounter<65 && scrollCounter>4)
  1061. drawX-=4;
  1062. scrollCounter--;
  1063. }
  1064. else{
  1065. drawX=Link->X;
  1066. drawY=Link->Y;
  1067. if(scrollDir!=-1)
  1068. scrollDir=-1;
  1069. }
  1070. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement