• 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Zombie Prizes
#1
Hello

I tried to make prizes for zombies(like BO: bomb, repair all windows, minigun...), but for the moment I only managed to make a deathstreak, could somebody help me on making it with random deaths???? Huh

This code works, is what I have:


PHP Code
  1. Prize()
  2. {
  3.  
  4. self waittill("death");
  5.  
  6. Prize = spawn("script_model", self.origin );
  7. Prize setModel("scavenger_bag_mp");
  8. trigger = spawn( "trigger_radius", self.origin, 0, 50, 50 );
  9. trigger thread EarnPrizes(Prize, trigger);
  10.  
  11. }
  12.  
  13. EarnPrizes(Prize, trigger)
  14. {
  15. self endon("disconnect");
  16.  
  17. while(1)
  18. {
  19. self waittill( "trigger", player );
  20.  
  21. if(Distance(Prize, Player.origin) <= 50 && player.pers["team"] == game["attackers"] )
  22. {
  23. player thread Prizes();
  24. wait 3;
  25. Prize delete();
  26. trigger delete();
  27. wait 1;
  28. }
  29. }
  30.  
  31. }
  32.  
  33. Prizes()
  34. {
  35. switch(RandomInt(4))
  36. {
  37. case 0:
  38. self maps\mp\killstreaks\_airdrop::refillAmmo();
  39. self playLocalSound( "ammo_crate_use" );
  40. break;
  41.  
  42. case 1:
  43. self _setperk("specialty_coldblooded");
  44. break;
  45.  
  46. case 2:
  47. self GiveWeapon("onemanarmy_mp", 0, false);
  48. break;
  49.  
  50. case 3:
  51. self GiveWeapon("deserteaglegold_mp", 0, true);
  52. break;
  53. }
  54. }
  Reply
#2
Many people do it so un-organized. Controll your } and )'s
I organized your code a litle, and put some } and )'s where was needed, about the code: I don't know if some things are right. Let some check it for you.

PHP Code
  1. Prize()
  2. {
  3.  
  4. self waittill("death");
  5. Prize = spawn("script_model", self.origin );
  6. Prize setModel("scavenger_bag_mp");
  7. trigger = spawn( "trigger_radius", self.origin, 0, 50, 50 );
  8. trigger thread EarnPrizes(Prize, trigger);
  9.  
  10. }
  11.  
  12. EarnPrizes(Prize, trigger)
  13. {
  14. self endon("disconnect");
  15.  
  16. while(1)
  17. {
  18. self waittill( "trigger", player );
  19.  
  20. if(Distance((Prize, Player.origin) <= 50 && player.pers["team"] == game["attackers"])
  21. {
  22. player thread Prizes();
  23. wait 3;
  24. Prize delete();
  25. trigger delete();
  26. wait 1;
  27. }
  28. }
  29.  
  30. }
  31.  
  32. Prizes()
  33. {
  34. switch(RandomInt(4))
  35. {
  36. case 0:
  37. self maps\mp\killstreaks\_airdrop::refillAmmo();
  38. self playLocalSound( "ammo_crate_use" );
  39. break;
  40.  
  41. case 1:
  42. self _setperk("specialty_coldblooded");
  43. break;
  44.  
  45. case 2:
  46. self GiveWeapon("onemanarmy_mp", 0, false);
  47. break;
  48.  
  49. case 3:
  50. self GiveWeapon("deserteaglegold_mp", 0, true);
  51. break;
  52. }
  53. }
  Reply
#3
(03-25-2011, 20:24)surtek Wrote: Many people do it so un-organized. Controll your } and )'s
Also edited your code a litle:

PHP Code
  1. Prize()
  2. {
  3.  
  4. self waittill("death");
  5. Prize = spawn("script_model", self.origin );
  6. Prize setModel("scavenger_bag_mp");
  7. trigger = spawn( "trigger_radius", self.origin, 0, 50, 50 );
  8. trigger thread EarnPrizes(Prize, trigger);
  9.  
  10. }
  11.  
  12. EarnPrizes(Prize, trigger)
  13. {
  14. self endon("disconnect");
  15.  
  16. while(1)
  17. {
  18. self waittill( "trigger", player );
  19.  
  20. if(Distance(Prize, Player.origin) <= 50 && player.pers["team"] == game["attackers"] )
  21. {
  22. player thread Prizes();
  23. wait 3;
  24. Prize delete();
  25. trigger delete();
  26. wait 1;
  27. }
  28. }
  29.  
  30. }
  31.  
  32. Prizes()
  33. {
  34. switch(RandomInt(4))
  35. {
  36. case 0:
  37. self maps\mp\killstreaks\_airdrop::refillAmmo();
  38. self playLocalSound( "ammo_crate_use" );
  39. break;
  40.  
  41. case 1:
  42. self _setperk("specialty_coldblooded");
  43. break;
  44.  
  45. case 2:
  46. self GiveWeapon("onemanarmy_mp", 0, false);
  47. break;
  48.  
  49. case 3:
  50. self GiveWeapon("deserteaglegold_mp", 0, true);
  51. break;
  52. }
  53. }

O.o, in my _rank.gsc is all organized, with easy to read spaces, I dont know why it changed, Undecided, have idea of how to make this???
  Reply
#4
Maybe try to use 2 different functions to place the trigger and the script model?
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

  Reply
#5
(03-25-2011, 22:24)iAegle Wrote: Maybe try to use 2 different functions to place the trigger and the script model?

and that for???? Huh

I want to make prizes like BO with random deaths, the code I posted works, but it gives the prize after 1 death, I can increase the number of deaths necesary just by adding more level waittill ( "death"), but I want to make that the number of deaths is random and not a normal deathstreak.
  Reply
#6
(03-26-2011, 08:15)Yamato Wrote:
(03-25-2011, 22:24)iAegle Wrote: Maybe try to use 2 different functions to place the trigger and the script model?

and that for???? Huh

I want to make prizes like BO with random deaths, the code I posted works, but it gives the prize after 1 death, I can increase the number of deaths necesary just by adding more level waittill ( "death"), but I want to make that the number of deaths is random and not a normal deathstreak.

You can close, I found a way, was very easy. Smile
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  BF4 zombie 'mod' JariZ 4 2,513 08-17-2014, 14:23
Last Post: Yamato
  [Request] Modder/s for R2K Zombie MOD mr.apple 4 1,777 10-25-2013, 12:45
Last Post: mr.apple
Tongue Zombie CE Table xtreme2010 5 2,192 08-01-2013, 18:15
Last Post: barata
  Zombie model imchasinyou 7 2,325 07-31-2013, 01:11
Last Post: rotceh_dnih
Star [Release] 8 new Zombie maps for ItsZombieMod mahafy00 31 22,354 07-20-2013, 07:28
Last Post: benm4a
  Help Modding Zombie Mode DarthKiller 3 1,842 07-09-2013, 21:08
Last Post: Nekochan
Information Preview 'KillMe' zombie mod Nekochan 115 19,101 07-03-2013, 14:56
Last Post: X-Track
  [Release] Black Ops Single Player/Zombie Trainer V3.6 Craig87 52 39,050 07-01-2013, 15:12
Last Post: explosivebanana55
  [Release] MW3 Mod: Zombie Juggernauts NChecker 8 9,884 06-27-2013, 05:38
Last Post: xX_ANTZ_Xx
Video Preview AIZombies eXtreme 2.0 / Zombie Player (Music Player) DidUknowiPwn 4 2,476 06-24-2013, 16:37
Last Post: DidUknowiPwn

Forum Jump:


Users browsing this thread: 1 Guest(s)