Inside3D!
     

skin changing

 
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: Tue Jan 26, 2010 3:13 am    Post subject: skin changing Reply with quote

Alright is it possible, to change a skin by the press of a button? Like lets say i make a separate skin for the quake shotty, nice hot pink. lol. can i code a function for it to switch skins with the press of a button. OR if these certain animations are playing have a certain skin. How would i do either of those?
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Tue Jan 26, 2010 3:28 am    Post subject: Reply with quote

A rough skeleton of how press a button skin changes would work:

Bind an impulse to a key:

bind x "impulse 200"

In QuakeC, where the impulses are read (I'm thinking this in weapons.qc in ImpulseCommands function) have "if (self.impulse == 200) ChangeMySkin ();"

And have ChangeMySkin switch self.skin.

Something like this:

Code:

void ChangeMySkin ()
{
     if (self.skin == 1) self.skin =2;
     else self.skin =1;
}


Maybe a REAL QuakeC coder can critique what I wrote above if that doesn't work as-is.

I'm not Mr. QuakeC.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
ceriux



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

PostPosted: Tue Jan 26, 2010 4:22 am    Post subject: Reply with quote

either that or he could call that function in the weapon change code for when he changes to the shotty. since hes looking to change the skin when he selects a new weapon.

this may, or may not work. but you can try it.

Code:
else if (self.impulse == 2)
   {
      fl = IT_SHOTGUN;
      self.skin =2;
      if (self.ammo_shells < 1)
         am = 1;
   }


might be like... player.skin or something... idk. but something similar should work if this doesnt.

or maybe in player post think.

Code:
if (self.weapon == IT_SHOTGUN)
{
self.skin =2;
}

ect...

_________________
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: Tue Jan 26, 2010 4:34 am    Post subject: Reply with quote

No i can see it now, its actually quite easy lol.
Instead of starting a new thread (or should I?)

How would i be able to make a "charge" shot?
Like hold down the button to charge something?
and if you charge it for maybe so many seconds the power doubles or something? Then release to fire
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Tue Jan 26, 2010 5:01 am    Post subject: Reply with quote

Probably adding something to defs.qc like

.float currentCharge
.float isCharging

And having a hold down impulse and a release impulse ...

alias +charge "impulse 101" // When pressed, +charge
alias -charge "impulse 102" // When released, -charge
bind "enter" +charge

And when impulse 101 is detected in the qc (again maybe in weapons.qc in Impulsecommands) ...

Code:
if (self.impulse == 101)  self.isCharging = 1;  // begin charging
if (self.impulse == 102) self.isCharging = 0; // stop charging


Somewhere you will have code like

Code:
// If isCharging, add more to currentCharge
if (self.isCharging == 1) self.currentCharge == self.currentCharge + 0.25;


I am not sure where the best place to put the above code would be. And again, the above may need adaption and not work as-is.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
ceriux



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

PostPosted: Tue Jan 26, 2010 5:31 am    Post subject: Reply with quote

i think there's a tutorial for that in the tutorial section.
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Tue Jan 26, 2010 6:04 am    Post subject: Reply with quote

Note that you can't actually change the weapon model's skin (there is no ".weaponskin" field). You'll have to create a second copy of the model with the other skin, and swap out the model. But of course, if done in mid-animation, that can cause a "snap" in lerping on newer engines. Or else you can try something extra clever, like moving two differently textured polygons in and out of view on the model. Or... if you're not worried about old engine support you can use an extension like DP_ENT_VIEWMODEL.
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
ceriux



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

PostPosted: Tue Jan 26, 2010 6:11 am    Post subject: Reply with quote

why hasnt there been a .weaponskin extension made? seems kind of... weird that there hasnt been...
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
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