UE3 - UDK help serious coding please

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

scottellison92

New Member
May 31, 2011
16
0
0
Thanks KIFF ill try that and get back to you,

Wormbo, its because i started with the shock rifle as the original code then stripped everything apart from default properties, and i missed the copywrite part
 

scottellison92

New Member
May 31, 2011
16
0
0
Thanks KIFF ill try that and get back to you,

WORMBO, ik used the shock rifle code to start with then stripped it, missed the copywrite part.
 

scottellison92

New Member
May 31, 2011
16
0
0
whats wrong with my flashlight?

what is wrong with my flashlight? i get no errors but it just work work in game?

(class myflaslight)
Code:
/**
 *	MyFlashlight
 *
 *	Creation date: 04/08/2011 16:04
 *	Copyright 2011, Scott
 */
class MyFlashlight extends SpotLightMovable
	notplaceable;
 
 
defaultproperties
{
	Begin Object name=SpotLightComponent0
	LightColor=(R=255,G=0,B=0) /// red so we can see the change
	End Object
	bNoDelete=FALSE
}
(class MLPlayerController )
Code:
/**
 *	MLPlayerController
 *
 *	Creation date: 03/07/2011 21:40
 *	Copyright 2011, Scott
 */
class MLPlayerController extends UTPlayerController
	config(MyMod);

const MAX_LEVEL=50;
const XP_INCREMENT=500; // Amount of XP that is added to the amount of XP required for a level, after each level progression
 
var int XP; // Total amount of gathered XP
var int Level; // Current level
var int XPGatheredForNextLevel; // Amount of XP gathered for the next level
var int XPRequiredForNextLevel; // Amount of XP required for the next level

exec function ToggleFlashlight()
{
	MLPawn(Pawn).ToggleFlashLight();
}

state Dead
{
  function EndState(name NextStateName)
  {
	SetBehindView(default.bBehindView);
  }
}

simulated function PostBeginPlay()
{
	super.PostBeginPlay();
 
	// Calculate XP-related properties at the start of the game
	CalculateLevelProgress();
}
// The function that is called from Kismet
//public function AddXP(SeqAct_GiveXP action)
//{
//	GiveXP(action.Amount); // Give the player the amount of XP specified in the Kismet action
//}
public function GiveXP(int amount)
{
	XP+=amount;
 
	CalculateLevelProgress();
 
	while (XPGatheredForNextLevel >= XPRequiredForNextLevel && Level < MAX_LEVEL)
	{
		Level++;

		// Recalculate level progress after leveling up
		CalculateLevelProgress();
	}
}
private function CalculateLevelProgress()
{
	local int xpToCurrentLevel; // Total amount of XP gathered with current and previous levels
 
	xpToCurrentLevel=0.5*Level*(Level-1)*XP_INCREMENT;
	XPGatheredForNextLevel=XP-xpToCurrentLevel;
	XPRequiredForNextLevel=Level*XP_INCREMENT;
}

//this will be the function to do a reload
exec function PlayVehicleHorn()
{
   ConsoleCommand("RealReload");
}        


DefaultProperties
{
	bBehindView = true
	Level=1;
	XP=0;
}
(Class MLPawn)
Code:
/**
 *	MLPawn
 *
 *	Creation date: 03/07/2011 21:37
 *	Copyright 2011, Scott
 */
class MLPawn extends UTPawn
	config(Game)
	notplaceable;

/** The pawn's light environment */
var DynamicLightEnvironmentComponent LightEnvironment;
var MyFlashLight FlashLight;
var repnotify bool bIsFlashLightOn; /// whether flashlight is on or not

replication
{
	// replicated properties
	if ( bNetDirty )
		bIsFlashLightOn;
}

simulated function PostBeginPlay()
{
	FlashLight = Spawn(class'MyFlashLight', self);
	FlashLight.SetBase(self);
	FlashLight.LightComponent.SetEnabled(self.default.bIsFlashlightOn);
	super.PostBeginPlay();
}

/**
 * Check on various replicated data and act accordingly.
 */
simulated event ReplicatedEvent(name VarName)
{
	`log(VarName @ "replicated");
	if (VarName == 'bIsFlashlightOn')
	{
		FlashLightToggled();
		`log("bIsFlashlightOn replicated");
	}
	else
	{
	Super.ReplicatedEvent(VarName);
	}
}
 
