Announcement

Collapse
No announcement yet.

qc

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

  • #76
    Hello JDSTONER,

    Sorry to misuse your thread, but you mentioned the topic in your mail and I thought I post it here. Maybe also others find it useful.

    If you are working with model bboxes in DP, you can ... no, you should... use this engine feature. It shows (makes them visible) bounding boxes from server entities:
    r_showbboxes 1
    Without it, you are not really able to see your QC-given values in the game.
    Here is a screenshot that shows it (with cvar 1/0)



    Good luck,
    Seven

    Comment


    • #77
      always feel free to come and share some qc its appreciated seven.

      Comment


      • #78
        im stuck on my crossbow code. i have the crossbow in the game i can press "3" and it will show up. the shotguns now share "2" but if im on gun above "3" like a nail gun it tells me no weapon... i have no idea why the impulse is not working when i am above "3"

        This is the bigger Issue when i compile i get

        compiling SVQC/player.qc
        in function player_arrow1 (line 172),
        SVQC/player.qc:182: warning: W_FireArrow: Too few parameters
        SVQC/weapons.qc:916: W_FireArrow is defined here

        i seem to be missing the link between the weapons qc and the player qc i think?

        I am lost i hope one of you can give me an idea of how to fix this.

        NOVA (MY SON) SAW THE NEW GUN AND IM UNDER PRESSER TO MAKE IT WORK NOW.

        hear is my code

        player qc
        Code:
        void() player_arrow1   =[$nailatt1, player_nail2  ] //CROSSBOW ADD
        {
        	self.effects = self.effects | EF_MUZZLEFLASH;
        
        	if (!self.button0)
        		{player_run ();return;}
        	self.weaponframe = self.weaponframe + 1;
        	if (self.weaponframe == 9)
        		self.weaponframe = 1;
        	SuperDamageSound();
        	W_FireArrow ();
        	self.attack_finished = time + 0.2;
        	};

        weapons qc
        Code:
        //crossbow add
        
        void() arrow_touch;
        
        /*
        ===============
        launch_arrow
        
        Used for crossbow
        ===============
        */
        void(vector org, vector dir) launch_arrow =
        {
        	newmis = spawn ();
        	newmis.owner = self;
        	newmis.movetype = MOVETYPE_FLYMISSILE;
        	newmis.solid = SOLID_BBOX;
        
        	newmis.angles = vectoangles(dir);
        	
        	newmis.touch = arrow_touch;
        	newmis.classname = "spike";
        	newmis.think = SUB_Remove;
        	newmis.nextthink = time + 8;
        	setmodel (newmis, "progs/arrow.mdl");
        	setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);		
        	setorigin (newmis, org);
        
        	newmis.velocity = dir * 1000;
        };
        
        void(float ox) W_FireArrow =
        {
        	local vector	dir;
        	local entity	old;
        	
        	makevectors (self.v_angle);
        	
        	if (self.ammo_arrow >= 1 && self.weapon == IT2_CROSSBOW)
        	{
        		W_FireArrow ();
        		return;
        	}
        
        	if (self.ammo_arrow < 1)
        	{
        		self.weapon = W_BestWeapon ();
        		W_SetCurrentAmmo ();
        		return;
        	}
        	sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
        	self.attack_finished = time + 0.2;
        	self.currentammo = self.ammo_arrow = self.ammo_arrow - 1;
        	dir = aim (self, 1000);
        	launch_arrow (self.origin + self.view_ofs + v_up * -8 + v_right*ox, dir);
        
        	self.punchangle_x = -2;
        };
        
        	.float hit_z;
        void() arrow_stuck_think = 
        { 
           if (self.aflag <= time) 
           { 
              remove (self); 
              return; 
           } 
        
           setorigin(self, self.pos1 + self.owner.origin - self.pos2); 
        
           self.nextthink = time; 
        }; 
        
        	
        void() arrow_touch =
        {
        local float rand;
        	if (other == self.owner)
        		return;
        
        	if (other.solid == SOLID_TRIGGER)
        		return;	// trigger field, do nothing
        
                if (pointcontents(self.origin) == CONTENT_SKY) 
                { 
                        remove(self); 
                        return; 
                } 
                
        // hit something that bleeds 
                if (other.takedamage) 
                { 
                        spawn_touchblood (18); 
                        T_Damage (other, self, self.owner, 18); 
                        
                        remove(self);   //add this so they don't float... 
                        return;         //add this to avoid errors 
                } 
        
                else if (other.solid != SOLID_BSP) 
                { 
                        remove(self); 
                        return; 
                }
        		WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
        		WriteByte (MSG_BROADCAST, TE_ARROW);
        		WriteCoord (MSG_BROADCAST, self.origin_x);
        		WriteCoord (MSG_BROADCAST, self.origin_y);
        		WriteCoord (MSG_BROADCAST, self.origin_z);
        		
                self.solid = SOLID_NOT; 
                self.movetype = MOVETYPE_NONE; 
        
                setorigin (self, self.origin - normalize(self.velocity) * 3); 
                self.velocity = '0 0 0';         //add this, it makes the nail stop 
        
              if (other.solid == SOLID_BSP && other != world) 
              { 
                 self.owner = other; 
                 self.pos1 = self.origin; 
                 self.pos2 = other.origin; 
                 self.aflag = time + 10; 
                 self.think = arrow_stuck_think; 
                 self.nextthink = time; 
              } 
              else 
              { 
                 self.nextthink = time + 20;     //add this, to prevent packet overflows 
                 self.think = SUB_Remove;        //add this for same reason as above 
              } 
        };
        even after this i know that im not done yet i can only guess what could happen next

        Comment


        • #79
          Okay, we have a bevvy of things. But before we dig in, I'd like to
          ask you to use tabs when you indent your code.
          And whichever style you use, make an effort to use that style
          throughout, makes things easier to read.

          With that out of the way,
          Code:
          in function player_arrow1 (line 172),
          SVQC/player.qc:182: warning: W_FireArrow: Too few parameters
          SVQC/weapons.qc:916: W_FireArrow is defined here
          Be sure to check those line numbers for any anomolies. I'm sure you did,
          but I have to mention.

          Looking at player_arrow1 called from line 172 (oh and use a text editor that has
          code highlighting and shows line numbers..) we see
          Code:
          W_FireArrow ();
          I'ts being called with no parameters..aka arguments...nothing in between the
          ().
          the compiler complained because it does not match the function definition in number of
          arguments. The compiler then tells you the function is defined on line 916. so looking at
          line 916 we see
          Code:
          void(float ox) W_FireArrow =
          in its defined arguments is a float called ox.

          so whenever you call W_FireArrow, you need to supply a float as an argument.

          This leads us to the next problem.. ox is actually USED.
          ox is used inside W_FireArrow at the bottom.
          Code:
          	launch_arrow (self.origin + self.view_ofs + v_up * -8 + v_right*ox, dir);
          so either it must come from somewhere before its called, or you need to find an
          alternate way to get that float. Or lastly, you can decide its unecessary
          and remove it from the launch_arrow function call, and the W_FireArrow() arguments
          in the function definition.

          1 or 2 more posts coming next.
          Gnounc's Project Graveyard Gnounc's git repo

          Comment


          • #80
            inside W_FireArrow() we see
            Code:
            	if (self.ammo_arrow >= 1 && self.weapon == IT2_CROSSBOW)
            	{
            		W_FireArrow ();
            		return;
            	}
            if self.ammo_arrow is greater than or equal to 1 return. meaning nothing below that
            will be executed.

            but DIRECTLY BELOW that we see
            Code:
            	if (self.ammo_arrow < 1)
            	{
            		self.weapon = W_BestWeapon ();
            		W_SetCurrentAmmo ();
            		return;
            	}
            if self.ammo_arrow is less than 1, return..
            so now we have equal to, less than and greater than 1 all covered with associated
            returns. that means nothing below that second return statement will run. ever.

            but then you have this
            Code:
            	sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
            	self.attack_finished = time + 0.2;
            	self.currentammo = self.ammo_arrow = self.ammo_arrow - 1;
            	dir = aim (self, 1000);
            	launch_arrow (self.origin + self.view_ofs + v_up * -8 + v_right*ox, dir);
            
            	self.punchangle_x = -2;
            that code will never ever run.

            Worse than that is the infinite recursion created by the first
            return block.

            inside the function W_FireArrow() we see the previously mentioned
            Code:
            	if (self.ammo_arrow >= 1 && self.weapon == IT2_CROSSBOW)
            	{
            		W_FireArrow ();
            		return;
            	}
            so, if the conditions are right, the function W_FireArrow() will call itself and return.
            Which will check those conditions..which will prove to be favorable again, and then call W_FireArrow() and return.

            What I believe you meant to do, was to take that chunk of code that will never ever run, and have it run where that W_FireArrow() is being called.

            between those two posts, things should start to clear up a bit.
            Post back here if you have any more questions..
            Or on the more quakec oriented forums over at Inside3D
            Gnounc's Project Graveyard Gnounc's git repo

            Comment


            • #81
              Took a few minutes to find. The ox in W_FireArrows comes from W_FireSpikes obviously.
              It stands for offset x, its set to 4 and -4 in player.qc when the player fires spikes from the
              nailgun. Its used to make the nails spawn at the correct barrel.

              You can safely remove the ox from the arguments in the function definition, so long as you
              remove the one place its used as well, where launch_spikes is called from W_FireArrows.
              just the ox part. and +-/* or whatever is to the left and righit of it of course.

              alternatively you can just call W_FireArrows with a 0 in the argument spot, or
              even look for an offset that looks correct.

              -best of luck
              Gnounc's Project Graveyard Gnounc's git repo

              Comment


              • #82
                Hello Josh,

                Just a few things I would like to add to gnounc�s findings.

                This line declares, how long the pause time between your shots is:
                self.attack_finished = time + 0.2;
                You have set this value to only 0.2 seconds (copied from nailgun I think).
                I think it is much too short for a crossbow.
                Please browse through the other weapon�s .attack_finished time values.
                Example the rocket launcher has a much bigger time between the shots.
                Maybe this is what you would like to use for crossbow too.
                Remember, this value is essential for the balancing of the game/weapon.


                The mysterious “ox” offset value:
                Get rid of it completely (like gnounc already suggested).
                The “arrow” will be spawned from the center of your view, so you do not need it.
                Like it is done for the supernailgun.


                Frames of the crossbow:
                Code:
                	if (self.weaponframe == 9)
                		self.weaponframe = 1;
                I don’t have the model in front of my eyes at the moment, but be careful with this value.
                You took it directly from nailgun code. If the crossbow has less or more animation frames,
                You have to adjust the value “9” to its animation frames !

                Then this:
                void () player_arrow1 = [$ nailatt1, player_nail2]
                You jump from function player_arrow1 to player_nail2.
                player_nail2 will then call player_nail1 again and so on (endless loop as long as you press the button).
                player_arrow1 is only called once and then never again.
                I think this is NOT what you want.
                These functions declare the player.mdl animations and view_weapon animations at the same time.
                A crossbow does not shoot like a nailgun, so the player animation for nailguns should not be used.
                Better use a longer animation (like shotgun or explosive weapons).
                They have much more frames and it would match to crossbow better.
                Remember, that player_nailgun has only 2 frames ($nailatt1 and $nailatt2) because it fits to the short .attack_finished value.
                So you shoot maybe better copy/paste the shotgun or rocket animation code for your crossbow.


                The check for the crossbow weapon inside your W_FireArrow (float ox) :
                Code:
                	if (self.ammo_arrow >= 1 && self.weapon == IT2_CROSSBOW)
                	{
                		W_FireArrow ();
                		return;
                	}
                You copied this code from W_FireSpikes (float ox), but it makes no sense for the crossbow !
                The original ID1 check in that function was because the supernailgun AND nailgun use the same player animation frame functions.
                So they HAD to implement a check to see which weapon is really used.
                If it was Supernailgun --> W_FireSuperSpikes () is called and jump out of function with return;
                If it was Nailgun --> run through complete function !
                So:
                A) delete the “ox” completely and
                B) delete the check for IT2_CROSSBOW


                Regarding your issue with the cycle-through-weapons code:
                There are 3 different ways to change your weapons:
                - use mouse wheel up
                - use mouse wheel down
                - use keybord buton directly

                You have to edit each of these 3 functions and implement your new weapon check. As I mentioned some posts before:
                Please compare
                ID1 v1.06 weapons.qc
                with
                Hipnotic weapons.qc

                It will tell you exactly how these 3 cycle-through-weapons code must be extended:
                - W_ChangeWeapon () (for direct keybord button switch)
                - CycleWeaponCommand () (for wheel up)
                - CycleWeaponReverseCommand () (for wheel down)

                You said, that you have the issue that Quake tells that you have “no weapon”.
                W_ChangeWeapon () is doing this.
                So, either do it like Hipnotic�s proximity (2 weapons in one slot) or lasergun (extra weapon slot).
                If you want to add a new slot, then you also need the key “9” and every weapon should move 1 slot upwards (beginning from the slot you want to put the crossbow in). Or use key/slot "9" for the crossbow.
                In the end it doesnt matter, but it must match the other cycle-weapon functions.

                Don’t forget to also edit these:
                - W_SetCurrentAmmo ()
                - W_BestWeapon ()
                - W_Attack ()

                Good luck,
                Seven


                PS: I am sorry for the long post with most probabyl many english grammar mistakes...

                Comment


                • #83
                  ah, now that I'm not sleep deprived..seven is quite right about the weapon animation stuff being a bit icky.
                  To simplify things, what you should probably do, is rewrite your crossbow function entirely, this time copying the rocket launcher code instead of the nailgun code,
                  and changing the model of the rocket to that of your arrow, and changing the rockets .touch to your arrow.touch instead of becomeExplosion or whatever it is set to currently.

                  That would be a bit easier, as its timings are more normal, its animations are more normal, because it isnt a hold down weapon like the nailgun as seven pointed out.
                  Gnounc's Project Graveyard Gnounc's git repo

                  Comment


                  • #84
                    gnounc and seven thankyou for taking a look at my code. i am learning a lot trying to do this. im shure it will take me a few days to get everything fixed as you have told me. i will post back if i am still strugling or hopfully post a video of the crossbow firering

                    Comment


                    • #85
                      I'm glad you're learning, and still wanting to power through it.
                      Ive been doing quakec for a good while now, and I still suck at it.
                      The difference being I suck at it while having a better familiarity of the codebase than I started with, and a better support base.

                      If you keep at it, it'll get easier.
                      Gnounc's Project Graveyard Gnounc's git repo

                      Comment


                      • #86


                        [ame=http://www.youtube.com/watch?v=hnq_Ct4YnIg]dpvideo010 - YouTube[/ame]

                        Code:
                        /*
                        ===============================================================================
                        
                        ARROW_TOUCH
                        
                        ===============================================================================
                        */
                        
                        
                        
                        //crossbow add
                        void() arrow_touch =
                        {
                        local float rand;
                        	if (other == self.owner)
                        		return;
                        
                        	if (other.solid == SOLID_TRIGGER)
                        		return;	// trigger field, do nothing
                        
                                if (pointcontents(self.origin) == CONTENT_SKY) 
                                { 
                                        remove(self); 
                                        return; 
                                } 
                        	
                        	
                        // hit something that bleeds 
                                if (other.takedamage) 
                                { 
                                        spawn_touchblood (50); 
                                        T_Damage (other, self, self.owner, 50); 
                                        if (other.classname == "monster_zombie")
                        				T_Damage (other, self, self.owner, 500);
                        				
                                        remove(self);   //add this so they don't float... 
                                        return;         //add this to avoid errors 
                                } 
                        
                                else if (other.solid != SOLID_BSP) 
                                { 
                                        remove(self); 
                                        return; 
                                }
                        		WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
                        		WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
                        		WriteCoord (MSG_BROADCAST, self.origin_x);
                        		WriteCoord (MSG_BROADCAST, self.origin_y);
                        		WriteCoord (MSG_BROADCAST, self.origin_z);
                        		
                                self.solid = SOLID_NOT; 
                                self.movetype = MOVETYPE_NONE; 
                        
                                setorigin (self, self.origin - normalize(self.velocity) * 3); 
                                self.velocity = '0 0 0';         //add this, it makes the nail stop 
                        
                              if (other.solid == SOLID_BSP && other != world) 
                              { 
                                 self.owner = other; 
                                 self.pos1 = self.origin; 
                                 self.pos2 = other.origin; 
                                 self.aflag = time + 10; 
                                 self.think = spike_stuck_think; 
                                 self.nextthink = time; 
                              } 
                              else 
                              { 
                                 self.nextthink = time + 20;     //add this, to prevent packet overflows 
                                 self.think = SUB_Remove;        //add this for same reason as above 
                              } 
                        };
                        /*
                        ================
                        W_FireArrow
                        ================
                        */
                        void() W_FireArrow =
                        {
                        	local	entity missile;
                        	
                        	self.currentammo = self.ammo_arrow = self.ammo_arrow - 1;
                        	
                        	sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
                        
                        	self.punchangle_x = -2;
                        
                        	missile = spawn ();
                        	missile.owner = self;
                        	missile.movetype = MOVETYPE_FLYMISSILE;
                        	missile.solid = SOLID_BBOX;
                        	missile.classname = "missile";
                        		
                        // set missile speed	
                        
                        	makevectors (self.v_angle);
                        	missile.velocity = aim(self, 1000);
                        	missile.velocity = missile.velocity * 1000;
                        	missile.angles = vectoangles(missile.velocity);
                        	
                        	missile.touch = arrow_touch;
                        	
                        // set missile duration
                        	missile.nextthink = time + 5;
                        	missile.think = SUB_Remove;
                        
                        	setmodel (missile, "progs/arrow.mdl");
                        	setsize (missile, '0 0 0', '0 0 0');		
                        	setorigin (missile, self.origin + v_forward*8 + '0 0 16');
                        
                        };
                        This mod is far from done i still have lots of bugs to work out but at least its shoots now

                        a special thanks to

                        preacher for the nail in the wall code
                        OoPpEe for making the nail in the wall better
                        seven for teaching me this and so many other mods
                        gnounc for taking the time to look at the code and getting me back on track
                        spike for helping me understand IT2
                        goldenboy for his overview explanation of how to add a weapon
                        rook for his post on inside3d that have nothing to do with this but helped me understand a few things
                        ID1 for the base code
                        everyone who worked on drake and hexen for the mdl files

                        and a no special thanks but a enthusiastic I understand better now to
                        Mad Gypsy for always taking the time
                        Attached Files

                        Comment


                        • #87
                          Good job, JD!

                          @me stuff - honestly, there was no room to help you (lol). You had the most powerful players in the game posting one on top of the other and even I was like "holy fuck!". In a sense you could even say that I was out of my league. I could have told you everything they did, the difference is that I would have had to go spend some time gaining the full scope first. Whereas, everyone else here just already knew it.

                          I also know that items2 would have never even crossed my mind. I would have figured out a way to shove it in items, and that might not have been the best way.
                          http://www.nextgenquake.com

                          Comment


                          • #88
                            Im grateful for your post where you have helped me but you don't like thankyou so you got the i understand better

                            Comment


                            • #89
                              you don't like thank you's
                              It's not that weird, bro. Meaning, I'm not a "thank you" occupier. I am melodramatic . I just want to really help people. I've learned that "thank you" doesn't always mean something was accomplished.

                              However, in this case it's obvious. You did a good job. There is also so much information in this thread with regard to items that, I doubt anyone that finds this page will have any more questions.

                              Maybe people should thank you for instigating a multi-part thesis on items. See, I knew you deserved my invisible award.

                              @award - FYI - there's Emmys, Grammys, etc - you won the Zommby. It looks somethin like this:

                              Last edited by MadGypsy; 06-18-2013, 08:00 PM. Reason: I learned how to spell "mellow dramatic"! It finally occured to me how contradictory that is.
                              http://www.nextgenquake.com

                              Comment


                              • #90
                                Hello Josh,

                                How does Nova like your new weapon ?
                                There seems to be still the "no weapon" bug in your mod.
                                But you will surely pull out this last evil seed too...

                                Your clips always seem to run at a higher time speed.
                                Or is your crossbow really shooting that fast ?

                                If you are still interested in that crossbow skin we talked about,
                                here it is:


                                You should be able (after clicking the thumbnail) to right click on the big sized texture and save it. Its size must be 1024x512.
                                This forum doesnt allow me to upload the 250 KB file as an attachment.
                                If it doesnt work we can try via mail.

                                Best wishes,
                                Seven

                                Comment

                                Working...
                                X