Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mystery Boxes
#1
Mystery Box
_____________________________________________________


Description: Mystery boxes as you would see them in regular nazi zombies. Only difference is that it doesnt use the nazi zombie box or lid because they werent included with mod tools. Instead just a similar looking box that doesnt open. Still includes all sounds and effects. Please give credit where credit is due. Thanks.

Notes:
- rarity only affects the last weapon, it will still show raygun or other rare weapons just as often but you will not actually get them often.
- Boxes spawn on tdm spawnpoints.

GSC
Code:
#include common_scripts\utility;
    
    main()
    {
        level.NumBoxes = CreateDvar("zom_numboxes", 20, 0, GetEntArray("mp_tdm_spawn", "classname").size, "int");
        level.mboxcost = CreateDvar("zom_boxcost", 900, 0, 10000, "int");
        level._effect["mysterybox_glow"] = LoadFx("env/light/fx_ray_sun_sm_short");
        level._effect["mysterybox_grab"] = LoadFx("zomx/collect_box_weap");
        level._effect["mysterybox_mark"] = LoadFx("maps/zombie/fx_zombie_coast_marker");
        precacheItem("stg44_mp");
        precacheItem("sten_mp");
        precacheItem("mosin_mp");
        precacheItem("ppsh_mp");
        precacheItem("mp40_mp");
        precacheItem("deathmachine_mp");
        precacheItem("bowie_knife_mp");
        precacheItem("ray_gun_mp");
        precacheItem("spas_db_mp");
        PrecacheModel("p_glo_200mmshellbox");
    //                     Weapon file                   ,  Displayname                ,Rarity (The higher the more rare) (1 or more, over 10 is really rare!)
        AddWeaponToBox("ak47_mp"                ,"AK47"                        ,1);
        AddWeaponToBox("commando_mp"            ,"Commando"                    ,3);
        AddWeaponToBox("m16_mp"                    ,"M16"                        ,1);
        AddWeaponToBox("ak74u_mp"                ,"AK74u"                    ,3);
        AddWeaponToBox("wa2000_mp"                ,"Wa2000"                    ,3);
        AddWeaponToBox("uzi_mp"                    ,"Uzi"                        ,3);
        AddWeaponToBox("stoner63_mp"            ,"Stoner63"                    ,3);
        AddWeaponToBox("spectre_mp"                ,"Spectre"                    ,3);
        AddWeaponToBox("spas_mp"                ,"Spas12"                    ,3);
        AddWeaponToBox("skorpion_mp"            ,"Skorpion"                    ,3);
        AddWeaponToBox("rpk_mp"                    ,"RPK"                        ,3);
        AddWeaponToBox("python_mp"                ,"Python"                    ,3);
        AddWeaponToBox("psg1_mp"                ,"Psg1"                        ,3);
        AddWeaponToBox("pm63_mp"                ,"Pm63"                        ,3);
        AddWeaponToBox("mpl_mp"                    ,"Mpl"                        ,3);
        AddWeaponToBox("mp5k_mp"                ,"Mp5k"                        ,3);
        AddWeaponToBox("mac11_mp"                ,"Mac11"                    ,3);
        AddWeaponToBox("m60_mp"                    ,"M60"                        ,3);
        AddWeaponToBox("m1911_mp"                ,"M1911"                    ,3);
        AddWeaponToBox("makarov_mp"                ,"Makarov"                    ,3);
        AddWeaponToBox("m14_mp"                    ,"M14"                        ,3);
        AddWeaponToBox("l96a1_mp"                ,"L96a1"                    ,3);
        AddWeaponToBox("kiparis_mp"                ,"Kiparis"                    ,3);
        AddWeaponToBox("hk21_mp"                ,"HK21"                        ,3);
        AddWeaponToBox("galil_mp"                ,"Galil"                    ,3);
        AddWeaponToBox("g11_mp"                    ,"G11"                        ,3);
        AddWeaponToBox("fnfal_mp"                ,"FNfal"                    ,3);
        AddWeaponToBox("famas_mp"                ,"Famas"                    ,3);
        AddWeaponToBox("enfield_mp"                ,"Enfield"                    ,3);
        AddWeaponToBox("dragunov_mp"            ,"Dragunov"                    ,3);
        AddWeaponToBox("cz75_mp"                ,"Cz75"                        ,3);
        // AddWeaponToBox("crossbow_mp"            ,"Crossbow"                    ,1);
        AddWeaponToBox("aug_mp"                    ,"Aug"                        ,3);
        AddWeaponToBox("deathmachine_mp"        ,"DeathMachine"                ,5);
        AddWeaponToBox("ray_gun_mp"                ,"Raygun"                    ,5);
        AddWeaponToBox("spas_db_mp"                ,"Dragons_Breath"            ,1);
      
        AddWeaponToBox("stg44_mp"                ,"STG44"                    ,1);
        AddWeaponToBox("sten_mp"                ,"Sten"                        ,1);
        AddWeaponToBox("mosin_mp"                ,"Mosin"                    ,1);
        AddWeaponToBox("ppsh_mp"                ,"PPSH41"                    ,1);
        AddWeaponToBox("mp40_mp"                ,"MP40"                        ,1);
        
        TdmSpawns = GetEntArray("mp_tdm_spawn", "classname");
        BoxSpawns = [];
        
        for (i = 0; i < level.NumBoxes; i++)
        {
            r = RandomInt(TdmSpawns.size);
            
            for (j = 0; j < BoxSpawns.size; j++)
            {
                while (TdmSpawns[r] == BoxSpawns[j])
                {
                    r = RandomInt(TdmSpawns.size);
                    wait .05;
                }
            }
            BoxSpawns[BoxSpawns.size] = TdmSpawns[r];
        }
        
        level thread SetupBoxes(BoxSpawns);
    }
    
    SetupBoxes(Spawns)
    {
        for (i = 0; i < Spawns.size; i++)
        {
            Trigger = Spawn("trigger_radius", Spawns[i].origin /* - ( 0, 0, 25 ) */, 0, 100, 25);
            Trigger.cost = level.mboxcost;
            Trigger thread DoBox();
        }
    }
    
    DoBox()
    {
        level endon("game_ended");
        
        self.box = Spawn("script_model", self.origin); // box model
        self.box setModel("p_glo_200mmshellbox");
        PlayFX( level._effect["mysterybox_mark"], self.origin );
      
      
        for (;;)
        {
            self.user = undefined;
            
            self SetHintString(&"ZOMEXT_MYSTERYBOX_PRESSUSE");
            self waittill("trigger", player);
            
            if (player UseButtonPressed() && !IsDefined(self.user) && IsPlayer(player) && player IsOnGround() && player.SessionState == "playing" && !player.IsZombie)
            {
                if(isDefined(self.cost) && isDefined(player.cash))
                    if(player.cash < self.cost)
                    {
                        player iprintlnbold("^5Not enough cash, go kill some zombies");
                        wait 1;
                        continue;
                    }
                    else
                        player.cash -= self.cost;
    
                self.user = player; // Used so other people can't steal the users weapons.
                
                self thread OnBoxTimedOut();
                self thread PlayGlowFx(); // Includes Sound.
                self thread RollWeapon(player);
                
                self waittill("box_timed_out");
                self PlaySound("zmb_lid_close");
          
                wait 1;
            }
        }
    }
    
    RollWeapon(player) // self is the box
    {
        level endon("game_ended");
        self endon("box_timed_out");
        
        player thread BoxTimeOut(self);
        
        self.wmodel = Spawn("script_model", self.box.origin);
        self.wmodel.angles = self.box.angles;
        
        r    = 0; // Random var
        Speed    = 0.05;  
        LastRoll = ""; // used to monitor what the previous weapon was, so i doesn't roll the same weapon twice.
        
        self PlaySound("music_box");
        self SetHintString(&"ZOMEXT_NULL"); // Removing hintstring.
        
        for (h = 0; h <= 50; h += 2) // h = height
        {
            while (player HasWeapon(level.BoxItems[r].Weapon) || LastRoll == level.BoxItems[r].Weapon)
            {
                r = RandomInt(level.BoxItems.size);
                wait .05;
            }
                
            while (h >= 50 && level.BoxItems[r].Rarity > 1) // Last roll. (The only that matters)
            {
                if (RandomInt(level.BoxItems[r].Rarity) == 0) // Where the rarity comes in
                    break;
    
                else
                {
                    r = RandomInt(level.BoxItems.size);
                    while (player HasWeapon(level.BoxItems[r].Weapon))
                    {
                        r = RandomInt(level.BoxItems.size);
                        wait .05;
                    }
                }
                          
                wait .05;    
            }
            self.wmodel SetModel(GetWeaponModel(level.BoxItems[r].Weapon));
            self.wmodel MoveZ(2, speed);
            
            Speed += 0.0042; // makes it go slower over time
            wait Speed - 0.002;
            
            LastRoll = level.BoxItems[r].Weapon;
        }
        self thread GiveBoxWeapon(r);
    }
    
    GiveBoxWeapon(r) // self is the box
    {
        self endon("box_timed_out");
        self notify("weapon_randomized");
        
        NewWeapon = level.BoxItems[r].Weapon;
            
        self SetHintString(&"ZOMEXT_USE_TO_PICK_UP");
        if (self.user GetWeaponsListPrimaries().size > 1)
            self SetHintString(&"ZOMEXT_USE_TO_SWAP_FOR");
        
        for (;;)
        {
            self waittill("trigger", player);
    
            if (IsPlayer(player) && player UseButtonPressed() && player.SessionState == "playing" && self.user == player && IsHeldWeapon(player GetCurrentWeapon()))
            {      
                if (player GetWeaponsListPrimaries().size > 1) // In case the player only has one weapon.
                    player TakeWeapon(player GetCurrentWeapon());
                    
                player GiveWeapon(NewWeapon);
                player SwitchToWeapon(NewWeapon);
                player GiveMaxAmmo(NewWeapon);
                player PlayLocalSound("weap_pickup");
                player iprintlnbold("^7You got the ^2" + level.boxItems[r].Name);
                self SetHintString(&"ZOMEXT_NULL");
                
                if (IsDefined(self.wmodel))
                {
                    PlayFX( level._effect["mysterybox_grab"], self.wmodel.origin );
                    self.wmodel Delete();
                }
    
                self notify("box_timed_out");
            }
                    wait .05;
        }
        self notify("box_timed_out");
    }
    
    IsHeldWeapon(weap)
    {
        return true;
    }
    
    OnBoxTimedOut() // self is the box
    {
        level endon("game_ended");
        
        self thread BoxWait();
        
        self waittill("box_timed_out");
        self SetHintString(&"ZOMEXT_NULL");
        
        if (IsDefined(self.glow))
            self.glow delete();
        
        if (IsDefined(self.wmodel))
        {
            self.wmodel moveto(self.origin, 0.25);
            wait 0.25;
            self.wmodel delete();
        }
    }
    
    BoxWait()
    {
        level endon("game_ended");
        self endon("box_timed_out");
        
        self waittill("weapon_randomized");
        wait 1.5;
        self notify("box_timed_out");
    }
    
    PlayGlowFx() // self is the box
    {
        level endon("game_ended");
        self endon("box_timed_out");
        self Playsound("zmb_lid_open");
        self PlaySound("zmb_music_box");
        self.glow = SpawnFx(level._effect["mysterybox_glow"],
                    self.box.origin + (0, 0, 10),
                    AnglesToForward(self.box.angles + (90, 90, 90)),
                    AnglesToUp(self.box.angles + (0, 0, 0)));
        TriggerFx(self.glow);
    }
    
    BoxTimeOut(box) // self is the player
    {
        self waittill_any("death", "disconnect", "joined_spectators");
        box notify("box_timed_out");
    }
    
    AddWeaponToBox(sWeapon, sString, iRarity)
    {      
        if (!IsDefined(level.BoxItems))
            level.BoxItems = [];
        if (!IsDefined(sWeapon))
            sWeapon = "defaultweapon_mp";
        if (!IsDefined(sString))
            sString = sWeapon;
        if (!IsDefined(iRarity))
            iRarity = 1;
        
        PrecacheItem(sWeapon);
        
        i = level.BoxItems.size;      
        level.BoxItems[i] = SpawnStruct();
        level.BoxItems[i].Weapon = sWeapon;
        level.BoxItems[i].Name   = sString;
        level.BoxItems[i].Rarity = iRarity;
    }
    
    IsZombie()
    {
        return self.pers["team"] == "axis";
    }
    
    createdvar(varname, vardefault, min, max, type)
    {
       if(type == "int")
       {
          if(getdvar(varname) == "")
             definition = vardefault;
          else
             definition = getdvarint(varname);
       }
       else if(type == "float")
       {
          if(getdvar(varname) == "")
             definition = vardefault;
          else
             definition = getdvarfloat(varname);
       }
       else
       {
          if(getdvar(varname) == "")
             definition = vardefault;
          else
             definition = getdvar(varname);
       }
    
       if((type == "int" || type == "float") && min != 0 && definition < min)
          definition = min;
    
       if((type == "int" || type == "float") && max != 0 && definition > max)
          definition = max;
    
       if(getdvar( varname ) == "")
          setdvar( varname, definition );
    
       return definition;
    }
CSV
Code:
rawfile,modfiles/_mystery_box.gsc
xmodel,p_glo_200mmshellbox
fx,env/light/fx_ray_sun_sm_short
fx,zomx/collect_box_weap
fx,maps/zombie/fx_zombie_coast_marker
// sound,YOURSOUNDALIASNAME //
SoundAlias
Code:
zmb_lid_open,raw\sound\evt\zombie_global\box\open\open_00.wav,,,,event,93,93,100,250,2500,4000,default,curve2,allon,rdefault,1,oldest,5,reject,0,0,0,20,30,0.25,1,3d,loaded,nonlooping,,1,0,96,,default,0,0,0,0,0.5,0.5,no,yes,none,1000,no,,both,no,no,,,75,no,no,0,0,wma,yes,no,world,event,no,raw\sound\evt\zombie_global\box\open\open_00.xm4,0,raw\sound\evt\zombie_global\box\open\open_00.mp3,0,raw\sound\evt\zombie_global\box\open\open_00.wav,0,zmb_common,all
zmb_lid_close,raw\sound\evt\zombie_global\box\close\close_00.wav,,,,event,93,93,100,250,2500,4000,default,curve2,allon,rdefault,1,oldest,5,reject,0,0,0,20,30,0.25,1,3d,loaded,nonlooping,,1,0,96,,default,0,0,0,0,0.5,0.5,no,yes,none,1000,no,,both,no,no,,,75,no,no,0,0,wma,yes,no,world,event,no,raw\sound\evt\zombie_global\box\close\close_00.xm4,0,raw\sound\evt\zombie_global\box\close\close_00.mp3,0,raw\sound\evt\zombie_global\box\close\close_00.wav,0,zmb_common,all
zmb_music_box,raw\sound\evt\zombie_global\box\music_box\music_box_00.wav,,,,event,97,97,100,500,2500,4000,default,curve2,allon,rdefault,1,oldest,5,reject,0,0,0,40,60,0.25,1,3d,loaded,nonlooping,,1,0,96,,default,0,50,250,97,0.5,0.5,no,yes,none,1000,no,,both,no,no,,,75,no,no,0,0,wma,yes,no,world,event,no,raw\sound\evt\zombie_global\box\music_box\music_box_00.xm4,0,raw\sound\evt\zombie_global\box\music_box\music_box_00.mp3,0,raw\sound\evt\zombie_global\box\music_box\music_box_00.wav,0,zmb_common,all

Credits:
Fixz
Me (Jookbob)
Some_kid
Reply

#2
needs more video :3
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#3
looks interesting, needs a pic or vid though (like azu said)
Reply

#4
http://www.xfire.com/video/4f8c2e/
Reply

#5
That's some creepy ass music.
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#6
Thanks! Maybe will use it in my mod ! OMA !
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#7
http://www.itsmods.com/forum/Thread-Mystery-Box.html

?
Reply

#8
Your doesnt have cool sound @doh
[Image: lQDUjba.jpg]
Reply

#9
(10-30-2011, 12:36)d0h! Wrote: http://www.itsmods.com/forum/Thread-Mystery-Box.html

?

Mysterybox(only missing the ? and lid) + sounds + rarity for good guns
vs.
Carepackage + no sound + all guns have equal chance to appear
Reply

#10
(10-30-2011, 12:50)OrangePL Wrote: Your doesnt have cool sound @doh

he didnt make tlpwnzer did, he is a wii user and we have limits to what we can do so of course it has no sound/?/rarity (rarity can be done but its not the point)
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  use Mystery Box bug E-losev 3 2,341 07-19-2013, 16:33
Last Post: surtek
  [Release] Interactive Boxes Yamato 1 2,509 06-29-2013, 18:20
Last Post: DidUknowiPwn
  Help boxes [HARD] Tony. 3 2,899 05-16-2013, 18:29
Last Post: DidUknowiPwn
  [Release] [CODE][TUT]Boxes 99IRock 40 22,220 01-14-2013, 20:18
Last Post: EnVi Sweden Rocks
Rainbow [Release] Mystery Box Model Nekochan 17 9,504 01-12-2012, 04:27
Last Post: Sanya
  [Release] Mystery Box d0h! 7 7,392 09-06-2011, 08:20
Last Post: Dountill
  A care package / mystery box mod. aefven 1 2,284 07-09-2011, 11:31
Last Post: iBanana
  D3D Boxes d0h! 3 4,201 07-03-2011, 00:41
Last Post: gellin

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.