Announcement

Collapse
No announcement yet.

How do i add new weapons and ammo?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by Spike View Post
    if you want more than one weapon, I personally favour no longer using .items or even .weapon for weapons. use some other fields and update these two system fields as required for correct/appropriate hud display each time you change your current weapon.
    you can get 23 different weapons that way before things get vile again.
    What should i use for multiple weapons as a field.
    I am like a stray dog, lost in between what I do and what I should do.
    But sometimes, all you need is Imagination.

    Comment


    • #17
      Goldenboy Spike and Seven thankyou all for your posts i think you have given enuf info that we should be able to get the job done. thankyou for taking the time to brake this down for us. Shambler234 we are in good hands.

      Comment


      • #18
        Hello Josh,

        Beeing also a great fan of fantasy/medieval ambience/games, your crossbow caught my interest.

        The crossbow from Drake mod, that you want to use, is "borrowed" from Hexen 2 game (like many other models from Drake).
        I justed wanted to say that there is also a High Res replacement skin available for this weapons v_model.
        Jeank made it.
        Because you said you like to use replacement things...

        Especially when you want to use an engine with realtime lighting combined with offsetmapping (like DP or FTE) these kind of replacement skins multiply/amplify the visual a lot.
        It is hard to catch the effect in a screenshot.

        Anyhow, here are some comparisms (with/without replacement skin on v_model):

        With:

        Without:


        With:

        Without:



        Good luck with your new weapon,
        Seven

        Comment


        • #19
          first to learn qc you need read qc code and second, you can steal qc for your work!! i mixed stealth mod plus some ripped weapons from paranoia to get this horrible mod
          [ame=http://www.youtube.com/watch?v=0zdV56R4eYE]Mod Loco - YouTube[/ame]

          the invasion has begun! hide your children, grab the guns, and pack sandwiches.

          syluxman2803

          Comment


          • #20
            @shambler this is a bit of code from doe

            def.qc

            Code:
            // items
            float	IT_AXE					= 2048;		// 1
            float	IT_SHOTGUN				= 1;
            float	IT_SUPER_SHOTGUN		= 2;
            float	IT_NAILGUN				= 4;
            float	IT_SUPER_NAILGUN		= 8;
            float	IT_GRENADE_LAUNCHER		= 16;
            float	IT_ROCKET_LAUNCHER		= 32;
            float	IT_LIGHTNING			= 64;			// 8
            float	IT_SHELLS				= 128;
            float	IT_NAILS				= 256;
            float	IT_ROCKETS				= 512;
            float	IT_CELLS				= 1024;
            float	IT_LAVA_NAILGUN			= 4096;		
            float 	IT_LAVA_SUPER_NAILGUN	= 8192;			
            float 	IT_MULTI_GRENADE		= 16384;		//15
            float	IT_MULTI_ROCKET			= 32768;
            float	IT_PLASMA_GUN			= 65536;	
            float	IT_KEY1					= 131072;
            float	IT_KEY2					= 262144;		
            float	IT_INVISIBILITY			= 524288;
            float	IT_INVULNERABILITY		= 1048576;
            float	IT_SUIT					= 2097152;
            float	IT_QUAD					= 4194304;		//23
            //ZOID --
            float	IT_GRAPPLE				= 8388608;		// grapple overload, hope it
            //-- ZOID										// doesn't mess things up!
            												
            
            float	IT2_ARMOR1				= 1;			//24
            float	IT2_ARMOR2				= 2;
            float	IT2_ARMOR3				= 4;
            float	IT2_LAVA_NAILS			= 8;
            float	IT2_PLASMA_AMMO			= 16;
            float	IT2_MULTI_ROCKETS		= 32;			//29
            float 	IT2_SHIELD				= 64;
            float 	IT2_ANTIGRAV			= 128;
            float	IT2_SUPERHEALTH			= 256;			//32
            float	IT2_EARTHQUAKE			= 512;			
            float	IT2_V_SPHERE			= 1024;
            if you are useing IT2 you can start over with the numbers. i hope you were able to find that.

            i have not had too much time to open my qc in the last few day too much RL going on but its all been good stuff. hopefully i will get some time and i can work a little bit on this. Tuesday and Thursday are my best days to play with qc so im a little slow on getting this done.

            Thank Seven for the skin idea i will use that. i think i need to play hexen. i enjoy drak so much and it seems a lot of that mod is used in that game.

            nahuel you always have cool mods, i cant wate to shoot that gun from the wast mod. and im glad im not the only one who gets the rainbow diamond from missing models.
            Last edited by JDSTONE; 06-15-2013, 12:33 PM.

            Comment


            • #21
              I finally made a weapon, not the weapon i wanted but i made it as an example which is an Super Automatic Shotgun, it fires simultaneously.


              Except for one problem, if i fire it too much it would crash the game.

              ====== Log started (Wed Oct 09 20:39:59 2013) ======
              ^7not enough ammo.
              ^7]impulse 9
              ^7Host_Error: stack overflow
              ^7QuakeC crash report for server:
              ^7s3768: ^6FIELD_F self (=entity 1), currentammo (=.currentammo), GLOBAL611
              ^7s3769: ^2EQ_F GLOBAL611, IMMEDIATE (=20), GLOBAL611
              ^7s3770: ^5IFNOT GLOBAL611, statement 3773
              ^7s3771: ^3CALL0 W_FireAutoShotgun (=W_FireAutoShotgun())
              ^7 weapons.qc : W_FireAutoShotgun : statement 3
              ^7 weapons.qc : W_FireAutoShotgun : statement 3
              ^7 weapons.qc : W_FireAutoShotgun : statement 3
              ^7 weapons.qc : W_FireAutoShotgun : statement 3
              ^7 weapons.qc : W_FireAutoShotgun : statement 3
              ^7 weapons.qc : W_FireAutoShotgun : statement 3
              ^7 weapons.qc : W_FireAutoShotgun : statement 3
              ^7 weapons.qc : W_Attack : statement 58
              ^7 weapons.qc : W_WeaponFrame : statement 8
              ^7 client.qc : PlayerPostThink : statement 7
              ^7Host_ShutdownServer
              ^7Client "player" dropped
              ^7CL_Disconnect
              ^7Sending clc_disconnect
              ^7key 0x5b (0x 15b0001, 0x 5b) has no translation
              ^7key 0x5b (0xc15b0001, 0x 5b) has no translation
              QC

              /*
              ================
              W_FireAutoShotgun
              ================
              */
              void() W_FireAutoShotgun =
              {
              local vector dir;

              if (self.currentammo == 20)
              {
              W_FireAutoShotgun ();
              return;
              }

              sound (self ,CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM);

              self.punchangle_x = -4;

              self.currentammo = self.ammo_shells = self.ammo_shells - 5;
              dir = aim (self, 100000);
              FireBullets (30, dir, '0.14 0.08 0');
              };


              /*
              Last edited by Shambler234; 10-09-2013, 07:00 PM.
              I am like a stray dog, lost in between what I do and what I should do.
              But sometimes, all you need is Imagination.

              Comment


              • #22
                Code:
                /*
                ================
                W_FireAutoShotgun
                ================
                */
                void() W_FireAutoShotgun =
                {
                local vector dir;
                
                if (self.currentammo == 20)
                
                
                sound (self ,CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM);
                
                self.punchangle_x = -4;
                
                self.currentammo = self.ammo_shells = self.ammo_shells - 5;
                dir = aim (self, 100000);
                FireBullets (30, dir, '0.14 0.08 0');
                };
                GO TO W_Attack
                LOOK FOR THIS

                Code:
                else if (self.weapon == IT_SUPER_SHOTGUN)
                	{
                		player_shot1 ();
                		W_FireSuperShotgun ();
                		self.attack_finished = time + 0.7;
                	}
                CHANGE THE .7 TO .1 AND IT WILL FIRE FAST!

                This is just what i may try i have not tryed it but maybe it will you or help you find out something else that will work.

                i hate when i mess up and crash darkplaces last night i hit a all time best for me and crashed the qc compiler. lol

                Comment


                • #23
                  I already tried that.
                  I am like a stray dog, lost in between what I do and what I should do.
                  But sometimes, all you need is Imagination.

                  Comment


                  • #24
                    It didn't work.
                    I am like a stray dog, lost in between what I do and what I should do.
                    But sometimes, all you need is Imagination.

                    Comment


                    • #25
                      POST THE LINK TO THE QC SO WE CAN TAKE A LOOK...
                      There are issues hear

                      ^7 weapons.qc : W_Attack : statement 58
                      ^7 weapons.qc : W_WeaponFrame : statement 8
                      ^7 client.qc : PlayerPostThink : statement 7

                      Comment


                      • #26
                        Technicly, you ought to be able to add thousands of weapons using that binary counting float system.

                        Just go back and add any 2 of those floats together for example:

                        IT_NEWWEAPON1 = IT_SHOTGUN | IT_SUPER_SHOTGUN;

                        IT_NEWWEAPON2 = IT_SHOTGUN | IT_SUPER_NAILGUN;

                        IT_NEWWEAPON3 = IT_SHOTGUN | IT_GRENADE_LAUNCHER;

                        ...and so fourth. If you get to the end of the standard quake weapon list , start with the next one and Dont duplicate previous combinations in reverse: IE:

                        IT_NEWWEAPON4 = IT_SUPER_SHOTGUN | IT_SUPER_NAILGUN;

                        IT_NEWWEAPON5 = IT_SUPER_SHOTGUN | IT_GRENADE_LAUNCHER;


                        ...But I think what Spike says about messing up the HUD , may or may not apply here...not sure. I guess if its already defined as an item somewhere else, it would cause confusion. However these are completely new floats counting in-between the standard ID suppliued binary counting floats they supplied in the code, so if Carmak was coding clean - and I think he does, these ought to also work as described.

                        UPDATE: As I thought about it more later, this could be a problem because those new floats will also be representing the other weapons as well. So if there is a line of code that says:

                        if (self.weapon & IT_NEWWEAPON2)

                        And you have either the shotgun or super nailgun, that would come up as TRUE. You would have to change the (&) sign to (==) to definately check specificly for the new weap.
                        Last edited by Cobalt; 10-10-2013, 03:11 PM.

                        Comment


                        • #27
                          /*
                          ============
                          w_attack

                          an attack impulse can be triggered now
                          ============
                          */
                          void() player_axe1;
                          void() player_axeb1;
                          void() player_axec1;
                          void() player_axed1;
                          void() player_shot1;
                          void() player_nail1;
                          void() player_light1;
                          void() player_rocket1;

                          void() w_attack =
                          {
                          local float r;

                          if (!w_checknoammo ())
                          return;

                          makevectors (self.v_angle); // calculate forward angle for velocity
                          self.show_hostile = time + 1; // wake monsters up

                          if (self.weapon == it_axe)
                          {
                          sound (self, chan_weapon, "weapons/ax1.wav", 1, attn_norm);
                          r = random();
                          if (r < 0.25)
                          player_axe1 ();
                          else if (r<0.5)
                          player_axeb1 ();
                          else if (r<0.75)
                          player_axec1 ();
                          else
                          player_axed1 ();
                          self.attack_finished = time + 0.5;
                          }
                          else if (self.weapon == it_shotgun)
                          {
                          player_shot1 ();
                          w_fireshotgun ();
                          self.attack_finished = time + 0.5;
                          }
                          else if (self.weapon == it_super_shotgun)
                          {
                          player_shot1 ();
                          w_firesupershotgun ();
                          self.attack_finished = time + 0.7;
                          }
                          else if (self.weapon == it_auto_shotgun)
                          {
                          player_shot1 ();
                          w_fireautoshotgun ();
                          self.attack_finished = time + 0.1;
                          }
                          else if (self.weapon == it_nailgun)
                          {
                          player_nail1 ();
                          }
                          else if (self.weapon == it_super_nailgun)
                          {
                          player_nail1 ();
                          }
                          else if (self.weapon == it_grenade_launcher)
                          {
                          player_rocket1();
                          w_firegrenade();
                          self.attack_finished = time + 0.6;
                          }
                          else if (self.weapon == it_rocket_launcher)
                          {
                          player_rocket1();
                          w_firerocket();
                          self.attack_finished = time + 0.8;
                          }
                          else if (self.weapon == it_lightning)
                          {
                          player_light1();
                          self.attack_finished = time + 0.1;
                          sound (self, chan_auto, "weapons/lstart.wav", 1, attn_norm);
                          }
                          };
                          qc


                          ============
                          w_weaponframe

                          called every frame so impulse events can be handled as well as possible
                          ============
                          */
                          void() w_weaponframe =
                          {
                          if (time < self.attack_finished)
                          return;

                          impulsecommands ();

                          // check for attack
                          if (self.button0)
                          {
                          superdamagesound ();
                          w_attack ();
                          }
                          };

                          /*
                          I am like a stray dog, lost in between what I do and what I should do.
                          But sometimes, all you need is Imagination.

                          Comment


                          • #28
                            Qc

                            ================
                            playerpostthink

                            called every frame after physics are run
                            ================
                            */
                            void() playerpostthink =
                            {
                            local float mspeed, aspeed;
                            local float r;

                            if (self.view_ofs == '0 0 0')
                            return; // intermission or finale
                            if (self.deadflag)
                            return;

                            // do weapon stuff

                            w_weaponframe ();

                            // check to see if player landed and play landing sound
                            if ((self.jump_flag < -300) && (self.flags & fl_onground) && (self.health > 0))
                            {
                            if (self.watertype == content_water)
                            sound (self, chan_body, "player/h2ojump.wav", 1, attn_norm);
                            else if (self.jump_flag < -650)
                            {
                            t_damage (self, world, world, 5);
                            sound (self, chan_voice, "player/land2.wav", 1, attn_norm);
                            self.deathtype = "falling";
                            }
                            else
                            sound (self, chan_voice, "player/land.wav", 1, attn_norm);

                            self.jump_flag = 0;
                            }

                            if (!(self.flags & fl_onground))
                            self.jump_flag = self.velocity_z;

                            checkpowerups ();
                            };
                            I am like a stray dog, lost in between what I do and what I should do.
                            But sometimes, all you need is Imagination.

                            Comment


                            • #29
                              humm i dont know what to tell you everything you posted is the same as 1.06 source... i did try the code i posted overtop my shotgun and had no issue. i did run out of shells fast! and everything gibed just fine... wish i could be more help.

                              Comment


                              • #30
                                You created an runaway loop:


                                void() W_FireAutoShotgun =
                                {
                                local vector dir;

                                if (self.currentammo == 20)
                                {
                                W_FireAutoShotgun (); // << HERE
                                return;
                                }


                                Once it hits 20, it repeats the void () over and over until the stack overflows.





                                Originally posted by Shambler234 View Post
                                It didn't work.

                                Comment

                                Working...
                                X