Weapon pickup needed

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

Lt_Kettch

FNG / Fresh Meat
You don't need code.

Change the weapon which is picked up:
Just create a Panzerfaust Pick Up base/actor (look in the SDK manual if you don't know how to place this actor). Then go to the properties and change the picked up weapon into an Sniper rifle (it's in the bottom half in the RO ammo or something category if you find the pull down menu you are close).

Change the mesh from a Panzerfaust to a sniper rifle:
Then open the Static mesh browser and open the WeaponPick up package (or something like that :eek:) and select the sniper rifle and go to your PickUp properties to Display and change the mesh by clicking on use.

This should work if you can understand my hints :eek:

But I don't know how to change the text (you will notice it if you try to pick up the rifle)
 

Foo'bar

FNG / Fresh Meat
Nov 12, 2007
275
0
0
Alte Ziegelei
fooblog.mexxoft.com
Thanks, I tried this by simply changing the Mesh and the Pickup, but the the Rifle still is named "Pickup: Panzerfaust" in game, and you get a weird reaction if you already have a Panzerfaust or even another rifle/machine gun.

Not that useful but it works at least. Still searching after a professional and clean way.
 

EvilHobo

Grizzled Veteran
Dec 22, 2005
2,613
192
63
Germany, NRW
Well, if you really wanted to you could make a new pickup class that works on the basis of the Panzerfaust one, just replace all instances of it within the code (such as the mesh, the weapon, ammo, etc).
 

Lt_Kettch

FNG / Fresh Meat
In the properties you can change things like pick up message and the tag from Panzerfaust to whatever but oddly it doesn't seem to work ingame.
Is that a bug or has there to be done something special to change the text message when a player gets close to the weapon?
 

Foo'bar

FNG / Fresh Meat
Nov 12, 2007
275
0
0
Alte Ziegelei
fooblog.mexxoft.com
Ok then, I've done this so far. What next?

Code:
//===================================================================
// MyROK98ScopedPickup
//
// A placeable K98 scoped pickup for mappers to put in their map
//===================================================================
class MyROK98ScopedPickup extends ROPlaceableAmmoPickup;

var() class<Inventory> WeaponType;

static function StaticPrecache(LevelInfo L)
{
	L.AddPrecacheStaticMesh(StaticMesh'WeaponPickupSM.Weapons.k98scoped');
	L.AddPrecacheMaterial(Material'Weapons3rd_tex.German.Kar98_world');
	L.AddPrecacheMaterial(Material'Weapons3rd_tex.German.Kars98_scope_world');
	L.AddPrecacheMaterial(Material'Weapons1st_tex.Rifles.k98_sniper_s');
}

auto state Pickup
{
	function bool ReadyToPickup(float MaxWait)
	{
		return true;
	}

	/* ValidTouch()
	 Validate touch (if valid return true to let other pick me up and trigger event).
	*/
	function bool ValidTouch( actor Other )
	{
		// make sure its a live player
		if ( (Pawn(Other) == None) || !Pawn(Other).bCanPickupInventory || (Pawn(Other).Health <= 0) || (Pawn(Other).DrivenVehicle == None && Pawn(Other).Controller == None))
			return false;

		if( ROPawn(Other) != none && ROPawn(Other).AutoTraceActor != none && ROPawn(Other).AutoTraceActor == self )
		{
			// do nothing
		}
		// make sure not touching through wall
		else if ( !FastTrace(Other.Location, Location) )
			return false;

		// make sure game will let player pick me up
		if( Level.Game.PickupQuery(Pawn(Other), self) )
		{
			TriggerEvent(Event, self, Pawn(Other));
			return true;
		}
		return false;
	}

	// When touched by an actor.
	function Touch( actor Other )
	{
	}

	function CheckTouching()
	{
	}

	function UsedBy( Pawn user )
	{
    	local Inventory Copy;
    	local inventory Inv;
    	local bool bHasWeapon;

		if( user == none )
			return;

	   	// check if Other has a primary weapon
		if( user != none && user.Inventory != none )
		{
			for ( Inv=user.Inventory; Inv!=None; Inv=Inv.Inventory )
			{
				if ( Inv != none && Weapon(Inv) != None )
				{
					if( Inv.class == WeaponType)
					{
						if( Weapon(Inv).AmmoMaxed(0) )
							return;
						else
							bHasWeapon = true;
					}
				}
			}
		}

		// valid touch will pickup the object
		if( ValidTouch( user ) )
		{
			if( bHasWeapon )
				Copy = SpawnCopy(user);
			else
				Copy = SpawnWeaponCopy(user);

			AnnouncePickup(user);
            if ( Copy != None )
				Copy.PickupFunction(user);

			SetRespawn();
		}
	}

	function Timer()
	{
		if ( bDropped )
			GotoState('FadeOut');
	}

	function BeginState()
	{
		UntriggerEvent(Event, self, None);
		if ( bDropped )
        {
			AddToNavigation();
		    SetTimer(DropLifeTime, false);
        }
	}

	function EndState()
	{
		if ( bDropped )
			RemoveFromNavigation();
	}

Begin:
	CheckTouching();
}

//
// Set up respawn waiting if desired.
//
function SetRespawn()
{
	StartSleeping();
}

function inventory SpawnWeaponCopy( pawn Other )
{
	local inventory Copy;

	if ( Inventory != None )
	{
		Copy = Inventory;
		Inventory = None;
	}
	else
		Copy = Other.spawn(WeaponType,Other,,,rot(0,0,0));

	Copy.GiveTo( Other, self );

	return Copy;
}
 

Deeival

FNG / Fresh Meat
Sep 4, 2006
674
1
0
Ok Ok let me take a look at it.
brb :/

Kar98 scoped
Code:
class ROKar98kScopedPickup extends ROPanzerFaustPickup;

static function StaticPrecache(LevelInfo L)
{
	L.AddPrecacheStaticMesh(StaticMesh'WeaponPickupSM.Weapons.k98scoped');
	L.AddPrecacheMaterial(Material'Weapons3rd_tex.German.Kar98_world');
	L.AddPrecacheMaterial(Material'Weapons3rd_tex.German.Kars98_scope_world');
	L.AddPrecacheMaterial(Material'Weapons1st_tex.Rifles.k98_sniper_s');
}

defaultproperties
{
    InventoryType=class'ROAmmo.Kar792x57Ammo' // this could be     class'ROInventory.Kar98WeaponScoped'  whatever works I guess
    WeaponType=class'ROInventory.Kar98WeaponScoped'

    PickupMessage="You got the Kar98k Scoped."
    TouchMessage="Pick Up: Kar98k Scoped"
    PickupSound=Sound'Inf_Weapons_Foley.WeaponPickup'
    PickupForce="AssaultRiflePickup"  // jdf

    bAmmoPickupIsWeapon=true

	MaxDesireability=+0.78

    StaticMesh=StaticMesh'WeaponPickupSM.Weapons.k98scoped'
    RespawnTime=3.000000
    AmmoAmount = 1
    DrawType=DT_StaticMesh
    DrawScale=1.0
    AmbientGlow=10

    CollisionRadius=25.0
    CollisionHeight=3.0
    PrePivot=(X=0.0,Y=0.0,Z=3.0)
}

The MN is pretty much the same with MN9130Scoped instead of Kar98kScorped everywhere.
 
Last edited:

TT33

FNG / Fresh Meat
Mar 2, 2007
571
159
0
Do not want to start a new thread for this but is there a way to negate the enemy team/side ( Russians/Germans) from picking up the pick up code wise?
 
Last edited:

worluk

FNG / Fresh Meat
Nov 21, 2005
2,226
85
0
you dont like "yes" as an anwer do you? ;)

A new flag in the pickup which defines the allowed team, and a check for it in the UsedBy function.
 

TT33

FNG / Fresh Meat
Mar 2, 2007
571
159
0
Worluk said:
you dont like "yes" as an anwer do you? ;)

No ,I dont suppose I would

Worluk said:
A new flag in the pickup which defines the allowed team, and a check for it in the UsedBy function.

ty, m8 but could you be a bit more clear than this im a dummy when it comes to coding.-:rolleyes:
 
Last edited:

worluk

FNG / Fresh Meat
Nov 21, 2005
2,226
85
0
quickly done, and didnt test it. No reason why it shouldnt work as its pretty trivial. subclass the items you need from TeamPickup and you will get a new field which allows you to specify the team that is allowed to pick up the item in the editor.
If another team player tries to pick it up, he gets a msg similar to the one for denied entry on vehicles.

Code:
//-----------------------------------------------------------
// Teambased Pickup
// untested
// allows to specify a team which is able to pickup this weapon
// by worluk 2008
//
//-----------------------------------------------------------
class TeamPickup extends ROPanzerFaustPickup
     abstract;

var() enum myTeamIndex{
   AXIS_TEAM_INDEX,
   ALLIES_TEAM_INDEX
   } PickupTeam;

function UsedBy( Pawn user )
{
  if(user.PlayerReplicationInfo.TeamInfo.TeamIndex!=PickupTeam)
  {
     user.ReceiveLocalizedMessage(class'ROTeamPickupMsg');
     return;
  }
  super.UsedBy(user);
}

DefaultProperties
{
}
Code:
//-----------------------------------------------------------
// ROTeamPickupMsg
// untested
// a msg sent to a player in case he tries to pickup an item
// set for the other team.
// by worluk 2008
//
//-----------------------------------------------------------
class ROTeamPickupMsg extends LocalMessage;

var(Messages) localized string WrongTeam;

static function string GetString(
    optional int Switch,
    optional PlayerReplicationInfo RelatedPRI_1,
    optional PlayerReplicationInfo RelatedPRI_2,
    optional Object OptionalObject
    )
{

    return default.WrongTeam;


}

//=============================================================================
// defaultproperties
//=============================================================================

defaultproperties
{
    WrongTeam="You cannot pick up this item"
    bBeep=false
    bFadeMessage=true
    bIsUnique=false
    DrawColor=(R=214,G=28,B=36,A=255)
    FontSize=2
    LifeTime=3
    PosX=0.5
    PosY=0.75
}

oh and since i already wrote the code i will most likely hand this out with CC too
 
Last edited:

TT33

FNG / Fresh Meat
Mar 2, 2007
571
159
0
Ty m8 ! Yeah that sounds cool.
I wanted to use this to restrict some possible(I got alot of models scattered across various Hard drives) future rare but noteworthy weapons from being overly used by the enemy.
 
Last edited:

Foo'bar

FNG / Fresh Meat
Nov 12, 2007
275
0
0
Alte Ziegelei
fooblog.mexxoft.com
Ok Ok let me take a look at it.
brb :/

Kar98 scoped
Code:
class ROKar98kScopedPickup extends ROPanzerFaustPickup;

static function StaticPrecache(LevelInfo L)
{
	L.AddPrecacheStaticMesh(StaticMesh'WeaponPickupSM.Weapons.k98scoped');
	L.AddPrecacheMaterial(Material'Weapons3rd_tex.German.Kar98_world');
	L.AddPrecacheMaterial(Material'Weapons3rd_tex.German.Kars98_scope_world');
	L.AddPrecacheMaterial(Material'Weapons1st_tex.Rifles.k98_sniper_s');
}

defaultproperties
{
    InventoryType=class'ROAmmo.Kar792x57Ammo' // this could be     class'ROInventory.Kar98WeaponScoped'  whatever works I guess
    WeaponType=class'ROInventory.Kar98WeaponScoped'

    PickupMessage="You got the Kar98k Scoped."
    TouchMessage="Pick Up: Kar98k Scoped"
    PickupSound=Sound'Inf_Weapons_Foley.WeaponPickup'
    PickupForce="AssaultRiflePickup"  // jdf

    bAmmoPickupIsWeapon=true

	MaxDesireability=+0.78

    StaticMesh=StaticMesh'WeaponPickupSM.Weapons.k98scoped'
    RespawnTime=3.000000
    AmmoAmount = 1
    DrawType=DT_StaticMesh
    DrawScale=1.0
    AmbientGlow=10

    CollisionRadius=25.0
    CollisionHeight=3.0
    PrePivot=(X=0.0,Y=0.0,Z=3.0)
}

The MN is pretty much the same with MN9130Scoped instead of Kar98kScorped everywhere.

When I try to compile I'll get
ERROR: unexpected defaultproperties on line 11

:(
 

Deeival

FNG / Fresh Meat
Sep 4, 2006
674
1
0
Everything throws together. Tested the Kar98ScopedPickup and it worked, didnt test the same team pickup thing but it compiled... so it should work :)
Source is included, let me know if there are issues.

Updated:

http://hashers.ca/redirect/dvscopedpickups.rar

Edit:
Ignore the vehicle code I pack with it - no idea how that got in there.
 
Last edited: