Confusing error

Discuss programming in the QuakeC language.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

ooppee wrote:Partially on the same topic I did this tutorial.
http://qexpo2005.quakedev.com/booths/dr ... g/126.html
All appears to be fine with the weapon adding. I pick it up, it ONLY gives me that weapon. I have it selectable and all too.
Hoo man that thing is old, moldy and had a flaw in that it didn't update the selected weapon icon on the sbar. (fairly minor, and if it had been done properly, it would have partially resembled Half-Life's in that each icon would have represented a weapon category instead. :P )

The proper way of doing this now would be to simply use the original self.weapon = IT_* with self.weapon2 being simply a secondary check to see if the player is using the new weapon instead.

That said, to (hopefully) fix what you want with it as it is now:

Code: Select all

else if (self.weapon == IT_MULTI_ROCKET) 
      { 
         self.weapon = IT_LIGHTNING; 
         if (self.ammo_cells1 < 1) 
            am = 1; 
      } 
      else if (self.weapon == IT_LIGHTNING) 
      { 
         self.weapon = 0;
         self.weapon2 = IT3_CLIGHTNING; //ooppee chainlightning, make Lightning Gun go to Chainlighting and after this chain -> Plasma 
         if (self.ammo_cells1 < 1) 
            am = 1; 
      } 
      else if (self.weapon2 == IT3_CLIGHTNING) //ooppee chainlightning make it go to Plasma gun after 
      { 
         self.weapon2 = 0;
         self.weapon = IT_PLASMA_GUN; 
         if (self.ammo_plasma < 1) 
            am = 1; 
      } 

      if ( (it & self.weapon | self.weapon2) && am == 0) //added weapon2 
      { 
         W_SetCurrentAmmo (); 
         return; 
      } 
   } 

};
Note that you WILL have to modify the last lines there so that it will compare self.weapon2 with your self.items3 field, rather than blanket comparing it to your self.items field as it does now.
ooppee
Posts: 70
Joined: Thu Oct 28, 2010 2:57 am

Post by ooppee »

Figured it was that (setting weapon2 to 0 on all other guns).

Yeah you are correct on the Half-Life HUD. Kind of what I've wanted but have heard you cannot edit the HUD via QC.
My thing for HUD that'd be ideal would be (Grenade area as a example):

if Normal Grenade Selected: Displays standard Icon
If Prox Grenade Selected: Displays MP1 Icon
If Multi-Grenade Selected: Displays MP2 Icon
If QTest Grenade Selected: Displays custom icon

However I'd love the HL1 weapon selection "menu". Currently everything is fine HUD wise minus the QTest/Hipnotic weapons not appearing on the Hud. Not noticeable if you have the 2nd last size option set (to where only health, armor, ammo are shown). Shows all the right ammo - just selected weapon icon is wrong for non-missionpack2/id1 weapons (I'm using Rogue's QC as a base).



I would prefer that whole "secondary" weapon Idea. However couldn't figure it out and would it "fix" the issue of the HUD showing the wrong icon still? Like having Prox be a alt of IT_GRENADE - have it so "if alt" use this model and fire code. Would it still be possible to have the icon change to a Prox icon - or would still show the standard Grenade icon?

I know that QC editing will not let you change the HUD (correct me if I am wrong). I am wondering how did the Hipnotic/Rogue packs change the HUD (adding in the extra icons and all) do it?
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

ooppee wrote: ...
I would prefer that whole "secondary" weapon Idea. However couldn't figure it out and would it "fix" the issue of the HUD showing the wrong icon still? Like having Prox be a alt of IT_GRENADE - have it so "if alt" use this model and fire code. Would it still be possible to have the icon change to a Prox icon - or would still show the standard Grenade icon?

I know that QC editing will not let you change the HUD (correct me if I am wrong). I am wondering how did the Hipnotic/Rogue packs change the HUD (adding in the extra icons and all) do it?
Unfortunately not, all it would do is show the grenade icon. You could modify things so that it would show either the prox or multi, but not both as the HUDs are hardcoded in the engine, acessable only with -hipnotioc (MP1) and -rogue (MP2) (mutually exclusive).

This is because MP1/MP2 were "Official" missionpacks and as such, iD modified the engine to reflect this.

At this time the only ways around this is to:

1. Modify the engine. (thereby locking users into your modified engine)
2. Use CSQC. (thereby locking users into Darkplaces / FTEQW)

In the future once frag.machine finishes his hudscript thing,(probably a long ways off still) it will hopefully be adopted as a new engine standard.
ooppee
Posts: 70
Joined: Thu Oct 28, 2010 2:57 am

Post by ooppee »

Ah well crap for that.

Using the current code I have though, what would I have to change to make it show the ID1 equal?
Like the:
Grenade/QTest Grenade/Prox Mine/Multi Gren
All use the Grenade Launcher (ID1) icon.

That way I can simply edit the ID1 icon to represent the "weapon group" and just simply make it print text in the corner to say which version of the Grenade Launcher is selected (like in MP2) and using the weapon model itself.

I am assuming it's the "self.weapon = IT_(NAMEHERE); " and if so, what would I do to allow the self.weapon2 part call the icon without it forcing a switch into it.

I don't mind rewriting the selection code as the hard part is the firing itself. I haven't found a good "Alternate Gun" tutorial. I tried and it generally would cause either crashes or once you got the Alt gun - the old wouldn't be selectable any more.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

ooppee wrote:Using the current code I have though, what would I have to change to make it show the ID1 equal?
Give me till tomorrow and I'll have a solution worked out for you. :wink: (It's fairly complex, because there may be times when you can pick up a prox / multi launcher but NOT have the base weapon...and since you need to have the base weapon in your self.items for the icon to show properly...)
ooppee
Posts: 70
Joined: Thu Oct 28, 2010 2:57 am

Post by ooppee »

Yeah that would be a issue I never thought of until now lmao - I do know picking up the Grenade Launcher in DoE also "fakes" a pickup of the Multi-Grenade Launcher as it's pickup doesn't exsist - just is enabled when you get the Multi-Ammo. Does the same for the Lava Nailguns, Multi Rocket and Plasmagun.

The Prox Launcher on the otherhand is a Separate weapon. Uses same ammo but you need to get the gun. Likewise for the Laser Cannon and Mjolnir.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

Okay, I'll have it ready by tomorrow. (right now at about 90%, just have to fix issues in weapon_touch and backpacktouch.) :oops:

It's amazing how much of a PITA something as simple as remembering which weapon from what group was last used (so that when you press the direct selection key it brings up the weapon you were last using, not the first weapon), remembering what weapon you were using for next level change, and weapon cycling can be... :shock:
ooppee
Posts: 70
Joined: Thu Oct 28, 2010 2:57 am

Post by ooppee »

Actually am fine with "Direct Button" selecting the first. Do want it to be tapped like in the Mission Packs - Pushing 4 in MP2 brings up NailGun, push again brings up LavaNG. If you switch weapons and push 4 again - it's NG brought up (eventhough LavaNG was last used). You can however select the weapon directly (Lava) via Impulse 60.
All the others though yeah it would become issues. Weapon cycling I did get working as per your previous fix - however I am assuming this fix changes much of that.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

ooppee wrote:Actually am fine with "Direct Button" selecting the first. Do want it to be tapped like in the Mission Packs - Pushing 4 in MP2 brings up NailGun, push again brings up LavaNG. If you switch weapons and push 4 again - it's NG brought up (eventhough LavaNG was last used). You can however select the weapon directly (Lava) via Impulse 60.
All the others though yeah it would become issues. Weapon cycling I did get working as per your previous fix - however I am assuming this fix changes much of that.
Kinda late on that first point, I already set it up so that it remembers what your last selected weapon was for a category. You can probably change it though.

Sorry about shoving another tutorial at you, but there really wasn't any way around this...And besides, it serves a dual purpose for getting a proper added weapons tutorial that works up.

http://forums.inside3d.com/viewtopic.php?p=34671

That should work, unless I've forgotten something. You WILL have to modify it for what you need though as I don't have your QC source.
ooppee
Posts: 70
Joined: Thu Oct 28, 2010 2:57 am

Post by ooppee »

Thanks! I will be incorperating it in. Easy to do. All of the code I've edited is heavily commented with //ooppee (what weapon it effects) - (what it does)

So restarting the mod with fresh QC and applying your code and then inserting my changes will be a very quick ordeal.
Post Reply