Dabar yra 2018 Lap 20 23:32

Visos datos yra UTC + 2 valandos


Forumo taisyklės


Šiame forume galite siūlyti idėjas ar prašyti jums reikalingų pluginų. Jei kas nors pradės jį kurti, tai pasirašys Jūsų sukurtoje temoje. Niekada nepykite, jei niekas neatsako į Jūsų prašymą. Gal tai tiesiog per sudėtinga, arba reikalauja per daug darbo.



 Puslapis 11 [ 1 pranešimas ] 
Autorius Žinutė
 Pranešimo tema: Fix Mega Boss ZP 4.3
Žinutės numeris: #1  StandartinėParašytas: 2018 Kov 03 19:20 
O taip. Jis jau surinko 50 žinučių!

Užsiregistravo: 2016 Spa 21 18:47
Pranešimai: 59
Karma: 0
The Bug is when his HP is empty he will not die, how is that possible? can anyone fix that ? It should be for zombie plague 4.3 6a fix.

  1. #include < amxmodx >
  2. #include < amxmisc >
  3. #include < engine >
  4. #include < fakemeta >
  5. #include < hamsandwich >
  6. #include < xs >
  7.  
  8. #define NAME "AlienBoss Special For Zombie-Mod.Ru"
  9. #define VERSION "Public"
  10. #define AUTHOR "Alexander.3 / Edit: Optimist"
  11.  
  12. const alien_hp = 25000
  13. const boss_speed = 200
  14. const Float:prepare_time = 15.0
  15. const dmg_attack = 50
  16. const dmg_ms = 50
  17. const dmg_sw = 50
  18.  
  19. static Float:Origin[3]
  20.  
  21. static g_Alien
  22. static g_BossTarget
  23. static VictimID
  24. static Float:g_Health
  25.  
  26. static Ability
  27.  
  28. new const Resource[][] = {
  29. "models/npc/alien/alien.mdl",
  30. "sprites/blood.spr",
  31. "sprites/bloodspray.spr",
  32. "sprites/npc/hp.spr",
  33. "sprites/shockwave.spr", // 4
  34. "sprites/npc/alien/fluxing.spr" // 5
  35. }
  36. new const g_AlienSound[][] =
  37. {
  38. "zombie_plague/boss_death.wav",
  39. "zombie_plague/boss_dash.wav",
  40. "zombie_plague/boss_swing.wav",
  41. "zombie_plague/boss_shokwave.wav"
  42. }
  43.  
  44. new const g_CountSound[][] =
  45. {
  46. "zombie_plague/vox/1.wav",
  47. "zombie_plague/vox/2.wav",
  48. "zombie_plague/vox/3.wav",
  49. "zombie_plague/vox/4.wav",
  50. "zombie_plague/vox/5.wav",
  51. "zombie_plague/vox/6.wav",
  52. "zombie_plague/vox/7.wav",
  53. "zombie_plague/vox/8.wav",
  54. "zombie_plague/vox/9.wav",
  55. "zombie_plague/vox/10.wav"
  56. }
  57.  
  58. static g_Resource[sizeof Resource]
  59.  
  60. enum {
  61. IDLE,
  62. WALK,
  63. MS,
  64. ATTACK,
  65. SW
  66. }
  67.  
  68. public plugin_precache()
  69. {
  70. new i;
  71. for(i = 0 ; i < sizeof g_CountSound ; i++)
  72. precache_sound(g_CountSound[i]);
  73.  
  74. for(i = 0 ; i < sizeof g_AlienSound ; i++)
  75. precache_sound(g_AlienSound[i]);
  76.  
  77. for(new i; i <= charsmax(Resource); i++)
  78. g_Resource[i] = precache_model(Resource[i])
  79. }
  80.  
  81. public plugin_init() {
  82. register_plugin(NAME, VERSION, AUTHOR)
  83.  
  84. register_clcmd("say /create", "create", ADMIN_RCON)
  85. register_clcmd("say /spawn", "spawn", ADMIN_RCON)
  86.  
  87. register_think("AlienBossik", "Think_Boss")
  88. register_think("HP", "Think_HP")
  89.  
  90. register_touch("AlienBossik", "player", "Touch_Boss")
  91.  
  92. RegisterHam(Ham_TakeDamage, "info_target", "TakeDamage", ADMIN_RCON)
  93. RegisterHam(Ham_TraceAttack, "info_target", "TraceAttack", ADMIN_RCON)
  94. }
  95.  
  96. public RandomAbility(taskid) {
  97. if (Ability != WALK)
  98. return
  99.  
  100. switch(random(2)) {
  101. case 0: Ability = MS
  102. case 1: Ability = SW
  103. }
  104. }
  105.  
  106. public create(id)
  107. if (get_user_flags(id) & ADMIN_RCON)
  108. {
  109. pev(id, pev_origin, Origin)
  110. }
  111.  
  112. public spawn(id)
  113. {
  114. if (get_user_flags(id) & ADMIN_RCON)
  115. {
  116. g_Alien = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  117. new HPspr = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  118.  
  119. engfunc(EngFunc_SetModel, g_Alien, Resource[0])
  120. engfunc(EngFunc_SetSize, g_Alien, { -32.0, -32.0, -36.0 }, { 32.0, 32.0, 96.0 })
  121. engfunc(EngFunc_SetOrigin, g_Alien, Origin)
  122.  
  123. set_pev(g_Alien, pev_classname, "AlienBossik")
  124. set_pev(g_Alien, pev_solid, SOLID_BBOX)
  125. set_pev(g_Alien, pev_movetype, MOVETYPE_PUSHSTEP)
  126. set_pev(g_Alien, pev_takedamage, DAMAGE_NO)
  127. set_pev(g_Alien, pev_health, float(alien_hp))
  128. set_pev(g_Alien, pev_deadflag, DEAD_NO)
  129. set_pev(g_Alien, pev_nextthink, get_gametime() + prepare_time)
  130.  
  131. Ability = IDLE
  132. Anim(g_Alien, 2)
  133.  
  134. static Float:Origin[3]
  135. pev(g_Alien, pev_origin, Origin)
  136. Origin[2] += 200.0
  137. engfunc(EngFunc_SetOrigin, HPspr, Origin)
  138. engfunc(EngFunc_SetModel, HPspr, Resource[3])
  139. entity_set_float(HPspr, EV_FL_scale, 0.5)
  140. set_pev(HPspr, pev_classname, "HP")
  141. set_pev(HPspr, pev_solid, SOLID_NOT)
  142. set_pev(HPspr, pev_movetype, MOVETYPE_NOCLIP)
  143. set_pev(HPspr, pev_frame, 100.0)
  144. set_pev(HPspr, pev_nextthink, get_gametime() + prepare_time)
  145. }
  146. }
  147.  
  148. public Think_Boss(Ent)
  149. {
  150. if (pev(Ent, pev_deadflag) == DEAD_DYING)
  151. return
  152.  
  153. static bool:one
  154.  
  155. switch ( Ability ) {
  156. case IDLE: {
  157. Ability = WALK
  158. set_task(10.0, "RandomAbility", 1337, _, _, "b")
  159. set_pev(Ent, pev_nextthink, get_gametime() + 0.1)
  160. return
  161. }
  162. case WALK: {
  163. static Float:Origin[3], Float:Origin2[3], Float:Vector[3], Float:Angle[3]
  164. if (!is_user_alive(g_BossTarget)) {
  165. g_BossTarget = GetRandomAlive(random_num(1, GetAliveCount()))
  166. set_pev(Ent, pev_nextthink, get_gametime() + 0.1)
  167. return
  168. }
  169. if (one) {
  170. set_pev(Ent, pev_movetype, MOVETYPE_PUSHSTEP)
  171. Anim(Ent, 3)
  172. one = false
  173. }
  174. pev(Ent, pev_origin, Origin)
  175. pev(g_BossTarget, pev_origin, Origin2)
  176.  
  177. xs_vec_sub(Origin2, Origin, Vector)
  178. vector_to_angle(Vector, Angle)
  179. new Float:num = floatsqroot(float(boss_speed)*float(boss_speed) / (Vector[0]*Vector[0] + Vector[1]*Vector[1] + Vector[2]*Vector[2]))
  180. Vector[0] *= num
  181. Vector[1] *= num
  182. Vector[2] ? (Vector[2] = 0.0) : (Vector[2] *= num)
  183. set_pev(Ent, pev_velocity, Vector)
  184. Angle[0] = 0.0
  185. Angle[2] = 0.0
  186. set_pev(Ent, pev_angles, Angle)
  187. set_pev(Ent, pev_nextthink, get_gametime() + 0.1)
  188. return
  189. }
  190. case ATTACK: {
  191. static num
  192. switch (num) {
  193. case 0: {
  194. Anim(Ent, 6)
  195. num++
  196. set_pev(Ent, pev_nextthink, get_gametime() + 1.0)
  197. return
  198. }
  199. case 1: {
  200. static Float:OriginA[3], Float:OriginA2[3], Float:LenA, Float:Vector[3], Float:Velocity[3]
  201.  
  202. pev(g_Alien, pev_origin, OriginA)
  203. pev(VictimID, pev_origin, OriginA2)
  204.  
  205. xs_vec_sub(OriginA2, OriginA, Velocity)
  206. xs_vec_sub(OriginA, OriginA2, Vector)
  207.  
  208. LenA = xs_vec_len(Vector)
  209.  
  210. if (LenA <= 170) {
  211. xs_vec_normalize(Velocity, Velocity)
  212. Velocity[2] = 0.5
  213. xs_vec_mul_scalar(Velocity, 1000.0, Velocity)
  214. ExecuteHamB(Ham_TakeDamage, VictimID, 0, VictimID, float(dmg_attack), DMG_BULLET)
  215. ScreenFade(VictimID, 3, {255, 0, 0}, 120)
  216. ScreenShake(VictimID)
  217. set_pev(VictimID, pev_velocity, Velocity)
  218. emit_sound(Ent, CHAN_VOICE, g_AlienSound[2], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  219. }
  220. }
  221. }
  222. num = 0
  223. one = true
  224. Ability = WALK
  225. set_pev(Ent, pev_nextthink, get_gametime() + 0.2)
  226. }
  227. case MS: {
  228. static num, Float:Origin[3], Float:Origin2[3], Float:Vector[3], Float:Angle[3]
  229. switch ( num ) {
  230. case 0: {
  231. new MS_Attack = GetRandomAlive(random_num(1, GetAliveCount()))
  232.  
  233. pev(MS_Attack, pev_origin, Origin)
  234. pev(Ent, pev_origin, Origin2)
  235.  
  236. xs_vec_sub(Origin, Origin2, Vector)
  237. vector_to_angle(Vector, Angle)
  238. xs_vec_normalize(Vector, Vector)
  239. xs_vec_mul_scalar(Vector, 2000.0, Vector)
  240. Angle[0] = 0.0
  241. Angle[2] = 0.0
  242. Vector[2] = 0.0
  243. set_pev(Ent, pev_angles, Angle)
  244. set_pev(Ent, pev_movetype, MOVETYPE_NONE)
  245. Anim(Ent, 7)
  246. set_pev(Ent, pev_nextthink, get_gametime() + 1.0)
  247. num++
  248. return
  249. }
  250. case 1: {
  251. set_pev(Ent, pev_movetype, MOVETYPE_FLY)
  252. set_pev(Ent, pev_velocity, Vector)
  253. set_pev(Ent, pev_nextthink, get_gametime() + 1.0)
  254. num++
  255. return
  256. }
  257. }
  258. set_pev(Ent, pev_nextthink, get_gametime() + 0.1)
  259. num = 0
  260. Ability = WALK
  261. one = true
  262. return
  263. }
  264. case SW: {
  265. static num, FluxSpr, Float:Origin[3], sw_random
  266. switch ( num ) {
  267. case 0: {
  268. sw_random = random(3)
  269. Anim(Ent, 2)
  270. FluxSpr = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
  271. pev(Ent, pev_origin, Origin)
  272. Origin[2] += 70
  273. engfunc(EngFunc_SetOrigin, FluxSpr, Origin)
  274. engfunc(EngFunc_SetModel, FluxSpr, Resource[5])
  275. set_pev(FluxSpr, pev_solid, SOLID_NOT)
  276. set_pev(FluxSpr, pev_movetype, MOVETYPE_NOCLIP)
  277. switch(sw_random) {
  278. case 0: {
  279. set_rendering(FluxSpr, kRenderFxFadeSlow, 255, 0, 0, kRenderTransAdd, 255)
  280. set_rendering(Ent, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 30)
  281. }
  282. case 1: {
  283. set_rendering(FluxSpr, kRenderFxFadeSlow, 255, 255, 0, kRenderTransAdd, 255)
  284. set_rendering(Ent, kRenderFxGlowShell, 255, 255, 0, kRenderNormal, 30)
  285. }
  286. case 2: {
  287. set_rendering(FluxSpr, kRenderFxFadeSlow, 0, 0, 255, kRenderTransAdd, 255)
  288. set_rendering(Ent, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 30)
  289. }
  290. }
  291. set_pev(FluxSpr, pev_framerate, 5.0)
  292. dllfunc(DLLFunc_Spawn, FluxSpr)
  293. set_pev(Ent, pev_nextthink, get_gametime() + 0.1)
  294. num++
  295. return
  296. }
  297. case 1..10: {
  298. for(new id = 1; id <= get_maxplayers(); id++) {
  299. if (!is_user_alive(id))
  300. continue
  301.  
  302. static Float:OriginSW[3], Float:OriginSW2[3], Float:Vector[3]
  303. pev(Ent, pev_origin, OriginSW)
  304. pev(id, pev_origin, OriginSW2)
  305.  
  306. xs_vec_sub(OriginSW, OriginSW2, Vector)
  307. xs_vec_normalize(Vector, Vector)
  308. xs_vec_mul_scalar(Vector, 800.0, Vector)
  309. set_pev(id, pev_velocity, Vector)
  310. set_pev(Ent, pev_nextthink, get_gametime() + 0.2)
  311. num++
  312. return
  313. }
  314. }
  315. case 11: {
  316. engfunc(EngFunc_RemoveEntity, FluxSpr)
  317. Anim(Ent, 5)
  318. set_pev(Ent, pev_nextthink, get_gametime() + 2.2)
  319. num++
  320. return
  321. }
  322. case 12: {
  323. static Float:Orig[3]
  324. pev(Ent, pev_origin, Orig)
  325. set_rendering(Ent)
  326.  
  327. switch (sw_random) {
  328. case 0: ShockWave(Orig, 5, 35, 1000.0, {255, 0, 0}) // 450
  329. case 1: ShockWave(Orig, 5, 35, 1000.0, {255, 255, 0})
  330. case 2: ShockWave(Orig, 5, 35, 1000.0, {0, 0, 255})
  331. }
  332.  
  333. for(new id = 1; id <= get_maxplayers(); id++) {
  334. if (!is_user_alive(id))
  335. continue
  336.  
  337. if (pev(id, pev_flags) & FL_ONGROUND) {
  338. static Float:gOrigin[3], Float:Vec[3], Float:Len
  339. pev(id, pev_origin, gOrigin)
  340. xs_vec_sub(Orig, gOrigin, Vec)
  341. Len = xs_vec_len(Vec)
  342. if (Len <= 450.0) {
  343. switch (sw_random) {
  344. case 0: user_kill(id)
  345. case 1: {
  346. ScreenFade(id, 5, {255, 0, 0}, 120)
  347. ExecuteHamB(Ham_TakeDamage, id, 0, id, float(dmg_sw), DMG_SONIC)
  348. ScreenShake(id)
  349. }
  350. case 2: {
  351. client_cmd(id, "drop")
  352. ScreenShake(id)
  353. }
  354. }
  355. }
  356. }
  357. }
  358. Ability = WALK
  359. one = true
  360. num = 0
  361. set_pev(Ent, pev_nextthink, get_gametime() + 0.2)
  362. return
  363. }
  364. }
  365. }
  366. }
  367. }
  368.  
  369. public Think_HP(Ent) {
  370. static Float:Origin[3], num
  371. pev(g_Alien, pev_origin, Origin)
  372. Origin[2] += 200.0
  373. set_pev(Ent, pev_origin, Origin)
  374.  
  375. switch ( num ) {
  376. case 0: {
  377. Anim(g_Alien, 3)
  378. set_pev(g_Alien, pev_takedamage, DAMAGE_YES)
  379. num++
  380. }
  381. case 1: {
  382. static Float:frame
  383. frame = g_Health * 100.0 / float(alien_hp)
  384.  
  385. if (frame)
  386. set_pev(Ent, pev_frame, frame)
  387.  
  388. if (pev(g_Alien, pev_deadflag) == DEAD_DYING) {
  389. engfunc(EngFunc_RemoveEntity, Ent)
  390. return
  391. }
  392. }
  393. }
  394. set_pev(Ent, pev_nextthink, get_gametime() + 0.1)
  395. }
  396.  
  397. public TraceAttack(victim, attacker, Float:damage, Float:direction[3], th, dt) {
  398. static Float:End[3], ClassName[32]
  399. pev(victim, pev_classname, ClassName, charsmax(ClassName))
  400. if (equal(ClassName, "AlienBossik")) {
  401. get_tr2(th, TR_vecEndPos, End)
  402. Blood(End)
  403. }
  404. }
  405.  
  406. public TakeDamage(victim, weapon, attacker, Float:damage, damagetype) {
  407. static ClassName[32]
  408. pev(victim, pev_classname, ClassName, charsmax(ClassName))
  409. if (equal(ClassName, "AlienBossik")) {
  410. pev(victim, pev_health, g_Health)
  411. if (g_Health <= damage) {
  412. Anim(victim, 1)
  413. set_pev(victim, pev_movetype, MOVETYPE_FLY)
  414. set_pev(victim, pev_solid, SOLID_NOT)
  415. set_pev(victim, pev_velocity, {0.0, 0.0, 0.0})
  416. set_pev(victim, pev_deadflag, DEAD_DYING)
  417. remove_task(1337)
  418. return HAM_SUPERCEDE
  419. }
  420. }
  421. return HAM_HANDLED
  422. }
  423.  
  424. public Touch_Boss(Ent, WorldEnt) {
  425. if (Ability == MS) {
  426. static victim = -1, Float:Origin[3]
  427. pev(Ent, pev_origin, Origin)
  428. while((victim = engfunc(EngFunc_FindEntityInSphere, victim, Origin, 400.0)) != 0) {
  429. if (!is_user_alive(victim))
  430. continue
  431.  
  432. ExecuteHamB(Ham_TakeDamage, victim, 0, victim, float(dmg_ms), DMG_BULLET)
  433. }
  434. }
  435.  
  436. if (Ability == WALK) {
  437. Ability = ATTACK
  438. VictimID = WorldEnt
  439. }
  440. }
  441.  
  442. stock Blood(Float:Orig[3]) {
  443. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  444. write_byte(TE_BLOODSPRITE);
  445. engfunc(EngFunc_WriteCoord, Orig[0])
  446. engfunc(EngFunc_WriteCoord, Orig[1])
  447. engfunc(EngFunc_WriteCoord, Orig[2])
  448. write_short(g_Resource[1])
  449. write_short(g_Resource[2])
  450. write_byte(218)
  451. write_byte(random_num(1, 2))
  452. message_end();
  453. }
  454.  
  455.  
  456. stock Anim(ent, sequence) {
  457. set_pev(ent, pev_sequence, sequence)
  458. set_pev(ent, pev_animtime, halflife_time())
  459. set_pev(ent, pev_framerate, 1.0)
  460. }
  461.  
  462. stock ShockWave(Float:Orig[3], Life, Width, Float:Radius, Color[3]) {
  463. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Orig, 0)
  464. write_byte(TE_BEAMCYLINDER) // TE id
  465. engfunc(EngFunc_WriteCoord, Orig[0]) // x
  466. engfunc(EngFunc_WriteCoord, Orig[1]) // y
  467. engfunc(EngFunc_WriteCoord, Orig[2]-40.0) // z
  468. engfunc(EngFunc_WriteCoord, Orig[0]) // x axis
  469. engfunc(EngFunc_WriteCoord, Orig[1]) // y axis
  470. engfunc(EngFunc_WriteCoord, Orig[2]+Radius) // z axis
  471. write_short(g_Resource[4]) // sprite
  472. write_byte(0) // startframe
  473. write_byte(0) // framerate
  474. write_byte(Life) // life (4)
  475. write_byte(Width) // width (20)
  476. write_byte(0) // noise
  477. write_byte(Color[0]) // red
  478. write_byte(Color[1]) // green
  479. write_byte(Color[2]) // blue
  480. write_byte(255) // brightness
  481. write_byte(0) // speed
  482. message_end()
  483. }
  484.  
  485. stock ScreenFade(id, Timer, Colors[3], Alpha) {
  486. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenFade"), _, id);
  487. write_short((1<<12) * Timer)
  488. write_short(1<<12)
  489. write_short(0)
  490. write_byte(Colors[0])
  491. write_byte(Colors[1])
  492. write_byte(Colors[2])
  493. write_byte(Alpha)
  494. message_end()
  495. }
  496.  
  497. stock ScreenShake(id) {
  498. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("ScreenShake"), _, id);
  499. write_short(1<<14)
  500. write_short(1<<12)
  501. write_short(2<<12)
  502. message_end();
  503. }
  504.  
  505. GetRandomAlive(target_index) { // :3
  506. new iAlive
  507. for (new id = 1; id <= get_maxplayers(); id++) {
  508. if (is_user_alive(id)) iAlive++
  509. if (iAlive == target_index) return id
  510. }
  511. return -1
  512. }
  513.  
  514. GetAliveCount() { // ^^
  515. new iAlive
  516. for (new id = 1; id <= get_maxplayers(); id++) if (is_user_alive(id)) iAlive++
  517. return iAlive
  518. }
  519.  


Atsijungęs
 Aprašymas  
 
Rodyti paskutinius pranešimus:  Rūšiuoti pagal  
 Puslapis 11 [ 1 pranešimas ] 

Visos datos yra UTC + 2 valandos


Dabar prisijungę

Vartotojai naršantys šį forumą: Google [Bot] ir 4 svečių


Jūs negalite kurti naujų temų šiame forume
Jūs negalite atsakinėti į temas šiame forume
Jūs negalite redaguoti savo pranešimų šiame forume
Jūs negalite trinti savo pranešimų šiame forume
Jūs negalite prikabinti failų šiame forume

Ieškoti:
Pereiti į: