For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Script for backpack item

Unreal Mod related boards can be found here. Missing one? Let me know.
bdc90
Posts: 1
Joined: Sat Dec 21, 2024 2:33 am

Script for backpack item

Post by bdc90 »

Hi, everyone. I've been trying out UnrealScript and I made an Unreal version of the backpack item from Doom. It gives you a little of each ammo type and doubles the amount of ammo you can carry. Feel free to use it in your own mods/maps.

Code: Select all

//=============================================================================
// Backpack.
//=============================================================================
class Backpack expands Pickup;

event float BotDesireability( pawn Bot )
{
	return Super.BotDesireability(Bot);
}

auto state Pickup
{
	function BeginState()
	{
		BecomePickup();	
	}
  
	function Touch( actor Other )
	{
		local Ammo a;

		if ( Pawn(Other)!=None && Pawn(Other).bIsPlayer)				//Double each ammo type's max amount and add small amount to player inventory
		{
			a = ShellBox(Pawn(Other).FindInventoryType(class'ShellBox'));		//Automag & Minigun
			if(a == none){
				a = Spawn(class'ShellBox');
				a.AmmoAmount = 20;
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.GiveTo(Pawn(Other));
			}else{
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.AddAmmo(20);
			}
			a = StingerAmmo(Pawn(Other).FindInventoryType(class'StingerAmmo'));	//Stinger
			if(a == none){
				a = Spawn(class'StingerAmmo');
				a.AmmoAmount = 20;
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.GiveTo(Pawn(Other));
			}else{
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.AddAmmo(20);
			}
			a = ASMDAmmo(Pawn(Other).FindInventoryType(class'ASMDAmmo'));		//ASMD
			if(a == none){
				a = Spawn(class'ASMDAmmo');
				a.AmmoAmount = 10;
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.GiveTo(Pawn(Other));
			}else{
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.AddAmmo(10);
			}
			a = RocketCan(Pawn(Other).FindInventoryType(class'RocketCan'));		//Eightball
			if(a == none){
				a = Spawn(class'RocketCan');
				a.AmmoAmount = 6;
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.GiveTo(Pawn(Other));
			}else{
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.AddAmmo(6);
			}
			a = FlakBox(Pawn(Other).FindInventoryType(class'FlakBox'));		//Flak Cannon
			if(a == none){
				a = Spawn(class'FlakBox');
				a.AmmoAmount = 5;
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.GiveTo(Pawn(Other));
			}else{
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.AddAmmo(5);
			}
			a = RazorAmmo(Pawn(Other).FindInventoryType(class'RazorAmmo'));		//Razorjack
			if(a == none){
				a = Spawn(class'RazorAmmo');
				a.AmmoAmount = 15;
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.GiveTo(Pawn(Other));
			}else{
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.AddAmmo(15);
			}
			a = Sludge(Pawn(Other).FindInventoryType(class'Sludge'));		//GES Bio Rifle
			if(a == none){
				a = Spawn(class'Sludge');
				a.AmmoAmount = 10;
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.GiveTo(Pawn(Other));
			}else{
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.AddAmmo(10);
			}
			a = RifleAmmo(Pawn(Other).FindInventoryType(class'RifleAmmo'));		//Rifle
			if(a == none){
				a = Spawn(class'RifleAmmo');
				a.AmmoAmount = 8;
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.GiveTo(Pawn(Other));
			}else{
				a.MaxAmmo = a.Default.MaxAmmo * 2;
				a.AddAmmo(8);
			}
			
			Pawn(Other).ClientMessage(PickupMessage, 'Pickup');						
			PlaySound (PickupSound,,2.0);
			SetRespawn();
		}
	}

}
User avatar
Leo T_C_K
OldUnreal Member
Posts: 4317
Joined: Sat Aug 27, 2005 6:24 pm

Re: Script for backpack item

Post by Leo T_C_K »

Cool. I am sure something like this has been done before, but either way its cool to have something like this in a simple form.

But what about defaultproperties? What would be the best mesh to use for this? Within the game's default ones. There's no backpack mesh, the only backpack mesh I can think of might be within Unreal2's model files, I used the mesh for the jetpack previously. Though someone can maybe rip the backpack of the tournament commando meshes or the ps2 ones to make a separate backpack mesh for Unreal.

Unless the bacpack is part of botpack's gibs then its even easier....

Return to “Unreal Mods”