simulated function ToggleFlashlight()
{
	bIsFlashlightOn = !bIsFlashlightOn;
	`log("ToggleFlashlight: " $ bIsFlashlightOn);
	FlashLightToggled();
	// if we are a remote client, make sure the Server Set's toggles the flashlight
	`log("Role:" @ Role);
	if( Role < Role_Authority )
	{
		ServerToggleFlashlight();
	}
}
 
reliable server function ServerToggleFlashlight()
{
	bIsFlashlightOn = !bIsFlashlightOn;
	`log("ServerToggleFlashlight: " $ bIsFlashlightOn);
	FlashLightToggled();
}
 
simulated function FlashLightToggled()
{
	if(bIsFlashlightOn)
	{
		FlashLight.LightComponent.SetEnabled(true);
	}
	else
	{
		FlashLight.LightComponent.SetEnabled(false);
	}
}
	
simulated function float GetEyeHeight()
{
	if ( !IsLocallyControlled() )
		return BaseEyeHeight;
	else
		return EyeHeight;
}


defaultproperties

{
	bIsFlashLightOn=true
	//Components.Remove(Sprite)

	//Begin Object Class=DynamicLightEnvironmentComponent Name=
		bSynthesizeSHLight=TRUE
	End Object

	//Begin Object Class=SkeletalMeshComponent Name=WPawnSkeletalMeshComponent
		bCacheAnimSequenceNodes=FALSE
		AlwaysLoadOnClient=true
		AlwaysLoadOnServer=true
		bOwnerNoSee=true
		CastShadow=true
		BlockRigidBody=TRUE
		bUpdateSkelWhenNotRendered=false
		bIgnoreControllersWhenNotRendered=TRUE
		bUpdateKinematicBonesFromAnimation=true
		bCastDynamicShadow=true
		Translation=(Z=8.0)
		RBChannel=RBCC_Untitled3
		RBCollideWithChannels=(Untitled3=true)
		LightEnvironment=MyLightEnvironment
		bOverrideAttachmentOwnerVisibility=true
		bAcceptsDynamicDecals=FALSE
		SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_CH_LIAM_Cathode'
		AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
		bHasPhysicsAssetInstance=true
		bEnableFullAnimWeightBodies=true
		TickGroup=TG_PreAsyncWork
		MinDistFactorForKinematicUpdate=0.2
		bChartDistanceFactor=true
		//bSkipAllUpdateWhenPhysicsAsleep=TRUE
		RBDominanceGroup=20
		Scale=1.075
		MotionBlurScale=0.0
		bAllowAmbientOcclusion=false
	End Object
	Mesh=WPawnSkeletalMeshComponent
	Components.Add(WPawnSkeletalMeshComponent)

	BaseTranslationOffset=0.0

	//Begin Object Class=SkeletalMeshComponent
		Scale=1.015
		bAcceptsDynamicDecals=FALSE
		CastShadow=false
		bOwnerNoSee=true
		bUpdateSkelWhenNotRendered=false
		bOverrideAttachmentOwnerVisibility=true
		TickGroup=TG_PostAsyncWork
		bAllowAmbientOcclusion=false
	End Object
	OverlayMesh=OverlayMeshComponent0

	//Begin Object Name=MeshSequenceA
	End Object

	//Begin Object Name=MeshSequenceB
	End Object

	//Begin Object Name=None
		PhysicsAsset=None
		FOV=55
		Animations=MeshSequenceA
		DepthPriorityGroup=SDPG_Foreground
		bUpdateSkelWhenNotRendered=false
		bIgnoreControllersWhenNotRendered=true
		bOnlyOwnerSee=true
		bOverrideAttachmentOwnerVisibility=true
		bAcceptsDynamicDecals=FALSE
		AbsoluteTranslation=false
		AbsoluteRotation=true
		AbsoluteScale=true
		bSyncActorLocationToRootRigidBody=false
		CastShadow=false
		TickGroup=TG_DuringASyncWork
		bAllowAmbientOcclusion=false
	End Object
	ArmsMesh[0]=FirstPersonArms

	//Begin Object Class=UDKSkeletalMeshComponent Name=FirstPersonArms2
		//PhysicsAsset=None
		//FOV=55
		//Scale3D=(Y=-1.0)
		//Animations=MeshSequenceB
		//DepthPriorityGroup=SDPG_Foreground
		//bUpdateSkelWhenNotRendered=false
		//bIgnoreControllersWhenNotRendered=true
		//bOnlyOwnerSee=true
		//bOverrideAttachmentOwnerVisibility=true
		//HiddenGame=true
		//bAcceptsDynamicDecals=FALSE
		//AbsoluteTranslation=false
		//AbsoluteRotation=true
		//AbsoluteScale=true
		//bSyncActorLocationToRootRigidBody=false
		//CastShadow=false
		//TickGroup=TG_DuringASyncWork
		//bAllowAmbientOcclusion=false
	//End Object
	//ArmsMesh[1]=FirstPersonArms2

	Begin Object Name=CollisionCylinder
		CollisionRadius=+0021.000000
		CollisionHeight=+0044.000000
	End Object
	CylinderComponent=CollisionCylinder

	//Begin Object Class=UTAmbientSoundComponent name=AmbientSoundComponent
	End Object
	PawnAmbientSound=AmbientSoundComponent
	Components.Add(AmbientSoundComponent)

	//Begin Object Class=UTAmbientSoundComponent name=AmbientSoundComponent2
	End Object
	WeaponAmbientSound=AmbientSoundComponent2
	Components.Add(AmbientSoundComponent2)

	ViewPitchMin=-18000
	ViewPitchMax=18000
	MaxYawAim=7000

	WalkingPct=+0.4
	CrouchedPct=+0.4
	BaseEyeHeight=38.0
	EyeHeight=38.0
	GroundSpeed=440.0
	AirSpeed=440.0
	WaterSpeed=220.0
	AccelRate=2048.0
	JumpZ=322.0
	CrouchHeight=29.0
	CrouchRadius=21.0
	WalkableFloorZ=0.78

	AlwaysRelevantDistanceSquared=+1960000.0
	InventoryManagerClass=class'HTInventoryManager'

	MeleeRange=+20.0
	bMuffledHearing=true

	Buoyancy=+000.99000000
	UnderWaterTime=+00020.000000
	bCanStrafe=True
	bCanSwim=true
	RotationRate=(Pitch=20000,Yaw=20000,Roll=20000)
	MaxLeanRoll=2048
	AirControl=+0.35
	bCanCrouch=true
	bCanClimbLadders=True
	bCanPickupInventory=True
	bCanDoubleJump=true
	SightRadius=+12000.0

	MaxMultiJump=1
	MultiJumpRemaining=1
	MultiJumpBoost=-45.0

	MaxStepHeight=26.0
	MaxJumpHeight=49.0

	DamageParameterName=DamageOverlay
	SaturationParameterName=Char_DistSatRangeMultiplier

	TeamBeaconMaxDist=3000.f

	bPhysRigidBodyOutOfWorldCheck=TRUE
	bRunPhysicsWithNoController=true

	ControllerClass=class'UTGame.UTBot'

	LeftFootControlName=LeftFootControl
	RightFootControlName=RightFootControl
	bEnableFootPlacement=true
	MaxFootPlacementDistSquared=56250000.0 // 7500 squared

	CustomGravityScaling=1.0
	SlopeBoostFriction=0.2
	FireRateMultiplier=1.0

	MaxFallSpeed=+1250.0
	AIMaxFallSpeedFactor=1.1 // so bots will accept a little falling damage for shorter routes

	bReplicateRigidBodyLocation=true


	FeignDeathPhysicsBlendOutSpeed=2.0
	TakeHitPhysicsBlendOutSpeed=0.5

	TorsoBoneName=b_Spine2
	FallImpactSound=SoundCue'A_Character_BodyImpacts.BodyImpacts.A_Character_BodyImpact_BodyFall_Cue'
	FallSpeedThreshold=125.0

	SwimmingZOffset=-30.0
	SwimmingZOffsetSpeed=45.0

	//Begin Object Class=ForceFeedbackWaveform Name=ForceFeedbackWaveformFall
		Samples(0)=(LeftAmplitude=50,RightAmplitude=40,LeftFunction=WF_Sin90to180,RightFunction=WF_Sin90to180,Duration=0.200)
	End Object

}

anyone have an idea?
 
Last edited by a moderator:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Do you really expect us to pick apart your code?
What have you done to diagnose the problem? Did you add any log/screen messages to see if functions get called as you'd expect?
 

scottellison92

New Member
May 31, 2011
16
0
0
I expect people do have the decency to help each other out as i would do the same if i knew a solution for someone else,

I didnt add anything like that in the code as i was following a tutorial ( and i dint know you could ) i have checked my compile and checked the consol and nothing, and google.