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
//===================================================================
// 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;
}
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)
}
Worluk said:you dont like "yes" as an anwer do you?
Worluk said:A new flag in the pickup which defines the allowed team, and a check for it in the UsedBy function.
//-----------------------------------------------------------
// 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
{
}
//-----------------------------------------------------------
// 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
}
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.