BoxRunGame

@DanM Thanks You Rocks!!

Hey , I Just Finished Toon Tanks And I Wanna Know About Level Setup
Can You Give Me Some Ideas How To Setup Multiple Levels ??
Currently My Setup Is :
When Complete Level1 Then Open Level 2
(Is Working)

But I Also Want Something Like When Pawn Is On Level 2 Then Health ,Ammo Will Change
So Currently Don’t Have Any Proper Level Management,

Do I Need To Do This In Every Level Blueprint??
Actually I Want This By An Algorithm Not Manual

First thought is to do this in the GameMode and the Tank’s BeginPlay() e.g.

MaxHealth = GetAuthGameMode<ATankGameMode>()->GetMaxHealthForLevel();
MaxAmmo = GetAuthGameMode<ATankGameMode>()->GetMaxAmmoForLevel();

Might be best to create a struct for that so it’s just

FLevelDefaults Defaults = GetAuthGameMode<ATankGameMode>()->GetDefaultsForLevel();
MaxHealth = Defaults.MaxHealth;
// ...
1 Like

@DanM Hey , Thank You !!! That’s Working,

My Setup :

USTRUCT(BlueprintType)
struct FLeveleDefaults
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	float Health = 100;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	int32 Ammo = 20;
};

But, I Was Wondering If There Will Be An Array Of Levels And After Completing Level Array Index Will Increase ,

So You Mean We Need To Setup This In Every Level Blueprint To Open Another Level , No Alternates???

Also I Added Score But Problem Is When Open Level2 Then Previous Score Is Not Saving, Level2 Is Starting From Zero Score,
Also I Want For A Package Game Like If You Play The Game In Morning And Score 50, Then If You Play The Game In Evening Then The Score Still Be 50 , No Reset , So How Can I Do This??

Well you said you wanted a formula to it so I was thinking you name your levels reasonably just the name of level i.e.
“Level1, Level2, etc”

Then do a switch or parse the level name to get the level number.

1 Like

@DanM Thank You,

Can You Tell Me How Can I Call Child’s Function From Parent .


Suppose:

There A Parent 'APickup’
And Two Child ‘APickupWeapon’ And 'APickupHealth’


Pickup.cpp

void APickup::BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
	UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	MyCharacter* PlayerPawn = Cast<MyCharacter>(OtherActor);
	if (PlayerPawn)
	{
		//From Here I Wanna Call  Child's [PickupEntered]
	}
}

PickupHealth.cpp

void APickupHealth::PickupEntered(MyCharacter* Character)
{
	UE_LOG(LogTemp, Error, TEXT("Child Called****************************/*/*/*/*/*/*/*/*/*"))
}

APickupWeapon.cpp

void APickupWeapon::PickupEntered(MyCharacter* Character)
{
	UE_LOG(LogTemp, Error, TEXT("Weapon Child Called****************************+-+-+-+-+-+-"))
}

Please Help.

Make PickupEntered virtual.

1 Like

You know… I don’t know.

1 Like

@DanM Hello, Remember This Topic?
I Am About To Finish This Project Endless Run, I Need A Suggestion From You ,My Tile Has 3 Lane, Currently My Player’s Movement Is Slightly Displaced From The Lane When Changing Lane And When Turning Corners, I Also Added Reset Points(Reset Points = When Turning Corners Player’s Location Will Be Forced At Middle Of That Tile ) On L & R & T Tiles, But When I Play On My Mobile(Low FPS 35-45) The Character’s displacement Is Huge , So Can You Give Me Any Suggestion/Idea How To Keep Player In Lane ?
What I Tried Given Below:




And ^^ Calling This On Tick()


Touch Setup Calling Event





Reset Player At Centre.
^^ Calling It when Turning

I can’t quite make out the control flow and what not but can’t you just use the tile’s local Y value and convert it to a world location and then directly set the player’s to that?

1 Like

@DanM , Yes I Could , But That Will Not Be Smooth, Anyway After Long Research I Found A Component Called “Unreal Spline” I Implemented That And Now My Movement Is Perfect No More Issues There,


But I’m Getting A Frustrating Issue , Ue4 Crashed After Successfully Compiling >> Yes But There Are No" Read Null Memory Address " In My Code, No Exceed Array Index, Even From My CallStack I Don’t Have Any Clue What The Error Is ,


Will You Help Me To Figure It Out Cause I Don’t Have Any Idea About This Error?? My Engine Version Is 4.26

I could try? No clue based on that report though

1 Like

@DanM Yes, Please! >> Repo

Step To Reproduce :

  1. Make Sure You Have UE4 Version 4.26
  2. Open Any .cpp or .h Of My Project Source Code
  3. Do Any Small Change (Like Add A Variable)
  4. Hit Compile , Make Sure UE4 Editor Is Opened .

Result : It Will Compile Successfully, And Editor Will Crash

I have no idea, sorry. I’d suggest you file a bug report

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms