Who is the best person to speak to about weapons

Discussions about Coding and Scripting
Posts: 115
Joined: Sun Mar 29, 2020 3:37 am

Who is the best person to speak to about weapons

Post by sXs-sketchpad »

Only me again who is the best person to speak to about modifying one of the weapons I have put on my sniper server all I really need is a name taken of it and crosshair changes thanks
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Who is the best person to speak to about weapons

Post by 1337GameDev »

This change should be pretty easy. You would essentially just subclass the weapon you're wanting to modify and change the default properties in the subclass:

For the crosshair import and render function, I looked at Botpack.UT_Eightball.uc:

Code: Select all

class CustomWeapon extends ExistingWeaponClass {
	#exec TEXTURE IMPORT NAME=NewCrosshair FILE=Textures\NewCrosshair.bmp GROUP="Icons" FLAGS=2 MIPS=OFF

	//borrowed from Botpack.UT_Eightball
	//miht need to tweak the scaling and such for your specific use case
	simulated function PostRender( canvas Canvas )
		local float XScale;

		bOwnsCrossHair = true;
		if(bOwnsCrossHair) {
			// if locked on, draw special crosshair
			XScale = FMax(1.0, Canvas.ClipX/640.0);
			Canvas.SetPos(0.5 * (Canvas.ClipX - Texture'NewCrosshair'.USize * XScale), 0.5 * (Canvas.ClipY - Texture'NewCrosshair'.VSize * XScale));
			Canvas.Style = ERenderStyle.STY_Normal;
			Canvas.DrawIcon(Texture'NewCrosshair', 1.0);
			Canvas.Style = 1;	

    defaultproperties {
        PickupMessage="You got the Custom Weapon."
        WeaponDescription="Classification: Sniper Rifle\n\nPrimary Fire: \n\nSecondary Fire: \n\nTechniques: "
        ItemName="Custom Weapon Name"
Then in your UT99 folder, create a folder for your weapon, and make a "Classes" and a "Textures" folder. Then in your UnrealTournament.ini (in the System folder), under the [EditPackages] section, add your new package name there, exactly as the folder is spelled/punctuated.

Then run "ucc" from CMD after navigating to the folder via the command line. It should compile and show any errors, and should be usable to be placed in a map. The U file should exist in your System folder if the compile succeeded (it'll say in CMD and give an error message).

You can even embed this actor in your maps, using the MyLevel package, but i've never done that before. All I know is you use this package for textures, meshes, classes, etc but don't save it manually in the Texture/Class/Sound/Mesh browser, but just save your map, and ignore any unsaved package warnings for MyLevel packages.