Advertisement
Guest User

pls help with errors

a guest
Feb 24th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.28 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <string>
  4. #include <Windows.h>
  5. #include <stdio.h>
  6. #include <mmsystem.h>
  7.  
  8. using namespace std;
  9.  
  10. void Battle(string mob, int level, int beggining){
  11. int monsterhp;
  12. int monsterdamage;
  13. string Opponent;
  14. int PlayerHealth;
  15. int PlayerLevel;
  16. int BattleChoice;
  17. int coins;
  18. string CurrentSword;
  19. string inventory;
  20. int SwordDamage;
  21. string backchoice;
  22. int exp = 0;
  23. int maxexp = 100;
  24. coins = 0;
  25. if (beggining == 1){
  26. PlayerHealth = 100;
  27. PlayerLevel = 1;
  28. CurrentSword = "NoobSword";
  29. SwordDamage = 5;
  30. inventory += "NoobSword";
  31. }
  32. if (mob == "Goblin"){
  33. Opponent = mob;
  34. monsterdamage = 5 * level;
  35. monsterhp = 25 * level;
  36. system("cls");
  37. }
  38. if (mob == "Goblin Boss"){
  39. Opponent = mob;
  40. monsterdamage = 10 * level;
  41. monsterdamage = 20 * level;
  42. monsterhp = 50 * level;
  43. system("cls");
  44. }
  45. while (monsterhp >= 1){
  46. cout << "Coins: " << coins << " Exp: "<< exp << "/" << maxexp;
  47. cout << "\n\nFighting: " << mob << " Level: " << level << " Hp: " << monsterhp << endl;
  48. cout << "____________";
  49. cout << "\n\n1. Attack";
  50. cout << "\n2. Block";
  51. cout << "\n3. Inventory";
  52. cout << "\n4. quit\n";
  53. cout << "____________";
  54. cout << "\nHealth:" << PlayerHealth << "\nLevel:" << PlayerLevel << endl;
  55. cout << "\n\nSword: " << CurrentSword << "\nDamage: " << SwordDamage << "\n\n> ";
  56. cin >> BattleChoice;
  57. if (BattleChoice == 4){
  58. exit(1);
  59. }
  60. else if (BattleChoice == 2) {
  61. system("cls");
  62. cout << "The monster tried to attack you but you blocked it";
  63. Sleep(1500);
  64. cout << "\n\nPlus 5 coins!\n\n";
  65. coins += 5;
  66. Sleep(1500);
  67. system("cls");
  68. system("pause");
  69. }
  70. else if (BattleChoice == 3){
  71. system("cls");
  72. cout << "Inventory:\n\n";
  73. Sleep(0100);
  74. cout << inventory << "\n\n\n";
  75. system("pause");
  76. system("cls");
  77. }
  78. else if (BattleChoice == 1){
  79. system("cls");
  80. cout << "You have attacked the monster";
  81. Sleep(1500);
  82. monsterhp = monsterhp - SwordDamage;
  83. cout << "\n\nThe monster has lost " << SwordDamage << " Health, it now has " << monsterhp << " Health";
  84. Sleep(1500);
  85. cout << "\n\n+5 Experience!";
  86. exp += 5;
  87. Sleep(1500);
  88. cout << "\n\nThe monster attacked you and you lost " << monsterdamage;
  89. PlayerHealth = PlayerHealth - monsterdamage;
  90. Sleep(1500);
  91. system("cls");
  92. if (PlayerHealth <=0) {
  93. cout << "You Have Died";
  94. Sleep(3000);
  95. exit(1);
  96. }
  97. else if (monsterhp <=0) {
  98. cout << "You Have Won The Battle!";
  99. }
  100.  
  101. }
  102. }
  103.  
  104. }
  105. void carvania(){
  106. int gotoc;
  107. cout << "\n__________________";
  108. cout << "\n1. Go to the shop";
  109. cout << "\n2. Quit";
  110. cout << "\n__________________";
  111. cout << "\n\n>";
  112. cin >> gotoc;
  113. if (gotoc == 1){
  114.  
  115. }
  116. else{
  117. exit(1);
  118. }
  119. }
  120.  
  121.  
  122. void scene(int sc) {
  123. string inventory;
  124. if (sc == 1){
  125. int coins = 0;
  126. system("cls");
  127. int PlayChoice;
  128. cout << "Coins:"<< coins;
  129. cout << "\n\nWhere Am I? What am i doing here?";
  130. Sleep(1000);
  131. cout << "\n\nChoices:";
  132. cout << "\n\n1) Standup";
  133. cout << "\n2) Look Behind you";
  134. cout << "\n3) look up";
  135. cout << "\n4) quit\n\n";
  136. cin >> PlayChoice;
  137. if (PlayChoice == 1){
  138. cout << "You Stand up and look around";
  139.  
  140. }
  141. else if (PlayChoice == 2){
  142. cout << "\n\nYou got attacked by a suspicous creature";
  143. cout << "\n You Have Died, Try Again";
  144. Sleep(2000);
  145. system("cls");
  146. cout << "\n\nGAME OVER";
  147. cout << "\nGAME OVER";
  148. cout << "\nGAME OVER";
  149. cout << "\nGAME OVER";
  150. cout << "\nGAME OVER";
  151. cout << "\nGAME OVER";
  152. cout << "\nGAME OVER";
  153. cout << "\nGAME OVER";
  154. cout << "\nGAME OVER";
  155. cout << "\nGAME OVER";
  156. cout << "\nGAME OVER";
  157. Sleep(2000);
  158. exit(1);
  159. }
  160. else if (PlayChoice == 3){
  161. cout << "\n\nYou got attacked by a suspicous creature";
  162. cout << "\n You Have Died, Try Again";
  163. Sleep(2000);
  164. system("cls");
  165. cout << "\n\nGAME OVER";
  166. cout << "\nGAME OVER";
  167. cout << "\nGAME OVER";
  168. cout << "\nGAME OVER";
  169. cout << "\nGAME OVER";
  170. cout << "\nGAME OVER";
  171. cout << "\nGAME OVER";
  172. cout << "\nGAME OVER";
  173. cout << "\nGAME OVER";
  174. cout << "\nGAME OVER";
  175. cout << "\nGAME OVER";
  176. Sleep(2000);
  177. exit(1);
  178. }
  179. else if (PlayChoice == 4){
  180. cout << "\n\nQuiting...";
  181. Sleep(1000);
  182. exit(1);
  183. }
  184. }
  185. else if (sc == 2){
  186. system("cls");
  187. cout << "Y";
  188. Sleep(0300);
  189. system("cls");
  190. cout << "Yo";
  191. Sleep(0300);
  192. system("cls");
  193. cout << "You";
  194. Sleep(0300);
  195. system("cls");
  196. cout << "You l";
  197. Sleep(0300);
  198. system("cls");
  199. cout << "You lo";
  200. Sleep(0300);
  201. system("cls");
  202. cout << "You loo";
  203. Sleep(0300);
  204. system("cls");
  205. cout << "You look";
  206. Sleep(0300);
  207. system("cls");
  208. cout << "You look a";
  209. Sleep(0300);
  210. system("cls");
  211. cout << "You look ar";
  212. Sleep(0300);
  213. system("cls");
  214. cout << "You look aro";
  215. Sleep(0300);
  216. system("cls");
  217. cout << "You look arou";
  218. Sleep(0300);
  219. system("cls");
  220. cout << "You look aroun";
  221. Sleep(0300);
  222. system("cls");
  223. cout << "You look around";
  224. Sleep(0300);
  225. system("cls");
  226. cout << "You look around a";
  227. Sleep(0300);
  228. system("cls");
  229. cout << "You look around an";
  230. Sleep(0300);
  231. system("cls");
  232. cout << "You look around and";
  233. Sleep(0300);
  234. system("cls");
  235. cout << "You look around and r";
  236. Sleep(0300);
  237. system("cls");
  238. cout << "You look around and re";
  239. Sleep(0300);
  240. system("cls");
  241. cout << "You look around and rea";
  242. Sleep(0300);
  243. system("cls");
  244. cout << "You look around and real";
  245. Sleep(0300);
  246. system("cls");
  247. cout << "You look around and realis";
  248. Sleep(0300);
  249. system("cls");
  250. cout << "You look around and realise";
  251. Sleep(0300);
  252. system("cls");
  253. cout << "You look around and realise y";
  254. Sleep(0300);
  255. system("cls");
  256. cout << "You look around and realise yo";
  257. Sleep(0300);
  258. system("cls");
  259. cout << "You look around and realise you";
  260. Sleep(0300);
  261. system("cls");
  262. cout << "You look around and realise your";
  263. Sleep(0300);
  264. system("cls");
  265. cout << "You look around and realise your i";
  266. Sleep(0300);
  267. system("cls");
  268. cout << "You look around and realise your in";
  269. Sleep(0300);
  270. system("cls");
  271. cout << "You look around and realise your in a";
  272. Sleep(0300);
  273. system("cls");
  274. cout << "You look around and realise your in a c";
  275. Sleep(0300);
  276. system("cls");
  277. cout << "You look around and realise your in a ca";
  278. Sleep(0300);
  279. system("cls");
  280. cout << "You look around and realise your in a cav";
  281. Sleep(0300);
  282. system("cls");
  283. cout << "You look around and realise your in a cave";
  284. Sleep(0300);
  285. system("cls");
  286. cout << "You look around and realise your in a cave.";
  287. Sleep(0300);
  288. cout << "\n\nChoices:";
  289. Sleep(0300);
  290. cout << "\n\n1) Go forward";
  291. cout << "\n2) Stay";
  292. cout << "\n3) walk backwards";
  293. cout << "\n4) quit\n\n";
  294. int PlayChoice;
  295. cin >> PlayChoice;
  296. if (PlayChoice == 1 || 2){
  297. string CurrentSword;
  298. int SwordDamage;
  299. Sleep(1500);
  300. system("cls");
  301. cout << "\n\nAn Old Man Approches you...";
  302. Sleep(1500);
  303. cout << "\n\nHello? you say";
  304. Sleep(2500);
  305. cout << "\n\n Hello... I guess that your new around here...\n My name is Gary! i help with many people...";
  306. Sleep(1500);
  307. cout << "\n\n How did i even get here? you asked confused";
  308. Sleep(2500);
  309. cout << "\n\n oh.. that happens to everyone, well anyways, heres a sword\n\nSWORD OBTAINED!\n\n its not that good but it does the job\n You Should go now!";
  310. CurrentSword = "NoobSword";
  311. SwordDamage = 5;
  312. inventory += "\n\nNoobSword";
  313. Sleep(2500);
  314. cout << "\n\nYou walk away having no idea about whats going on..";
  315. Sleep(2500);
  316. cout << "\n\n You look behind you and somehow he wasnt there anymore, Your still really confused but you just go on...\n\n You then walk forward and see that theres two paths.";
  317. Sleep(2500);
  318. cout << "\n\n Which path do you go to?\n\n1) left\n\n2) right\n\n";
  319. cin >> PlayChoice;
  320. if (PlayChoice == 1 || 2){
  321. Sleep(0500);
  322. system("cls");
  323. cout << "\n\nYou Encounter a goblin";
  324. Sleep(0500);
  325. cout << "\n\n You go into battle mode";
  326. Sleep(1000);
  327. Battle("Goblin", 1, 1);
  328. Sleep(1000);
  329. system("cls");
  330.  
  331.  
  332.  
  333. }
  334.  
  335. } else {
  336. cout << "\n\nYou got attacked by a suspicous creature";
  337. cout << "\n You Have Died, Try Again";
  338. Sleep(2000);
  339. system("cls");
  340. cout << "\n\nGAME OVER";
  341. cout << "\nGAME OVER";
  342. cout << "\nGAME OVER";
  343. cout << "\nGAME OVER";
  344. cout << "\nGAME OVER";
  345. cout << "\nGAME OVER";
  346. cout << "\nGAME OVER";
  347. cout << "\nGAME OVER";
  348. cout << "\nGAME OVER";
  349. cout << "\nGAME OVER";
  350. cout << "\nGAME OVER";
  351. Sleep(2000);
  352. exit(1);
  353. }
  354.  
  355. }
  356. else if (sc == 3){
  357. int playchoice3;
  358. cout << "\nYou are thankful that you survived";
  359. cout << "\n\n You then walk forward and see a door";
  360. cout << "\n\nChoices";
  361. cout << "\n\n1) Walk towards the door\n2) stay\n3) quit\n\n"; // WORKING ON THIS PART DOOOOOOOOOOOOOOD
  362. cin >> playchoice3;
  363. if (playchoice3 == 1 || 2){
  364. cout << "\n\nOut of nowhere the doors open and you see\n a city with all kinds of colors and stores\n\n You then walk in an meet gary, he then says\nOh sorry for talking so fast over there, i was just in a hurry, im sorry i couldnt tell you about this place\n\n";
  365. Sleep(3000);
  366. cout << "Then you look angry and relieved so you say,";
  367. Sleep(3000);
  368. cout << "\nWhat is this town?";
  369. Sleep(1000);
  370. cout << "\n\nThen gary says";
  371. Sleep(1000);
  372. cout << "\nOh this is called carvania, Its really populated, and fun things to do, I reccomend you going to a shop, Your sword isnt good enough for all of the monsters ahead of you.\n\n";
  373. system("pause");
  374. system("cls");
  375.  
  376. }
  377. else if (playchoice3 == 3{
  378. exit(1);
  379. }
  380. }
  381.  
  382. void LoadingScreen(){
  383. int load = rand() % (2000 + 1 - 0400) + 0400;
  384. system("cls");
  385. cout << "\n\nText Adventure: The Cave" << endl;
  386. cout << "Made By: Daniel C." << endl;
  387. cout << "\n\n #####################";
  388. cout << "\n | |";
  389. cout << "\n #####################";
  390. Sleep(load);
  391. system("cls");
  392. load = rand() % (2000 + 1 - 0400) + 0400;
  393. cout << "\n\nText Adventure: The Cave" << endl;
  394. cout << "Made By: Daniel C." << endl;
  395. cout << "\n\n #####################";
  396. cout << "\n |- |";
  397. cout << "\n #####################";
  398. Sleep(load);
  399. system("cls");
  400. load = rand() % (2000 + 1 - 0400) + 0400;
  401. cout << "\n\nText Adventure: The Cave" << endl;
  402. cout << "Made By: Daniel C." << endl;
  403. cout << "\n\n #####################";
  404. cout << "\n |-- |";
  405. cout << "\n #####################";
  406. Sleep(load);
  407. system("cls");
  408. load = rand() % (2000 + 1 - 0400) + 0400;
  409. cout << "\n\nText Adventure: The Cave" << endl;
  410. cout << "Made By: Daniel C." << endl;
  411. cout << "\n\n #####################";
  412. cout << "\n |--- |";
  413. cout << "\n #####################";
  414. Sleep(load);
  415. system("cls");
  416. load = rand() % (2000 + 1 - 0400) + 0400;
  417. cout << "\n\nText Adventure: The Cave" << endl;
  418. cout << "Made By: Daniel C." << endl;
  419. cout << "\n\n #####################";
  420. cout << "\n |---- |";
  421. cout << "\n #####################";
  422. Sleep(load);
  423. system("cls");
  424. load = rand() % (2000 + 1 - 0400) + 0400;
  425. cout << "\n\nText Adventure: The Cave" << endl;
  426. cout << "Made By: Daniel C." << endl;
  427. cout << "\n\n #####################";
  428. cout << "\n |----- |";
  429. cout << "\n #####################";
  430. Sleep(load);
  431. system("cls");
  432. load = rand() % (2000 + 1 - 0400) + 0400;
  433. cout << "\n\nText Adventure: The Cave" << endl;
  434. cout << "Made By: Daniel C." << endl;
  435. cout << "\n\n #####################";
  436. cout << "\n |------ |";
  437. cout << "\n #####################";
  438. Sleep(load);
  439. system("cls");
  440. load = rand() % (2000 + 1 - 0400) + 0400;
  441. cout << "\n\nText Adventure: The Cave" << endl;
  442. cout << "Made By: Daniel C." << endl;
  443. cout << "\n\n #####################";
  444. cout << "\n |------- |";
  445. cout << "\n #####################";
  446. Sleep(load);
  447. system("cls");
  448. load = rand() % (2000 + 1 - 0400) + 0400;
  449. cout << "\n\nText Adventure: The Cave" << endl;
  450. cout << "Made By: Daniel C." << endl;
  451. cout << "\n\n #####################";
  452. cout << "\n |------- |";
  453. cout << "\n #####################";
  454. Sleep(load);
  455. system("cls");
  456. load = rand() % (2000 + 1 - 0400) + 0400;
  457. cout << "\n\nText Adventure: The Cave" << endl;
  458. cout << "Made By: Daniel C." << endl;
  459. cout << "\n\n #####################";
  460. cout << "\n |-------- |";
  461. cout << "\n #####################";
  462. Sleep(load);
  463. system("cls");
  464. load = rand() % (2000 + 1 - 0400) + 0400;
  465. cout << "\n\nText Adventure: The Cave" << endl;
  466. cout << "Made By: Daniel C." << endl;
  467. cout << "\n\n #####################";
  468. cout << "\n |----------- |";
  469. cout << "\n #####################";
  470. Sleep(load);
  471. system("cls");
  472. load = rand() % (2000 + 1 - 0400) + 0400;
  473. cout << "\n\nText Adventure: The Cave" << endl;
  474. cout << "Made By: Daniel C." << endl;
  475. cout << "\n\n #####################";
  476. cout << "\n |------------ |";
  477. cout << "\n #####################";
  478. Sleep(load);
  479. system("cls"); // HERE DOOOOOOOOOD
  480. load = rand() % (2000 + 1 - 0400) + 0400;
  481. cout << "\n\nText Adventure: The Cave" << endl;
  482. cout << "Made By: Daniel C." << endl;
  483. cout << "\n\n #####################";
  484. cout << "\n |------------- |";
  485. cout << "\n #####################";
  486. Sleep(load);
  487. system("cls");
  488. load = rand() % (2000 + 1 - 0400) + 0400;
  489. cout << "\n\nText Adventure: The Cave" << endl;
  490. cout << "Made By: Daniel C." << endl;
  491. cout << "\n\n #####################";
  492. cout << "\n |------------- |";
  493. cout << "\n #####################";
  494. Sleep(load);
  495. system("cls");
  496. load = rand() % (2000 + 1 - 0400) + 0400;
  497. cout << "\n\nText Adventure: The Cave" << endl;
  498. cout << "Made By: Daniel C." << endl;
  499. cout << "\n\n #####################";
  500. cout << "\n |--------------- |";
  501. cout << "\n #####################";
  502. Sleep(load);
  503. system("cls");
  504. load = rand() % (2000 + 1 - 0400) + 0400;
  505. cout << "\n\nText Adventure: The Cave" << endl;
  506. cout << "Made By: Daniel C." << endl;
  507. cout << "\n\n #####################";
  508. cout << "\n |----------------- |";
  509. cout << "\n #####################";
  510. Sleep(load);
  511. system("cls");
  512. load = rand() % (2000 + 1 - 0400) + 0400;
  513. cout << "\n\nText Adventure: The Cave" << endl;
  514. cout << "Made By: Daniel C." << endl;
  515. cout << "\n\n #####################";
  516. cout << "\n |-------------------|";
  517. cout << "\n #####################";
  518. Sleep(load);
  519. system("cls");
  520. cout << "Loaded!";
  521. }
  522.  
  523.  
  524. void startup(){
  525. system("cls");
  526. cout << "LOADING PROGRAM";
  527. Sleep(0700);
  528. cout << ".";
  529. Sleep(0700);
  530. cout << ".";
  531. Sleep(0700);
  532. cout << ".";
  533. Sleep(0700);
  534. cout << ".";
  535. Sleep(0700);
  536. system("cls");
  537. cout << "LOADING PROGRAM";
  538. Sleep(0700);
  539. cout << ".";
  540. Sleep(0700);
  541. cout << ".";
  542. Sleep(0700);
  543. cout << ".";
  544. Sleep(0700);
  545. cout << ".";
  546. Sleep(0700);
  547. system("cls");
  548. system("cls");
  549. cout << "LOADING PROGRAM";
  550. Sleep(0700);
  551. cout << ".";
  552. Sleep(0700);
  553. cout << ".";
  554. Sleep(0700);
  555. cout << ".";
  556. Sleep(0700);
  557. cout << ".";
  558. Sleep(0700);
  559. system("cls");
  560. cout << "LOADING PROGRAM";
  561. Sleep(0700);
  562. cout << ".";
  563. Sleep(0700);
  564. cout << ".";
  565. Sleep(0700);
  566. cout << ".";
  567. Sleep(0700);
  568. cout << ".";
  569. Sleep(0700);
  570. system("cls");
  571. cout << "FINISHED LOADING";
  572. }
  573.  
  574. int main() {
  575.  
  576. string choice;
  577. cout << "Start\nQuit\nplay music\n\n";
  578. cin >> choice;
  579. if (choice == "start"){
  580.  
  581. startup();
  582. Sleep(0500);
  583. LoadingScreen();
  584. Sleep(0500);
  585. scene(1);
  586. Sleep(0500);
  587. scene(2);
  588. Sleep(0500);
  589. system("cls");
  590. scene(3);
  591.  
  592. }
  593. else if (choice == "quit"){
  594. exit(1);
  595. }
  596. else if (choice == "skip"){
  597. scene(1);
  598. Sleep(0500);
  599. scene(2);
  600. Sleep(0500);
  601. scene(3);
  602. }
  603.  
  604.  
  605. return 0;
  606. }
  607. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement