Inside3D!
     

Reload working.... kinda
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Mon Jan 11, 2010 10:30 pm    Post subject: Reply with quote

yea, we are using basic quake for this. So your knowledge of porting quake to darkplaces will all that. And i would happily export my models to .md3. We have "male" and "female" models, since the zombies are humanoid, a simple retexturing would suffice as a player model. This is intended for psp, but we will organize and release it for PC (due to its ease). If you code for us and are officially on the team you will have our resources at your disposal so you would be able to use them for your darkplaces port. In fact, i think we should release it for DP instead of FitzKurok (like origonally planned).

P.S. do you know the answer to my (on topic) question at the bottom of me previous post?
Back to top
View user's profile Send private message
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Mon Jan 11, 2010 11:13 pm    Post subject: Reply with quote

Ghost_Fang wrote:

To stay on topic:
I have learned even more since my last post, instead of trying to bind the entire code to an impulse command, i learned how to make a whole new void() blah function and use it that way. Which means i started from scratch.


I dont think you started from scratch IMHO but whatever...

Ghost_Fang wrote:

And got it how i wanted it, using r00k's cache idea (not code). So now it works how i want it except i get an unknown frame macro : $reload when i want it to call upon those frames. where do i tell it what $reload is?


You have to make a generic $reload macro for the player.
$frame reload1 reload2 reload3 reload4
and of course add those frames to your player models.
This could show a simple hand gesture as if the player is putting in a new clip in the gun, not required but otherwise during reload you are going to appear idle to everyone else in the game.

next you have to make a functions for the reload

void() player_reload1 = [$reload1, player_reload2] {self.weaponframe=5;};
void() player_reload2 = [$reload2, player_reload3] {self.weaponframe=6;};
void() player_reload3 = [$reload3, player_reload4] {self.weaponframe=7;};
void() player_reload4 = [$reload4, player_run] {self.weaponframe=8;W_Reload_Ammo()};


player_reload1(); can be called via impulse 40 and remove the player_reload() in w_reload_ammo().

Your weapon models in this case would have the reloading sequence from frame 5 - 8, with the 1 - 4 as the normal firing animations. In the engine weaponframe tells the engine which frame to display for the weapon model.
Back to top
View user's profile Send private message
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Tue Jan 12, 2010 1:40 am    Post subject: Reply with quote

Quote:
I dont think you started from scratch IMHO but whatever...


Code:
void() W_reload =
{
         self.currentammo = self.ammo_pistol = 8;
         self.ammo_shells = self.ammo_shells - self.ammo_pistol_r;
         self.ammo_pistol_r = self.ammo_pistol_r = 0;
         self.weaponframe = $reload;
};


ammo_pistol_r is the "cache"

and this is inside W_fireshotgun

Code:
self.currentammo = self.ammo_pistol = self.ammo_pistol - 1;
   self.ammo_pistol_r = self.ammo_pistol_r + 1;


I dont see what would make you think i didnt start from scratch. I took what i had in my sloppy impulse command, made a W_reload function, and tweaked it so it only take the ammo you reload from shells instead of always 8 using ammo_pistol_r.

Player model reload animations arent an issue atm.
I just want view model reload animation.
In what .qc do i put it in? I looked and the only logical place is player.qc, if so then where? It wouldn't be models.qc would it? that isnt even in progs.src to be loaded into the compiler.
Back to top
View user's profile Send private message
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Tue Jan 12, 2010 3:22 am    Post subject: Reply with quote

Backtrack this thread from the top. Examine the code I provided. If you wont learn how it works, you're not going to succeed at this project.

oh and your fire shotgun code is adding free bullets to your clip everytime you shoot, infinite ammo.
Back to top
View user's profile Send private message
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Tue Jan 12, 2010 5:16 am    Post subject: Reply with quote

ok thanks for pointing that out, thats an easy fix.
And yes i can clearly see your code, but i dont know all the terminology quite yet, so whats a macro, where do i make the "generic $reload macro" and all i want it for is the view model.
looking at your code why is there more than one void() for the frames, why cant there be just one for a bunch of frames? And at least i am taking the initiative to learn quakec and try to help my team, instead of my team sitting around and playiig with their weeners til a coder comes around. I can kinda sense some frustration in your text. I obviously have seen your previous posts, so looking back would be like repeating yourself instead of saying in a different way. I want you to speak dumb for me, but dont speak down at me. But i do appreciate the help you have given me so far, and i owe you most of the credit that got me this far.
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Tue Jan 12, 2010 6:14 am    Post subject: Reply with quote

the macro's really arnt needed.

you could do animations like so:

Code:
void()  player_ReloadShotgun =[   0,   player_ReloadShotgun   ]
{
   local float newammo;

   if (self.weaponframe == 0)
      self.weaponframe = 1;

   if (self.weaponframe < 6) {
      self.weaponframe = self.weaponframe + 1;
   } else {
      self.exammo_primary = self.exammo_primary + self.ammo_shells;
      self.ammo_shells = 0;
      newammo = self.exammo_primary;
      if (self.exammo_primary > 10) {
         newammo = 10;
      }
      self.exammo_primary = self.exammo_primary - newammo;
      self.currentammo = newammo;
      self.ammo_shells = newammo;
      player_run ();
      return;
   }
};


btw this code isnt from me thnx downsider...
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Tue Jan 12, 2010 6:31 am    Post subject: Reply with quote

Quote:

I can kinda sense some frustration in your text


Ya, I know. I wasnt trying to be a jerk, I just suck at teaching.

You could put it in player.qc or weapons.qc if you prefer.

Hmm, i just realized you have been here before asking about the reload code with UrbanKid. Baker suggested getting this file
http://www.quaketerminus.com/mods/navy3.zip
it has some v_ models with reloading animations. I'm sure they wouldnt mind using their models if u gave them credit.

I skimmed thru the source, and it seems they are calling the reload animations similar to how I suggested. The part that handles actual ammo inventory is different and in some cases incomplete, eh well that mod was made in 1998 Wink but cool none the less. Wish there were people making models like this now a days. that "pdude.mdl" is awesome! Razz
Back to top
View user's profile Send private message
LonePossum.



Joined: 02 Nov 2009
Posts: 38

PostPosted: Sat Jan 16, 2010 12:56 am    Post subject: Reply with quote

Maybe this can help.
http://www.moddb.com/games/solitude/tutorials/adding-reloading-to-quake/#1063175
Ark did I little tutorial on it, Though looks like Downsider said it could be cleaned up a lil, I might have a play with the code.

Peace
Back to top
View user's profile Send private message
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Sat Jan 16, 2010 2:25 am    Post subject: Reply with quote

LonePossum. wrote:
Maybe this can help.
http://www.moddb.com/games/solitude/tutorials/adding-reloading-to-quake/#1063175
Ark did I little tutorial on it, Though looks like Downsider said it could be cleaned up a lil, I might have a play with the code.

Peace


There's a redundancy in the first function he tells you to replace, the reload function could be made shorter and a bit simpler (Simpler in my opinion, anyway), and the tutorial's layout itself is messy and hard to read.
Back to top
View user's profile Send private message
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Sat Jan 16, 2010 7:15 am    Post subject: Reply with quote

I shouldnt reply as i havent seen the link's code, nor in my defense have i compiled or even tested any code i posted in this thread. I was merely using the discussion as a psuedo _code scratch pad, albiet, quakeC, to help him succeed, trying not to fail, learning along the way as we all do.
Back to top
View user's profile Send private message
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Sun Jan 24, 2010 2:28 am    Post subject: Reply with quote

where would i put the self.nextthink = time + X.X
for reloading, so the player cant shoot during reload.

Here is the code:

Code:
void() W_preload =
{
   if (self.ammo_pistol == 15)
      {
      return;
      }
       else      
         player_reload1();
         sound (self, CHAN_AUTO, "misc/reload_p.wav", 1, ATTN_NORM);
         self.currentammo = self.ammo_pistol = self.ammo_pistol + self.ammo_pistol_r;
         self.ammo_shells = self.ammo_shells - 0;
         self.ammo_pistol_r = self.ammo_pistol_r = 0;
};


Here is the animation frames just in case.

Code:
void()   player_reload1 =   [$reload1, player_reload2] {self.weaponframe=8;};
void()   player_reload2 =   [$reload2, player_reload3] {self.weaponframe=9;};
void()   player_reload3 =   [$reload3, player_reload4] {self.weaponframe=10;};
void()   player_reload4 =   [$reload4, player_reload5] {self.weaponframe=11;};
void()   player_reload5 =   [$reload5, player_reload6] {self.weaponframe=12;};
void()   player_reload6 =   [$reload6, player_reload7] {self.weaponframe=13;};
void()   player_reload7 =   [$reload7, player_reload8] {self.weaponframe=14;};
void()   player_reload8 =   [$reload8, player_reload9] {self.weaponframe=15;};
void()   player_reload9 =   [$reload9, player_reload10] {self.weaponframe=16;};
void()   player_reload10 =   [$reload10, player_reload11] {self.weaponframe=17;};
void()   player_reload11 =   [$reload11, player_reload12] {self.weaponframe=18;};
void()   player_reload12 =   [$reload12, player_reload13] {self.weaponframe=19;};
void()   player_reload13 =   [$reload13, player_reload14] {self.weaponframe=20;};
void()   player_reload14 =   [$reload14, player_reload15] {self.weaponframe=21;};
void()   player_reload15 =   [$reload15, player_reload16] {self.weaponframe=22;};
void()   player_reload16 =   [$reload16, player_reload17] {self.weaponframe=23;};
void()   player_reload17 =   [$reload17, player_reload18] {self.weaponframe=24;};
void()   player_reload18 =   [$reload18, player_reload19] {self.weaponframe=25;};
void()   player_reload19 =   [$reload19, player_reload20] {self.weaponframe=26;};
void()   player_reload20 =   [$reload20, player_reload21] {self.weaponframe=27;};
void()   player_reload21 =   [$reload21, player_reload22] {self.weaponframe=28;};
void()   player_reload22 =   [$reload22, player_reload23] {self.weaponframe=29;};
void()   player_reload23 =   [$reload23, player_run]     {self.weaponframe=30;};


Yea i know... alot... lol our animator made a nice and smooth animation and refused to change it to fewer frames :\
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Sun Jan 24, 2010 3:03 am    Post subject: Reply with quote

there's an easier way to set frames with out using all of those macros...
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Sun Jan 24, 2010 3:16 am    Post subject: Reply with quote

care to explain? lol
thats just the noob way that i used, cause im a noob lol
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Sun Jan 24, 2010 5:41 am    Post subject: Reply with quote

here's an example of my playerdie function :

Code:
void () PlayerPain =
{
   if (self.apriority < ANIM_PAIN)
   {
      self.apriority = ANIM_PAIN;
      self.frame = 80;
      self.endframe = 85;
   }
   PainSound();
};

_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Sun Jan 24, 2010 7:32 am    Post subject: Reply with quote

Umm i think i see it, how would i "convert" my macros though, like can you show me how mine would look, or could you show me the "expanded" for of what you have right there?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group