Forum

Issue with Class and NEW weapon type...

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Issue with Class and NEW weapon type...

Postby ceriux » Sun Oct 18, 2009 2:54 am

anyways guys i think iv been trying to fix this on my own for well over an hour... iv asked on irc and it seems like i might have been ignored (although the people who would have helped might have been idle...) So im posting this here.

basically iv added in a new sniper weapon... the weapon works fine accept for when its applied to my class. all other vanilla quake weapons work fine even after being edited. iv made a video explaining everything and a pastebin post. so as you can tell i really need help fixing this i cannot figure it out... iv put a good amount of effort in just getting up enough data to really show the problems im having so hopefully you can see that im really having an issue and not just asking people to do things for me. anyways ....

here's the links

Pastebin ( functions in which i think the problems are ) : http://pastebin.com/m72170ec8

youtube video with commentary on whats happening : http://www.youtube.com/watch?v=uCGQEIbY_7g
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Downsider » Sun Oct 18, 2009 3:14 am

Try setting parm8 to IT_SNIPER or IT_AXE, if I'm not mistaken that's probably what's causing it. If not, then I need to see more, but somebody else might not have to ;)
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby ceriux » Sun Oct 18, 2009 3:43 am

ahh thanks that fixed my weapon spawning issue =)


but now i made my own weapon cycle code and once again it works for ALL weapons but the sniper , actually the sniper crashes the game/server.


here's my cycle wep code :

Code: Select all
/*
============
CycleWeaponCommand

Go to the next weapon with ammo
============
*/
void() CycleWeaponCommand =
{
   local   float   it, am;
   
   it = self.items;
   self.impulse = 0;
   
   while (1)
   {
      am = 0;

   if (self.pclass == 1 && self.weapon == IT_AXE)
   {
      self.weapon == IT_NAILGUN;
      am = 1;
   }
   else if (self.pclass == 1 && self.weapon == IT_NAILGUN)
   {
      self.weapon == IT_AXE;
   }
   if (self.pclass == 2 && self.weapon == IT_AXE)
   {
      self.weapon == IT_SNIPER;
      am = 1;
   }
   else if (self.pclass == 2 && self.weapon == IT_SNIPER)
   {
      self.weapon == IT_AXE;
   }
   if (self.pclass == 3 && self.weapon == IT_AXE)
   {
      self.weapon == IT_SHOTGUN;
      am = 1;
   }
   else if (self.pclass == 3 && self.weapon == IT_SHOTGUN)
   {
      self.weapon == IT_AXE;
   }
   if (self.pclass == 4 && self.weapon == IT_AXE)
   {
      self.weapon == IT_ROCKET_LAUNCHER;
      am = 1;
   }
   else if (self.pclass == 4 && self.weapon == IT_ROCKET_LAUNCHER)
   {
      self.weapon == IT_AXE;
   }
   
      if ( (it & self.weapon) && am == 0)
      {
         W_SetCurrentAmmo ();
         return;
      }
   }

};

/*
============
CycleWeaponReverseCommand

Go to the prev weapon with ammo
============
*/
void() CycleWeaponReverseCommand =
{
   local   float   it, am;
   
   it = self.items;
   self.impulse = 0;

   while (1)
   {
      am = 0;

      if (self.pclass == 1 && self.weapon == IT_AXE)
   {
      self.weapon == IT_NAILGUN;
      am = 1;
   }
   else if (self.pclass == 1 && self.weapon == IT_NAILGUN)
   {
      self.weapon == IT_AXE;
   }
   if (self.pclass == 2 && self.weapon == IT_AXE)
   {
      self.weapon == IT_SNIPER;
      am = 1;
   }
   else if (self.pclass == 2 && self.weapon == IT_SNIPER)
   {
      self.weapon == IT_AXE;
   }
   if (self.pclass == 3 && self.weapon == IT_AXE)
   {
      self.weapon == IT_SHOTGUN;
      am = 1;
   }
   else if (self.pclass == 3 && self.weapon == IT_SHOTGUN)
   {
      self.weapon == IT_AXE;
   }
   if (self.pclass == 4 && self.weapon == IT_AXE)
   {
      self.weapon == IT_ROCKET_LAUNCHER;
      am = 1;
   }
   else if (self.pclass == 4 && self.weapon == IT_ROCKET_LAUNCHER)
   {
      self.weapon == IT_AXE;
   }
   
      if ( (it & self.weapon) && am == 0)
      {
         W_SetCurrentAmmo ();
         return;
      }
   }

};



EDIT: Im pretty sure parm 8 has to remain self.weapon. my weapon cycle code causes all classes to crash since i applied it to them.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Downsider » Sun Oct 18, 2009 4:11 am

parm8 should remain self.weapon on level exit, only IT_AXE or IT_SNIPER when first created.. Though your new problem, I don't have time to look at it, but you're probably creating an infinite loop with the while (1). I dunno if Quake can escape an infinite loop in QC or not.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby ceriux » Sun Oct 18, 2009 4:46 am

its ok i got the scroll fixed and the spawn fixed minus still with the sniper class.... for some reason the sniper still spawns with the shotgun i have an idea on what it might be so im going to check it out before i post anything else. thanks again Downsider!


No... not fixed... Downsider if i sent you my source. could you take a look at it? everythings been working perfectly till i decide to do the easiest thing around "add a new weapon" -.-
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Downsider » Sun Oct 18, 2009 12:04 pm

Of course. You helped me with getting my model into Quake, so I can surely help you :)
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest