Tripwire Interactive Forums

Go Back   Tripwire Interactive Forums > Red Orchestra: Ostfront 41-45 Forums > Red Orchestra Modifications > Coding

Reply
 
Thread Tools Display Modes
  #1  
Old 02-03-2008, 08:12 PM
Foo'bar's Avatar
Foo'bar Foo'bar is offline
Senior Member
 
Join Date: Nov 2007
Location: Alte Ziegelei
Posts: 275
Default Weapon pickup needed

Hi there, I want to place a scoped Nagant and a scoped K98 on my map. Anyone who can help me? I don't have any clue of coding
__________________

WIP Vehicle: VW Typ 82 Kübelwagen w/ Shurek
WIP Map: RO-AlteZiegelei
Reply With Quote
  #2  
Old 02-04-2008, 11:36 AM
Lt_Kettch's Avatar
Lt_Kettch Lt_Kettch is offline
Senior Member
 
Join Date: Sep 2006
Location: Berlin-Lichterfelde
Posts: 3,816
Default

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 ) 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

But I don't know how to change the text (you will notice it if you try to pick up the rifle)
__________________
Peace has cost you your strength! Victory has defeated you! - Bane
Reply With Quote
  #3  
Old 02-05-2008, 08:03 PM
Foo'bar's Avatar
Foo'bar Foo'bar is offline
Senior Member
 
Join Date: Nov 2007
Location: Alte Ziegelei
Posts: 275
Default

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.
__________________

WIP Vehicle: VW Typ 82 Kübelwagen w/ Shurek
WIP Map: RO-AlteZiegelei
Reply With Quote
  #4  
Old 02-08-2008, 08:49 PM
EvilHobo's Avatar
EvilHobo EvilHobo is offline
Senior Member
 
Join Date: Dec 2005
Posts: 2,596
Default

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).
__________________

why even bother
Reply With Quote
  #5  
Old 02-09-2008, 08:43 AM
Lt_Kettch's Avatar
Lt_Kettch Lt_Kettch is offline
Senior Member
 
Join Date: Sep 2006
Location: Berlin-Lichterfelde
Posts: 3,816
Default

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?
__________________
Peace has cost you your strength! Victory has defeated you! - Bane
Reply With Quote
  #6  
Old 02-10-2008, 05:57 PM
Foo'bar's Avatar
Foo'bar Foo'bar is offline
Senior Member
 
Join Date: Nov 2007
Location: Alte Ziegelei
Posts: 275
Default

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;
}
__________________

WIP Vehicle: VW Typ 82 Kübelwagen w/ Shurek
WIP Map: RO-AlteZiegelei
Reply With Quote
  #7  
Old 04-01-2008, 08:05 AM
Foo'bar's Avatar
Foo'bar Foo'bar is offline
Senior Member
 
Join Date: Nov 2007
Location: Alte Ziegelei
Posts: 275
Default

Noone willing to help me finishing the RO-AlteZiegelei map?
__________________

WIP Vehicle: VW Typ 82 Kübelwagen w/ Shurek
WIP Map: RO-AlteZiegelei
Reply With Quote
  #8  
Old 04-04-2008, 05:12 PM
Deeival Deeival is offline
On Vacation
 
Join Date: Sep 2006
Posts: 674
Default

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 by Deeival; 04-04-2008 at 05:26 PM.
Reply With Quote
  #9  
Old 04-04-2008, 05:27 PM
Deeival Deeival is offline
On Vacation
 
Join Date: Sep 2006
Posts: 674
Default

Also: Increase the fog distance on that map.
Reply With Quote
  #10  
Old 04-05-2008, 03:52 AM
Foo'bar's Avatar
Foo'bar Foo'bar is offline
Senior Member
 
Join Date: Nov 2007
Location: Alte Ziegelei
Posts: 275
Default

Thank you very much! I will try asap, at the moment there's no chance to start the SDK...
__________________

WIP Vehicle: VW Typ 82 Kübelwagen w/ Shurek
WIP Map: RO-AlteZiegelei
Reply With Quote
  #11  
Old 04-05-2008, 05:27 AM
TT33's Avatar
TT33 TT33 is offline
Senior Member
 
Join Date: Mar 2007
Posts: 570
Default

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 by TT33; 04-05-2008 at 05:37 AM.
Reply With Quote
  #12  
Old 04-05-2008, 06:21 AM
worluk's Avatar
worluk worluk is offline
Senior Member
 
Join Date: Nov 2005
Posts: 2,219
Default

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.
Reply With Quote
  #13  
Old 04-05-2008, 07:10 AM
TT33's Avatar
TT33 TT33 is offline
Senior Member
 
Join Date: Mar 2007
Posts: 570
Default

Quote:
Originally Posted by Worluk
you dont like "yes" as an anwer do you?
No ,I dont suppose I would

Quote:
Originally Posted by Worluk
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.-
__________________

Last edited by TT33; 04-05-2008 at 08:25 AM.
Reply With Quote
  #14  
Old 04-05-2008, 08:48 AM
worluk's Avatar
worluk worluk is offline
Senior Member
 
Join Date: Nov 2005
Posts: 2,219
Default

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 by worluk; 04-05-2008 at 08:56 AM.
Reply With Quote
  #15  
Old 04-05-2008, 09:02 AM
TT33's Avatar
TT33 TT33 is offline
Senior Member
 
Join Date: Mar 2007
Posts: 570
Default

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 by TT33; 04-05-2008 at 11:03 AM.
Reply With Quote
  #16  
Old 04-07-2008, 12:47 AM
Foo'bar's Avatar
Foo'bar Foo'bar is offline
Senior Member
 
Join Date: Nov 2007
Location: Alte Ziegelei
Posts: 275
Default

This is getting interesting now
__________________

WIP Vehicle: VW Typ 82 Kübelwagen w/ Shurek
WIP Map: RO-AlteZiegelei
Reply With Quote
  #17  
Old 04-08-2008, 06:58 AM
Foo'bar's Avatar
Foo'bar Foo'bar is offline
Senior Member
 
Join Date: Nov 2007
Location: Alte Ziegelei
Posts: 275
Default

Quote:
Originally Posted by Deeival View Post
Also: Increase the fog distance on that map.
Why? What's wrong with the fog?
__________________

WIP Vehicle: VW Typ 82 Kübelwagen w/ Shurek
WIP Map: RO-AlteZiegelei
Reply With Quote
  #18  
Old 04-08-2008, 09:43 AM
Deeival Deeival is offline
On Vacation
 
Join Date: Sep 2006
Posts: 674
Default

I wanna be able to take longer shots

But this is getting too OT.
Reply With Quote
  #19  
Old 04-10-2008, 09:42 AM
Foo'bar's Avatar
Foo'bar Foo'bar is offline
Senior Member
 
Join Date: Nov 2007
Location: Alte Ziegelei
Posts: 275
Default

Quote:
Originally Posted by Deeival View Post
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

__________________

WIP Vehicle: VW Typ 82 Kübelwagen w/ Shurek
WIP Map: RO-AlteZiegelei
Reply With Quote
  #20  
Old 04-12-2008, 01:09 AM
Deeival Deeival is offline
On Vacation
 
Join Date: Sep 2006
Posts: 674
Default

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 by Deeival; 04-12-2008 at 01:22 AM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2005 - 2013, Tripwire Interactive, LLC