Custom weapon skin for my subclassed weapon?

Search and find cool skins and models, or introduce your own ones!
Post Reply
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Custom weapon skin for my subclassed weapon?

Post by 1337GameDev »

I created a custom weapon based on PulseGun, and want it to have a custom texture for it's pickup and left/right hand models.

How is this done? I know that actors generally have a field: MultiSkins but i'm unsure how this is used for models.

I have seen code similar to:

Code: Select all

Self.MultiSkins[0] = texture(DynamicLoadObject(NewPulseGunTexture ,class'Texture',false));
and don't see how this would work for the pickup and item meshes..... I assume this code will be placed in "PreBeginPlay" function?

I have already extracted and slightly modified the PulseGun texture, but unsure how to set it for my custom subclass....

I see the Texture property, but this seems to be the ACTOR property, such as the standard "HorseHead" for actors.

Ideas/ thoughts?
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Custom weapon skin for my subclassed weapon?

Post by sektor2111 »

Texture is representation of Actor in DrawType DT_Sprite - Navigation Points as a sample.
If actor has display DrawType DT_Mesh there is in account Skin or MultiSkins[x] depending on what sort of mesh has actor.
By example a pupae can be modified as a PulseGun based on MultiSkins[x], Skaarj it's using Skin.
I've adjusted these by adding actor in map and testing which section has to be altered using another stock Texture.

Stunts:
- textures can be configurable somewhere and loaded based on certain factors - maybe in whatever Auto State letting actors to be initialized if they are used to do this;
- using multiple options for actor Weapon itself auto morphing itself based on some INI.

For me "dynamicload" would be the last solution because I think it's slow, more slow than using an internal embedded texture or a package referenced.
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Custom weapon skin for my subclassed weapon?

Post by 1337GameDev »

I'll try what you suggest, and let you know if that works.
sektor2111 wrote: Fri Jul 23, 2021 8:29 pm If actor has display DrawType DT_Mesh there is in account Skin or MultiSkins[x] depending on what sort of mesh has actor.
By example a pupae can be modified as a PulseGun based on MultiSkins[x], Skaarj it's using Skin.
I added a custom Skin texture in the default properties block, and it didn't show up.... Why is this?
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Custom weapon skin for my subclassed weapon?

Post by 1337GameDev »

Is this only possible for PAWNS?

And is there extra flags / functions needed to be called, vs just setting Skin / MultiSkins(0) ?

I have an object that I want to use an existing mesh, and a custom skin, and it won't set the skin, but uses the existing mesh texture.... :/
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Custom weapon skin for my subclassed weapon?

Post by sektor2111 »

Like I said, certain Meshes can be altered with MultiSkins not Skin - see pupae as example.
I don't know if weapon won't do something with aspect when it's initialized, I'd rather prefer to wait a bit for assigning a different skin and perhaps changing default skin for that actor. Pawn usually won't alter their skins/multiskins unless they are custom ones doing this on purpose.

For pawn - let's consider a few stock types used in a map and all of them loading a custom skin. This Custom SpawnPoint generates a modified monster, player doesn't know that this Pawn is a stock one

Code: Select all

final function AddOtherProperties(ScriptedPawn S)
{
	local bool bInvalidTarget;
	local int PropNum;
	local E_CreatureFactory pawnFactory;

	pawnFactory = E_CreatureFactory(factory);

	bInvalidTarget = ( S == None || S.bDeleteMe || pawnFactory == None );

	if ( !bInvalidTarget )
	{
		for ( PropNum = 0; PropNum < 16; PropNum++ )
		{
			if ( pawnFactory.AProperty[PropNum] != "" && pawnFactory.AVal[PropNum] != "" )
				S.SetPropertyText(pawnFactory.AProperty[PropNum],pawnFactory.AVal[PropNum]);
		}
		if ( pawnFactory.Skin != None ) //Hosting skin here because it won't be seen in DT_Sprite
			S.Skin = pawnFactory.Skin;
		if ( pawnFactory.MultiSkins[0] != None ) //Same as above
			S.MultiSkins[0] = pawnFactory.MultiSkins[0];
		if ( pawnFactory.Multiskins[1] != None )
			S.MultiSkins[1] = pawnFactory.MultiSkins[1];
		if ( pawnFactory.MultiSkins[2] != None )
			S.MultiSkins[2] = pawnFactory.MultiSkins[2];
		if ( pawnFactory.MultiSkins[3] != None )
			S.MultiSkins[3] = pawnFactory.MultiSkins[3];
		if ( pawnFactory.Multiskins[4] != None )
			S.MultiSkins[4] = pawnFactory.MultiSkins[4];
		if ( pawnFactory.MultiSkins[5] != None )
			S.MultiSkins[5] = pawnFactory.MultiSkins[5];
		if ( pawnFactory.MultiSkins[6] != None )
			S.MultiSkins[6] = pawnFactory.MultiSkins[6];
		if ( pawnFactory.MultiSkins[7] != None )
			S.MultiSkins[7] = pawnFactory.MultiSkins[7];
		if ( pawnFactory.Style != STY_Normal )
			S.Style = pawnFactory.Style;
		if ( pawnFactory.LightBrightness > 0 ) //If needed
		{
			S.LightBrightness = pawnFactory.LightBrightness;
			S.LightHue = pawnFactory.LightHue;
			S.LightSaturation = pawnFactory.LightSaturation;
			S.LightRadius = pawnFactory.LightRadius;
			S.LightCone = pawnFactory.LightCone;
			S.LightEffect = pawnFactory.LightEffect;
			S.LightPeriod = pawnFactory.LightPeriod;
			S.LightPhase = pawnFactory.LightPhase;
			S.LightType = pawnFactory.LightType;
		}
		if ( pawnFactory.ScaleGlow != 1 )
			S.ScaleGlow = pawnFactory.ScaleGlow;
		if ( pawnFactory.itemHealth != 0 ) //Yay !
			S.Health = pawnFactory.itemHealth;
		if ( pawnFactory.itemProjectile != None )
			S.RangedProjectile = pawnFactory.itemProjectile;
		if ( pawnFactory.itemDropWhenKilled != None )
			S.DropWhenKilled = pawnFactory.itemDropWhenKilled;
		if ( pawnFactory.itemPrePivotZ != 0 ) //Pupaes not biting ground while are running
			S.PrePivot.Z += pawnFactory.itemPrePivotZ;
		if ( pawnFactory.itemSightRadius > 0 )
			S.SightRadius = pawnFactory.itemSightRadius;
		if ( pawnFactory.itemAggressiveness != 0 )
			S.Aggressiveness = pawnFactory.itemAggressiveness;
		if ( pawnFactory.itemPeripheralVision != 0 )
			S.PeripheralVision = pawnFactory.itemPeripheralVision;
		if ( pawnFactory.itemHearingThreshold > 0 )
			S.HearingThreshold = pawnFactory.itemHearingThreshold;
		if ( pawnFactory.itembIsBoss)
			S.bIsBoss = True;
		if ( pawnFactory.itembIgnoreFriends )
			S.bIgnoreFriends = True;
		if ( pawnFactory.itembNoWait )
			S.bNoWait = True;
		if ( pawnFactory.itembDelayedPatrol )
			S.bDelayedPatrol = True;
		if ( pawnFactory.itembHateWhenTriggered )
			S.bHateWhenTriggered = True;
		if ( pawnFactory.itemMenuName != "" )
			S.MenuName = pawnFactory.itemMenuName;
		if ( pawnFactory.itemNameArticle != "" )
			S.NameArticle = pawnFactory.itemNameArticle;
		if ( pawnFactory.itemTeamTag != '' )
			S.TeamTag = pawnFactory.itemTeamTag;
		if ( pawnFactory.itemTeam != 0 ) //Some monsters recognize this byte and will react accordingly
			S.Team = pawnFactory.itemTeam;
	}
}
If in map MH-DarkWhite weapons look different definitely a code can do that too. There is about default properties. If I well recall some ECoop things and memory doesn't cheat me, certain actors were using a double measure for some reason of their own code:

Code: Select all

Wep.Default.MultiSkins[1]=Texture'Edit2021'; //if actor reinforces a default, change this default
Wep.Multiskinks[1]=Texture'Edit2021'; //if actor is simple this should work
I'm going to try something next days as I consider:
#1 Try a code in PrebeginPlay/PostBeginPlay
#2 Testing a code delayed - here the most of things which I touched in Run-Time were working - After a few ticks or in whatever Auto State behind a "Sleep(0.00)" - it's about a tick or something like that.
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Custom weapon skin for my subclassed weapon?

Post by 1337GameDev »

Hmm, odd that you have to resort to multiskin...

I used this in default properties, and it worked:

Code: Select all

Mesh=LodMesh'Botpack.BioGelm',
Skin=Texture'MyWeapon.Skins.Checker',
Multiskins(1)=Texture'MyWeapon.Skins.Checker',
I don't know why you have to assign to index ONE of the Multiskins array vs ZERO.... (zero has no effect)

Strange...

Are the other multiskins utilized by native code, such as a blue, green, yello,w red, no-team color skins for Pawns?
Is there an index of what multiskin is active? Or do you just have to swap other skin references into index 1, and 0 is the default, and others are just there for caching?

Also, i can set Multiskin[1] and Mesh at runtime and it updates as I expect... so your idea works, but is odd.... (obv doesn't account for resetting default view properties or etc via vanilla code of an object).
User avatar
SteadZ
Average
Posts: 67
Joined: Mon Mar 10, 2014 11:19 pm
Personal rank: 1337
Location: Scotland
Contact:

Re: Custom weapon skin for my subclassed weapon?

Post by SteadZ »

The Multiskins literally just refer to the different UV maps assigned in the model creation and import process - most meshes in UT99 make use of these, they refer to different parts of the model so 0 might be the main weapon whilst 1 is the arms.
"The problem with dreams is... you never know when you're gonna wake up"

Image
Post Reply