Advertisement
Guest User

Doom RPG Example

a guest
Dec 25th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #library "COMMONFU"
  2. #include "zcommon.acs"
  3.  
  4. global int 1:player_level;
  5. global int 2:player_exp;
  6. global int 3:player_next;
  7. global int 4:player_mhp;
  8. global int 5:ammo_bulletmax;
  9. global int 6:ammo_shellmax;
  10. global int 7:ammo_rocketmax;
  11. global int 8:ammo_cellmax;
  12. global int 9:setupscript;
  13. global int 10:backpackcount;
  14.  
  15. script "firstsetup" ENTER
  16. {
  17. if(setupscript==0)
  18. {
  19.    delay(1);
  20.    player_level = 1;
  21.    player_exp = 0;
  22.    player_next = 120;
  23.    player_mhp = 100;
  24.    ammo_bulletmax = 200;
  25.    ammo_shellmax = 50;
  26.    ammo_rocketmax = 50;
  27.    ammo_cellmax = 300;
  28.    backpackcount = 0;
  29.    setupscript++;
  30.    hudmessage(s:"Press C to open player stats."; HUDMSG_TYPEON | HUDMSG_LOG, 0,
  31.    CR_WHITE, 5.0, 5.0, 5.0);
  32. }
  33. else
  34. {
  35.    delay(1);
  36.    acs_terminate("firstsetup", 0);
  37. }}
  38.  
  39. script "gain_xp" (int s_arg0)
  40. {
  41. player_exp += s_arg0;
  42. printbold(s:"+", d:s_arg0, s:"EXP");
  43. if(player_exp>=player_next)
  44. {
  45.    delay(1);
  46.    acs_namedexecutewithresult("gain_level", 0, 0, 0, 0);
  47. }
  48. }
  49.  
  50. script "gain_level" (void)
  51. {
  52. int temphpgain = random(1,24);
  53. int tempbulgain = random(1,14);
  54. int tempshellgain = random(1,6);
  55. int temprocgain = random(1,3);
  56. int tempcellgain = random(1, 21);acs_terminate("firstsetup", 0);
  57. player_level++;
  58. player_next = player_next + 255 + ((player_level * 256) / 200);
  59. player_mhp = player_mhp + temphpgain;
  60. ammo_bulletmax = ammo_bulletmax + tempbulgain;
  61. ammo_shellmax = ammo_shellmax + tempshellgain;
  62. ammo_rocketmax = ammo_rocketmax + temprocgain;
  63. ammo_cellmax = ammo_cellmax + tempcellgain;
  64. SetActorProperty(0, APROP_SPAWNHEALTH, (GetActorProperty(0, APROP_SPAWNHEALTH) + temphpgain));
  65. SetActorProperty(0, APROP_HEALTH, (GetActorProperty(0, APROP_HEALTH) + temphpgain));
  66. SetAmmoCapacity("Clip", (GetAmmoCapacity("Clip") + tempbulgain));
  67. SetAmmoCapacity("Shell", (GetAmmoCapacity("Shell") + tempshellgain));
  68. SetAmmoCapacity("RocketAmmo", (GetAmmoCapacity("RocketAmmo") + temprocgain));
  69. SetAmmoCapacity("Cell", (GetAmmoCapacity("Cell") + tempcellgain));
  70. hudmessage(s:"LEVEL UP! Your level went up to ", d:player_level; HUDMSG_FADEINOUT | HUDMSG_LOG,
  71. 0, CR_RED, 0.25, 0.4, 5.0);
  72. delay(30);
  73. hudmessage(s:"Your Max HP is now ", d:player_mhp; HUDMSG_FADEINOUT | HUDMSG_LOG,
  74. 1, CR_BLUE, 0.25, 0.45, 5.0);
  75. delay(15);
  76. hudmessage(s:"Your Max Bullet Capacity is now ", d:ammo_bulletmax; HUDMSG_FADEINOUT | HUDMSG_LOG,
  77. 2, CR_BLUE, 0.25, 0.5, 5.0);
  78. delay(15);
  79. hudmessage(s:"Your Max Shell Capacity is now ", d:ammo_shellmax; HUDMSG_FADEINOUT | HUDMSG_LOG,
  80. 3, CR_BLUE, 0.25, 0.55, 5.0);
  81. delay(15);
  82. hudmessage(s:"Your Max Rocket Capacity is now ", d:ammo_rocketmax; HUDMSG_FADEINOUT | HUDMSG_LOG,
  83. 4, CR_BLUE, 0.25, 0.6, 5.0);
  84. delay(15);
  85. hudmessage(s:"Your Max Cell Capacity is now ", d:ammo_cellmax; HUDMSG_FADEINOUT | HUDMSG_LOG,
  86. 5, CR_BLUE, 0.25, 0.65, 5.0);
  87. }
  88.  
  89. script "show_stats" (void)
  90. {
  91. hudmessage(s:"Stats: Level ", d:player_level; HUDMSG_FADEINOUT,
  92. 6, CR_RED, 0.8, 0.25, 5.0);
  93. hudmessage(s:"Max HP: ", d:player_mhp; HUDMSG_FADEINOUT,
  94. 7, CR_RED, 0.7, 0.3, 5.0);
  95. hudmessage(s:"Bullet Ammo: ", d:ammo_bulletmax; HUDMSG_FADEINOUT,
  96. 8, CR_RED, 0.7, 0.35, 5.0);
  97. hudmessage(s:"Shell Ammo: ", d:ammo_shellmax; HUDMSG_FADEINOUT,
  98. 9, CR_RED, 0.7, 0.4, 5.0);
  99. hudmessage(s:"Rocket Ammo: ", d:ammo_rocketmax; HUDMSG_FADEINOUT,
  100. 10, CR_RED, 0.7, 0.45, 5.0);
  101. hudmessage(s:"Cell Ammo: ", d:ammo_cellmax; HUDMSG_FADEINOUT,
  102. 11, CR_RED, 0.7, 0.5, 5.0);
  103. hudmessage(s:"EXP: ", d:player_exp, s:" / ", d:player_next; HUDMSG_FADEINOUT,
  104. 12, CR_RED, 0.7, 0.55, 5.0);
  105. }
  106.  
  107. script "obtain_backpack" (void)
  108. {
  109. if(backpackcount==0){
  110. delay(5);
  111. ammo_bulletmax+=200;
  112. ammo_shellmax+=50;
  113. ammo_rocketmax+=50;
  114. ammo_cellmax+=300;
  115. SetAmmoCapacity("Clip", (GetAmmoCapacity("Clip") + 200));
  116. SetAmmoCapacity("Shell", (GetAmmoCapacity("Shell") + 50));
  117. SetAmmoCapacity("RocketAmmo", (GetAmmoCapacity("RocketAmmo") + 50));
  118. SetAmmoCapacity("Cell", (GetAmmoCapacity("Cell") + 300));
  119. backpackcount++;
  120. }
  121. else{
  122. GiveInventory("Clip", 20);
  123. GiveInventory("Shell", 8);
  124. GiveInventory("RocketAmmo", 5);
  125. GiveInventory("Cell", 40);
  126. }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement