Forum

Changing the skin of a weapon?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Changing the skin of a weapon?

Postby Mexicouger » Sun Jun 13, 2010 11:43 pm

Well, Instead of Having a weapon have some crazy animation when Changing, I thought a nice texture change would be nice. So here is My code


*
========================
Blaster sniper add-on
========================
*/
void() W_FireSniper =
{
local entity missile, mpuff;
self.currentammo = self.ammo_sniper = self.ammo_sniper -= 1;
sound (self, CHAN_WEAPON, "weapons/sniper.wav", 1, ATTN_NORM);
self.skin = 1;
self.punchangle_x = -3;

missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_FLYMISSILE;
missile.solid = SOLID_BBOX;
missile.classname = "Sniper";

// set missile speed

makevectors (self.v_angle);
missile.velocity = aim(self, 1000);
missile.velocity = missile.velocity * 10000;
missile.angles = vectoangles(missile.velocity);

missile.touch = BulletTouch;

// set missile duration
missile.nextthink = time + 5;
missile.think = SUB_Remove;
missile.frame += 1;

setmodel (missile, "progs/sniper.mdl");
setsize (missile, '0 0 0', '0 0 0');
setorigin (missile, self.origin + v_forward*8 + '0 0 16');
};

It is for My mod Prime, And I know I set up the texture to change when Shot(I will change it to change when you change weapons).

But basically, I want it to Change from skin 0, To skin 1.
So I tried
self.skin = 1;
Yes, I know I mixed up entities, And It did change my player color. But What is an entity for the weapon itself? It wouldn't be missile or mpuff would it?

Thanks alot,
Mexicouger
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Dr. Shadowborg » Sun Jun 13, 2010 11:56 pm

No, missile refers to the actual projectile, mpuff is an unused entity handle.

There is no way to change a weapon skin within the framework of normal quake, outside of switching the weapon model for a duplicate of the model your using with the alternate skin as the primary. (the other method requires using darkplaces or another engine with the required extensions to spawn the weapon model as a separate entity)

This does of course, suck. (/me want .weaponskin so badly)
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby Mexicouger » Mon Jun 14, 2010 12:50 am

Dang... I feared this....
Well, Even if there does become A solution, I am using psp Kurok engine. And changing models Screws up alot.
Isn't Changing models rather than Changing skin Bad? I mean, It has to precache Another model and Load it, When It could just load another skin..

Sigh...
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Dr. Shadowborg » Mon Jun 14, 2010 1:32 am

Mexicouger wrote:Isn't Changing models rather than Changing skin Bad? I mean, It has to precache Another model and Load it, When It could just load another skin..


If it's a weapon model, then it should already be precached by the QuakeC code when you start a game. (or rather, you should be precaching it in your code.)

As for changing the model, it shouldn't be all that bad...I do it in Hellsmash for the blaster...
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby ceriux » Mon Jun 14, 2010 1:55 am

yeah... .weaponskin is needed =(
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby gnounc » Mon Jun 14, 2010 7:38 am

I agree...I currently just keep a different .mdl handy : (
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest