Weapon Skins

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Weapon Skins

Post by Amuscaria »

Is it possible to skins for weapons? Similar to how a player skin swaps out corresponding images for PLAYXXXX, and sounds, does ZDoom support skins for weapons?
User avatar
Tapwave
Posts: 2096
Joined: Sat Aug 20, 2011 8:54 am
Preferred Pronouns: No Preference
Graphics Processor: nVidia with Vulkan support

Re: Weapon Skins

Post by Tapwave »

You could do this by making class-based replaces (Wasn't there something for this on recent versions?) but that's not really a "skin" per se.
User avatar
amv2k9
Posts: 2178
Joined: Sun Jan 10, 2010 4:05 pm
Location: Southern California

Re: Weapon Skins

Post by amv2k9 »

Couldn't you have states in the player actor definition check for currently equipped weapon and then have if true, have it jump to a version of the state with appropriate sprites?
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Weapon Skins

Post by Amuscaria »

Can I actually check for the players skin? I was going to include both a normal doom guy and the DE-gal in the next beta. Was thinking of making modified weapons for weapons where the hands are visible.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Weapon Skins

Post by NeuralStunner »

I know you can define mugshots in skin defs, but I'm pretty sure there is no similar case for weapons.

Personally I think you should make them into separate classes, and skip the skin system.
User avatar
cq75
Posts: 1212
Joined: Sun Dec 27, 2009 9:28 pm
Graphics Processor: nVidia with Vulkan support
Location: Just beyond the line horizon

Re: Weapon Skins

Post by cq75 »

I currently use classes as skins in my mod, the only real disadvantage is that players need to die before changing a skin for the change to take effect.

EDIT - also, skins are clientside, classes are not.
User avatar
HellCattX
Posts: 506
Joined: Thu Feb 26, 2009 2:10 pm

Re: Weapon Skins

Post by HellCattX »

i'd say use a dummy tagger fake inventry item for your charater, then use a a_jumpifininventory to jump to the approprate weapon skin, its what i use in my mod urban pacification.

like Player A has start item purse, and player B has start item watch, when you pick up the weapon, if you have start item purse, The jump will let you'll have the female handed weapon, if you have start item watch, you get the male handed weapon for instance.
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Weapon Skins

Post by Amuscaria »

hm...using classes is way too much work to something that does nothing but change the appearance. Guess I'll just leave it as the female only.
User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

Re: Weapon Skins

Post by Ghastly »

Skulltag has this built in, but the only real way to do that in (G)ZDoom is with A_JumpIfInventory in the player's states and have the weapon give a fake inventory item to check for in the Select state and take it away in Deselect.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Weapon Skins

Post by NeuralStunner »

Seems to be confusion about what Eriance is asking for. I got the impression he wants the HUD sprites to change based on the chosen skin.
User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

Re: Weapon Skins

Post by Ghastly »

Oh, derp. Yeah, I can't think of a way.
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Weapon Skins

Post by Amuscaria »

NeuralStunner wrote:Seems to be confusion about what Eriance is asking for. I got the impression he wants the HUD sprites to change based on the chosen skin.
Yes that.
User avatar
zrrion the insect
Posts: 2432
Joined: Thu Jun 25, 2009 1:58 pm
Location: Time Station 1: Moon of Glendale

Re: Weapon Skins

Post by zrrion the insect »

I've ran into similar problems, here's what I've done:
I edited the weapon so that it never actually spawns in game, but a "powerup" spawns instead.
This powerup would look like the weapon, but when you pick it up it would check for which player you were, and give you a different weapon.

It gets really complicated, especially if you change the amount of ammo/Powerup duration based on class the classes.
User avatar
ChronoSeth
Posts: 1631
Joined: Mon Jul 05, 2010 2:04 pm
Location: British Columbia

Re: Weapon Skins

Post by ChronoSeth »

Again, that works for player classes, not skins.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Weapon Skins

Post by Gez »

If you have the HUD weapon sprites in double, then you have the hardest part behind you already. The rest is a question of copy/pasting.

Make either the male or the female player class get a token item among its startup items. Let's say the male player class.

Now, for the weapon class:

Code: Select all

ACTOR DEPistol : Pistol 5010
{
	States
	{
	Ready:
		"####" A 1 A_WeaponReady
		Loop
	Deselect:
		"####" A 1 A_Lower
		Loop
	Select:
		PISG A 0 A_JumpIfInventory("DoomGuyToken", "ManlySelect")
		PISG A 1 A_Raise
		Loop
	ManlySelect:
		PIS2 A 1 A_Raise
		Loop
	Fire:
		"####" A 4
		"####" B 6 A_FirePistol
		"####" C 4
		"####" B 5 A_ReFire
		Goto Ready
	Flash:
		PISF A 7 Bright A_Light1
		Goto LightDone
		PISF A 7 Bright A_Light1
		Goto LightDone
 	Spawn:
		PIST A -1
		Stop
	}
}
What is happening here? Simple: the [wiki]sprite[/wiki] name #### means "keep previous sprite name". When the weapon is selected, that sprite name is initialized to PISG, which is the DoomGirl HUD sprite set. But we've got a check to see if there is a DoomGuyToken in the player inventory. If so, we go to the ManlySelect state, where the sprite name is changed to PIS2, which is the DoomGuy HUD sprite set. Afterwards, the sprite name is never changed.

Note the flash states. I left them as they are, assuming that the flash sprite itself (just the muzzle flash and lit up parts of the gun) would be identical across all players. If that's not the case, you can use the same trickery, basically, though there's some added subtlety.
Locked

Return to “Editing (Archive)”