I've got a variable in a class wich extends from trigger from basically actor , called taken , that basically when you use that object it turns into true.
see the class here
class
Code:class UsableActor extends trigger placeable; var bool taken; var() const string Prompt; var bool IsInInteractionRange; event Touch(Actor Other, PrimitiveComponent OtherComp, Vector HitLocation, Vector HitNormal) { WorldInfo.Game.Broadcast(self, "you touch"); super.Touch(Other, OtherComp, HitLocation, HitNormal); `log( "Hello, world!" ); if (Pawn(Other) != none) { //Ideally, we should also check that the touching pawn is a player-controlled one. PlayerController(Pawn(Other).Controller).myHUD.AddPostRenderedActor(self); IsInInteractionRange = true; } } event UnTouch(Actor Other) { WorldInfo.Game.Broadcast(self, "you no touch"); super.UnTouch(Other); if (Pawn(Other) != none) { PlayerController(Pawn(Other).Controller).myHUD.RemovePostRenderedActor(self); IsInInteractionRange = false; } } simulated event PostRenderFor(PlayerController PC, Canvas Canvas, Vector CameraPosition, Vector CameraDir) { local Font previous_font; super.PostRenderFor(PC, Canvas, CameraPosition, CameraDir); WorldInfo.Game.Broadcast(self, "you touch"); previous_font = Canvas.Font; Canvas.Font = class'Engine'.Static.GetMediumFont(); Canvas.SetPos(100,100); Canvas.SetDrawColor(0,255,0,255); Canvas.DrawText(Prompt); //Prompt is a string variable defined in our new actor's class. Canvas.Font = previous_font; } function bool UsedBy(Pawn User) { local bool used; used = super.UsedBy(User); if (IsInInteractionRange) { taken=true; WorldInfo.Game.Broadcast(self, "MESSAGE HERE"); //If it matters, you might want to double check here that the user is a player-controlled pawn. PlaySound(SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_FireImpactFizzle_Cue'); //Put your own sound cue here. And ideally, don't directly reference assets in code. return true; } return used; } DefaultProperties { begin object Name=Sprite HiddenGame=true HiddenEditor=true end object begin object class=StaticMeshComponent Name=MyMesh StaticMesh=StaticMesh'NodeBuddies.3D_Icons.NodeBuddy__BASE_SHORT' end object Prompt="hello"; CollisionComponent=MyMesh Components.Add(MyMesh) bBlockActors=true bHidden=false taken=false }
And that variable i want to use it in the pawn class of my game
And yes i want to use it in this class but whatever i try it's not wrokingCode:class GladiatorPawn extends Pawn; var() const DynamicLightEnvironmentComponent LightEnvironment; var() const int IsoCamAngle; var() const float CamOffsetDistance; var() const Name SwordHandSocketName; var() const archetype MeleeWeapon SwordArchetype; var AnimNodePlayCustomAnim SwingAnim; var float CamPitch; var bool taken; simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp) { super.PostInitAnimTree(SkelComp); if (SkelComp == Mesh) { SwingAnim = AnimNodePlayCustomAnim(SkelComp.FindAnimNode('SwingCustomAnim')); } } simulated function bool CalcCamera(float DeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV) { local Vector HitLocation, HitNormal; out_CamLoc = Location; out_CamLoc.X -= Cos(Rotation.Yaw * UnrRotToRad) * Cos(CamPitch * UnrRotToRad) * CamOffsetDistance; out_CamLoc.Y -= Sin(Rotation.Yaw * UnrRotToRad) * Cos(CamPitch * UnrRotToRad) * CamOffsetDistance; out_CamLoc.Z -= Sin(CamPitch * UnrRotToRad) * CamOffsetDistance; out_CamRot.Yaw = Rotation.Yaw; out_CamRot.Pitch = CamPitch; out_CamRot.Roll = 0; if (Trace(HitLocation, HitNormal, out_CamLoc, Location, false, vect(12, 12, 12)) != none) { out_CamLoc = HitLocation; } return true; } function AddDefaultInventory() { local GladiatorInventory MWInventoryManager; if (SwordArchetype != None) { MWInventoryManager = GladiatorInventory(self.InvManager); if (MWInventoryManager != None) { MWInventoryManager.CreateInventoryArchetype(SwordArchetype, false);} } } DefaultProperties { InventoryManagerClass=class'GladiatorInventory' Components.Remove(Sprite) SwordArchetype=MeleeWeapon'GladiatorContent.Archetypes.MeleeWeaponSword' Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment bSynthesizeSHLight=true bIsCharacterLightEnvironment=true bUseBooleanEnvironmentShadowing=false End Object Components.Add(MyLightEnvironment) LightEnvironment=MyLightEnvironment Begin Object Class=SkeletalMeshComponent Name=MySkeletalMeshComponent bCacheAnimSequenceNodes=false AlwaysLoadOnClient=true AlwaysLoadOnServer=true CastShadow=true BlockRigidBody=true bUpdateSkelWhenNotRendered=false bIgnoreControllersWhenNotRendered=true bUpdateKinematicBonesFromAnimation=true bCastDynamicShadow=true RBChannel=RBCC_Untitled3 RBCollideWithChannels=(Untitled3=true) LightEnvironment=MyLightEnvironment bOverrideAttachmentOwnerVisibility=true bAcceptsDynamicDecals=false bHasPhysicsAssetInstance=true TickGroup=TG_PreAsyncWork MinDistFactorForKinematicUpdate=0.2f bChartDistanceFactor=true RBDominanceGroup=20 Scale=1.f bAllowAmbientOcclusion=false bUseOnePassLightingOnTranslucency=true bPerBoneMotionBlur=true End Object Mesh=MySkeletalMeshComponent Components.Add(MySkeletalMeshComponent) }
What's the way?
or multiple ways?



Reply With Quote




Bookmarks