#blueprint

1 messages · Page 132 of 1

obtuse oriole
#

Why do Character Movement Component Is Falling function kept returning true despite the character capsule is clearly touching the ground?

lofty rapids
#

does the character actually fall ?

#

or if you move it up is it just floating in the air

obtuse oriole
#

it does fall as normal when I jump or runs off the edge of an object

lofty rapids
#

and your animations are normal ?

#

i think part of the animation rely on isfalling, so if the animations are working then the value is working

obtuse oriole
#

no, because the Is Falling function kept returning true, the animation thinks the character is still falling

lofty rapids
#

ok that makes sense, does gravity and everything actually work ?

#

when you jump you land after ?

obtuse oriole
#

yes

#

I jump and I still fall as it should

lofty rapids
#

what does the animbp look like where you use isfalling ?

obtuse oriole
#

when the falling boolean is true, it overrides the animation entirely with falling animation

#

I also print debug the function output in the character blueprint itself and it in fact only returns true

lofty rapids
#

thats odd, and what are you using as a floor ? landscape ?

obtuse oriole
#

cube, plane and cone. All same results

#

they're all in a blueprint because I realized some primitive objects have weird raycast behavior by itself a while ago

lofty rapids
#

so it's doing it on launch ?

#

your just constantly falling ?

#

whts strange is you can jump and it lands on the ground

obtuse oriole
#

the function returns false when the PlayerStart collider bottom is right above an object, but as I jump or fall once it breaks

#

walking on the surface without triggering a fall did not break it however

lofty rapids
#

so jumping is breaking it ?

#

are you just simply using jump ?

obtuse oriole
#

any sort of falling

#

either from a jump or simply walk off the edge

lofty rapids
#

are you only dealing with isfalling in the animbp ?

#

or you have some code that acts on it in some way ?

little coral
#

ok i got the whole sequence to work, thanks to you lovely bunch, but now the lerp function is not triggering for some reason.

obtuse oriole
little coral
#

the rotator is immediatly snapping the character to the new rotation with no transition

lofty rapids
little coral
#

a float

lofty rapids
#

are you trying to run a timeline and use the output value as an output ?

little coral
#

the time is called outside, so i had to do some gymnastics to connect it within the function

obtuse oriole
lofty rapids
#

sure but why that did that is something to look into

#

you can patch it up, but fixing the problem is usually best

obtuse oriole
#

well so far it doesn't interfere with other things, I'll figure it out later

lofty rapids
#

idk much about latent things

little coral
#

cant call a timeline inside a function too hmm

lofty rapids
#

use an event

#

they do basically the same thing, you can call them and run them

little coral
#

appreciate an elaboration for this noob lol

#

so move everything out of the function to an event ?

lofty rapids
#

well i'm not sure how to fix it, i'm still looking at it

lofty rapids
#

i know in events you can use timeline

#

i don't think passing the value like that, and lerp is going to work very well

#

but again idk much about latent things, i'm still learning

obtuse oriole
little coral
#

you are doing far more than learning bud

lofty rapids
#

programmig been my hobby for long time, so blueprints was easy for me to grasp

#

visual programming is fun

#

i'm glad they put blueprints in ue, it's really cool thing

little coral
#

it really is, would be totally lost without it

#

speaking of AI assistants, i am trying gemini pro 1.5 now

#

gave it screen shots and a small description of the problem, here is troubleshooting guide.
is it a bunch of mumbo jumbo ?

#

oh god....he totally fixed it with play from start lol

#

you fix one issue it spawns another haha

#

from origin point to first target point :

  • rotation perfect
  • position perftect
    From 1st target to second target :
  • rotation perfect
  • position perftect
    every shot after reaching third target attempts makes the camera as if its trying to go back somewhere and then returns lol
tight pollen
#

when modifying the structure, I would like it not to clear the variable values. How can I do this?

#

DataTable?

#

if the structure is large and I change the type of the variable, it resets all the values ​​that have been set in the widget

#

or even in case of DataTable it is unavoidable?

golden kite
#

I love those nodes (like String Append) that have an "add pin" feature, kind of the equivalent of JavaScript rest operator. Is there a way to implement this in a pure blueprint custom function or macro?

lofty rapids
#

probably with c++, i don't think you can in bp

gentle urchin
#

Custom nodes yeah^^

faint pasture
lofty rapids
#

whats more performant, a textrender or a widget ?

gentle urchin
#

Bet its pretty negligable

pseudo sparrow
#

Got a random question, so in my Animation BP, I know I can make random idle animations by putting in a Random Sequence Player, but how can I get different idle animations in a Blend Space?

lofty rapids
#

even if i don't notice much of a difference i like to know what is more performant or if something is going to be a problem at a later point

undone bluff
#

negligable and for extreme cases just profile

#

but!

lofty rapids
undone bluff
#

I assume you are talking about the widget component?

lofty rapids
#

well i was thinking a 3d widget

#

i have not used it yet

#

just wondering if a bunch of 3d widgets on the screen is a problem

#

ig i'll know if i run into it, but i like to know like i said whats more performant

#

so your saying it's not a difference, ok

undone bluff
#

depends

#

so the thing about widget components is they are rendering a widget to a render target

#

and then display that RT as a texture

lofty rapids
#

interesting

undone bluff
#

for damage numbers I'd probably create and animate them in a widget

lofty rapids
#

thats what i'm thinking as well, because textrender doesn't have animations i'd have to create some wild stuff

#

makes sense

undone bluff
#

I use this to snap the position of my crosshair to be over a location in worldspace

lofty rapids
#

hmm, so just create it in the main hud widget dynamically, animate it, then delete ?

#

i c with this i can do what i want to do with the numbers

undone bluff
#

yea spawn a damage number widget, give it a target actor and have it snap to its location on tick maybe

#

and the animation would be either inside the number widget, or you can add an offset when you set the position (probably better)

#

maybe even use a curve

lofty rapids
#

well i'm using it for points, so i would just put it above my character and make it float up

#

thats what i did with the textrender

#

i'll just try a widget and see if it tanks, i was just wondering because i don't really "need" animations

#

but people like to see fancy things

gentle urchin
#

Im being lazy

undone bluff
#

yea you could try also using just a single widget component

gentle urchin
#

Spawning widget on an overlay

#

On a component

undone bluff
#

one per number might cause a problem, maybe

gentle urchin
#

Do anim-> transform up -> delete

undone bluff
#

but one widget component you spawn the numbers in will definitely not be an issue

lofty rapids
#

well i want multiple numbers

gentle urchin
#

I do multiple numbers

lofty rapids
#

i literally use the position to then add to the score

#

so it floats up into the score

#

instead of a timer so it works perfect every time

#

i don't know if an animation could do that ?

undone bluff
#

oh you want it to move to the score

lofty rapids
undone bluff
#

yea I'd definitely do it in a regular widget then

#

frankly you'll probably want to have 2/3rds of the visible space be in front of the character

#

the space behind isn't as important

#

pretty much every side scroller does that and only centers out when you stand still

lofty rapids
#

wdym

undone bluff
#

you'd have a scene component in the character to which the camera is attached instead, and you'd take the player velocity, map it to whatever range you want and then set that to the relative position of that scene component along axis the player moves

gentle urchin
#

Shift the camera center to be a bit to the right of char

#

Looking left usually doesnt matter

undone bluff
#

or yea just do that

#

depends on the game

gentle urchin
#

Were it does matter, they tend to shift the offset depending on your direction

#

I was sure Ori did this 😂

lofty rapids
gentle urchin
#

But camera just lags behind the char, who usually is in the center

lofty rapids
#

right i know what your saying i had a way i was thinking about to do that

#

but using the velocity if i can makes sense

#

i was just going to move the camera left or right based on location of the player and some delay or something

gentle urchin
#

Basic camera lag handles it if you wanna be 'late'

undone bluff
#

hollow knight and ori have you navigate vertical spaces while fighting enemies

#

centered camera is better there

#

platformers not focused on combat tend to prefer to lock you onto a specific z axis and only shift up when you start moving out of the screen

#

and because you won't be flanked by enemies from behind they prioritize the space in front of you

lofty rapids
#

i c

gentle urchin
lofty rapids
#

i'll play with the velocity range thing see if i can make it look better, that messes with the points going up into the score that will be a bit more difficult

gentle urchin
#

Here you see offset changed based on the velocity of the player

undone bluff
#

the pan down that accelerates faster than the lift is a nice touch

#

though thinking about it that is probably just driven by the same logic that handles the camera offset while running

#

just a nice side effect

wet marsh
#

Question; In Unity you can call this in C# to get a reference to a world position Target.position where Target is a Transform component. The versatility comes from the fact that every single GameObject in the scene must have a Transform component, so you can easily get the position of any Target that is passed in.
What is the Blueprint equivalent of this?

undone bluff
#

unless I misunderstood you

wet marsh
#

So the type of variable in Blueprint land would be Actor

#

?

lofty rapids
#

you can store transforms

wet marsh
#

Yes, but can I reference another actors transform by storing it as a public variable?

undone bluff
#

any object placed in the level is an actor and you can access their transform

wet marsh
#

Okay. Then I think Actor is the type.

#

I have a camera that needs to orbit a target, but the target could be anything, really.

#

So the "anything" in Unity would be Transform.

#

The "Anything" in Unreal sounds like it's an Actor.

undone bluff
#

yea just have an actor reference and get the location from there

wet marsh
#

Alright, thanks.

#

A bit of a problem that I can't set a class default value for an Actor reference.

undone bluff
#

what exactly do you intend to do?

wet marsh
#

I'm currently trying to transfer some Unity code to Blueprint

undone bluff
#

you can make it a class instead of an object reference but I don't think that's it

gentle urchin
wet marsh
#

And in Unity I'd ask for a transform reference in code, then in editor I'd set the transform I want as the target by drag-and-drop.
In Unreal, the character blueprint is just another blueprint™️ so there are no editor instances of it until runtime. At that point it's too late to set a reference.

undone bluff
#

ah I get it

#

when you have a public actor reference

wet marsh
#

The idea is to let designers have freedom to choose but that the default reference could exist in it's own hierarchy

undone bluff
#

and both actors are in the same level

#

there is an eyedropper tool in the details panel

wet marsh
#

It's greyed out

undone bluff
#

so you can select the target actor there and get its location

undone bluff
wet marsh
#

But you know, it hit me that I should separate out the actor I'm working on so it's separate from the player.

undone bluff
#

you can't add a reference to an instance in a class

#

really though

#

are the camera and the target both actors?

#

if the camera is or is managed by a component in the actor it can just get its owner

#

if they are actors they'd probably still communicate

#

or some kind of manager is aware of them both and can give a reference

#

the approach depends on the specifics

wet marsh
#

I think I'll do what I did in Unity and see how that works. Basically the camera is just it's own and you can drop one in scene, customize it and then point it to a target in scene as well.

#

In Unreal I'll probably just tell it to find the Character controller in the scene until I find a different setup.

undone bluff
#

yep, what I suggested sounds like what you want

#

public actor reference for the target

#

and then when you place the camera in the level you can eyedrop it to any other object in the level

#

alternatively consider making a component that spawns your camera and attaches it to its owner

#

then you add that component to any actor you want

gentle urchin
#

+1 for team component

river comet
#

Help me, please. I have a FPS Player and a Drone (type Character). I possess FPS Player and use Input to control that Drone (look like remote control drone). But the function Add Movement Input on Drone doesn't working. If I change possess to Drone, the function works normally. All Input have written in Player Controller for general using when changing possessed player.
The issue only happens with Drone spawned from Blueprint. With Drone is placed to the world at the editor, the function works normally (meaning I can control Drone when possessing FPS Player).

wet marsh
#

Another question; Does Unreal have a LateUpdate type tick?

#

Or is it only Tick?

undone bluff
gentle urchin
wet marsh
#

But if I want Tick and Late Tick in the same BP, that's a no?

gentle urchin
#

Thats a no out of the box atleast

#

Guess you can abuse a second actor to get the second tick

wet marsh
#

Alright

lofty rapids
undone bluff
#

not necessarily

lofty rapids
#

i can set the position manually ig

undone bluff
#

boom, it'll not inherit the rotation

lofty rapids
wet marsh
#

You know, I know that I wrote this line. But I'm not sure why I wrote it like this.
if (StayBehindTarget == false ? SetRotation() : SetRotation() || OrbitBehind())

#

If the first condition comes out as true, then return a bool from SetRotation()
If the first condition comes out as false, then either SetRotation() OR OrbitBehind() must return true

violet spoke
#

Got problem with top level asset path, but what path is for Texture2D ?

main lake
#

How to make my child gamemode execute on his "onLogin" the parent's onLogin code first then execute what I'm adding to it in the child onLogin event ?

wet marsh
#

Since Epsilon is not an accessible value in Blueprint, what does one use instead?

gentle urchin
gentle urchin
#

you know what I'm talking about 😛

#

Right clicking the node -> Add call to parent

main lake
main lake
flat coral
#

Crashed Unreal Editor with this error...
Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp] [Line: 1459] Failed to find function DelayedSave in BP_LevelGameMode_C
And it's correct! That function was removed.
But like, from this information how do I find WHERE that reference to the deleted function IS?

gentle urchin
#

Hopefully you're not a vivid user of Set Timer by function name

lapis turret
#

hello
i have an base spell with a tsubclassof<baseanimation> called animclass. i set the animclass to projectileanimation, which derives baseanimation and contains some variables with the expose on spawn meta tag. but when a try to call spawnactor on projectileanimation in the unreal editor, it doesnt show the exposed variables of projectileanimation, only baseanimation. i see why this happens, but i dont know what the best solution would be to be able to set different variables on spawn depending on what class i use.

wet marsh
#

Is it possible to do a BoxCast in Blueprint?

#

It seems I can only find raycast

#

Or "line trace"

lofty rapids
#

there is sphere trace i think

gentle urchin
#

Isnt there boxtrace aswell

dawn gazelle
gentle urchin
#

Isnt there boxtrace aswell

cobalt gulch
#

How can I make the player's head look at a location smoothly without jumping to it

#

The code above looks at the right location needed but it snaps

violet spoke
# cobalt gulch

is it triggerable? or it continously runs?
you got few options.
lerp or timeline for triggers.

Or adding rotation * rotation speed every tick

lunar sleet
flat coral
#

What's the easiest way to find out WHERE this call actually is?

#

Keyword search I guess. Awkward that there's no link

steady night
#

Hey advice!

im doing a gun fire function and i wanna add some simple spread, how would i best do it ? just add some offset to the forward vector or ?

faint pasture
#

smoothly means per frame means something somewhere is doing the work on tick or the equivelent

#

you could do it in your anim bp

#

The typical pattern is:
WhateverEvent -> set target
Tick -> interpolate actual towards target

faint pasture
stark thistle
#

@steady night I'm new myself, but IIRC keep Start as it is now, but in the add pin right before you End (where you're adding the Forward to the Location) you will also want to add some random "jitter" to the location. That is, you'll add some random (- or +) values within a range to the vector before sending it to End. The amount you want to jitter depends on what kind of game you're doing, what kind of weapon you're firing (shotgun vs sniper rilfe in a scope vs sniper rifle hip fired, etc), etc.

faint pasture
#

I'm trying to think if there's a way to do it with no rotations involved

steady night
#

yeah thats what i had in mind it just depends on the total range of the "bullet"

#

how much offsett would be needed and so forth

stark thistle
#

There's someone else's BP doing the same thing

#

Should get you started

faint pasture
#

I would probably start with this, then transform it based on the transform of the actual aiming thing

stark thistle
#

Oh that's even better

steady night
#

oh

#

i mean this is a super simple version

faint pasture
steady night
#

the cone is way better tho

#

yeah

faint pasture
#

is this a 2d or 3d shooter, are you ever shooting up or down or mostly in the horizontal plane?

steady night
#

3rd

faint pasture
#

yeah I would use
TransformDirection(RandomVectorInCone, PistolFireLoc.GetWorldTransform) as the vector direction

#

feed spread into the random vector node

steady night
#

like so ?

#

nah not sure how the random unit ivector in cone works :/

faint pasture
steady night
#

what would the value range be ?

faint pasture
#

if you feed it a 5 it'll be a cone with a 10 degree angle

#

feed it a 45 and it'll be a 90 degree cone

steady night
#

oh

craggy flicker
#

What's the easiest way to create a struct in blueprints where I can store room data? I.e., I want to store:
Vector3 Position
Vector3 Size

In one variable called Room or something

#

like multiple variable types in one

queen dagger
#

i am absolutely stumped

#

i have to characters and one is ai and the other controlled but the animation components seem to be linked in terms of input from the controller

lofty rapids
#

i figure if i can calculate the interp speed right it won't slide so fast when i change directions

#

i thinks because it's set to 1.0

#

it going the bigger distance in 1.0

queen dagger
undone bluff
#

if you want interpolation just use a springarm with lag imo

#

ah I can see how changing direction would be an issue

#

your character probably has high friction

lofty rapids
#

since it's not moving, seems like just the animations

lofty rapids
#

almost had it but i was just trying random stuff to get the interp speed

gentle urchin
#

Velocity isnt normalized

#

this suggests that you think it is

#

velocity is direction * magnitude

#

so you'd want to normalize that beofre multiplying with CameraMover

haughty iron
craggy flicker
undone bluff
undone bluff
#

maybe increase lag when in a low range

#

not sure

#

gotta try stuff out

lofty rapids
#

i just scrapped it it wasn't that great of a feature for this particular game

#

i will try with lag

#

see if that is any better but it didn't seem to good to play

#

once things are smoothed out might be better

gentle urchin
feral patio
#

I am currently trying to set an Enum that i am using to control a 2d character's animations, but for some reason my code isn't setting the Enum to Right or Up. When printing the values of Velocity X and Y, everything is as expected, its just the Enum that isn't being set correctly. I think my math is somehow off.

Another weird aspect is Up and Right can be set sometimes, but only if both Vx and Vy are non-zero values, its so weird

note: Due to the orientation of the CharacterMovement component, Down is a Positive Vx value, and Left is a Positive Vy value, dont ask why lmao

gentle urchin
gentle urchin
feral patio
gentle urchin
#
// Do we have any velocity?
if (Velocity.Length > 0.f)
{
  // Is our X bigger than our Y
  if (Abs(Velocity.X) > Abs(Velcotiy.Y)
  {
    // Is X Positive
    if (Velocity.X > 0)
    {
      Direction = Up;
    }
    // or Negative
    else
    {
      Direction = Down :
    }
  }
  // Our Y was bigger :) 
  else
  {
    // Is Y Positive
    if (Velocity.Y > 0)
    {
      Direction = Right;
    }
    // or Negative?
    else
    {
      Direction = Left;
    }
  }
}
lofty rapids
lofty rapids
#

i'll give it a try, idk if this will even work for this game but it's worth a shot i like to try stuff just to see and also to learn

gentle urchin
#

interp speed is pretty low

#

i got default movespeed to 600,

#

so 0.5 for multipler and 1 for interp speed was alright for me

#

If it's to fast I think it'll be painfull for the player : P

#

could make it adjustable in a settings menu tho

feral patio
lofty rapids
lofty rapids
#

i didn't know there was a socket offset

gentle urchin
#

spring arm is underrated ^^

lofty rapids
gentle urchin
#

pretty smooth yeah

#

i'd say it might be a tad fast still

#

causes a lot of movement whenever you switch direction or just start moving ^^

#

there's also easeinout if you wanna try that

#

not sure how well it works with dynamic start tho

#

probably not so well

lofty rapids
#

it's playable

#

idk if i'll leave it but i'll test some settings like you said

gentle urchin
#

slap a bool on it so you can deactivate the feature 😄

lofty rapids
#

probably

steady night
#

@faint pasture ?

lofty rapids
#

just i use velocity all over the place

#

so it's a little f'd at times but not too bad

gentle urchin
#

Nice nice

#

Makes it feel more alive

crimson prawn
#

hello, any reasons why the hide bone by name node doesnt work for children of a skeletal mesh?

faint pasture
#

use transform direction vector

steady night
#

@faint pastureoh ok but what transform :/?

faint pasture
#

you could also use rotate vector which would do the same thing

toxic copper
#

Hi folks, just started with unreal so I apologize if this is really obvious. im trying to build a "choreographed" bullet hell attack, but nothing fancy for now.
Basically I created an actor with a ton of different arrow components to indicate where projectiles would spawn//what direction to travel.
I then set a map for integer:Transform, to where I got the world transform for each arrow, and input an integer to represent each arrow.
I then created a timeline that "Finds" from the map, pulling the integers from the timeline. However, I notice that sometimes it'll fire in a random direction, or some directions get completely skipped

faint pasture
#

random vector in cone will give you a vector in a cone centered on 1,0,0
rotating or transforming that vector with the rotation or transformation of your muzzle will rotate the whole thing to align with the muzzle with the random offset

bitter star
#

Hey guys, I'm trying to set a variable's value from a blueprint inside another one. I cast to the blueprint that holds the variable but I'm not sure what to put in the "object" pin. Isn't the "cast to BP... " already referencing my other blueprint?

faint pasture
#

Use a timer instead

#

timer, index math, an array of scene components as your firing locations/directions

#

Timer fires -> increment counter -> choose scene component -> fire bullet from it

toxic copper
#

just to clarify: you're saying the issue im having is due to framerate and aliasing, and are proposing using a timer instead?

faint pasture
#

yes

#

you're either skipping over or double firing some bullets as the float is just barely going above your truncated cutoff

#

the timer method will never fail, if framerate drops too low it'll of course have to fire multiple on a frame but it'll still not skip any

toxic copper
#

i think i see. honestly not sure i fully understand, but im all for any improvements that will make it more consistent

#

i just started this last week, what timer node do you recommend?

toxic copper
#

Thanks so much

proven sigil
#

so i im trying to make a container that a player will find loot in but ive followed the belove video (re checked it twice) and when i go to interact with the container nothing happens and my interact key works because i have a item on the floor im able to pick up and see in my own inventory any sugestions? also this is my first ever project so im really new to unreal and code stuff in general https://www.youtube.com/watch?v=l6eXqK0zHHI&list=PL4G2bSPE_8umjCYXbq0v5IoV-Wi_WAxC3&index=11

We are revisiting one of my first series on the channel; the inventory system series, this time with different implementations, improvements, and now in Unreal Engine 5.

In Part 11 we develop the inventory for our container.

SUPPORT ME
Patreon I https://www.patreon.com/ryanlaley
Buy Me a Coffee I buymeacoffee.com/RyanLaley
Donations I paypal....

▶ Play video
little coral
#

Ahhh small question
i created a menu widget and would like to open the level when begin button is clicked
it does load the level, but the menu does not get removed

the main menu is loaded in the main level blueprint and this is the main menu blueprint

#

this is where it is added in the viewport

proven sigil
lofty rapids
little coral
#

i dont think so it is in the main level blueprint

little coral
#

i created a loop not knowing, it reloads itself

#

damn that took time to figure out haha and oh that is gonna take some gymanstic to fix

bitter star
#

I have a laser system in a BP and I want to modify the intensity value set in its BP in a different BP. I created a laser variable (actor ref) and used cast to the BP. unfortunately it's not working. Does something look wrong?

lofty rapids
bitter star
#

The value i'm reading with print string is correct

bitter star
lofty rapids
#

so the cast is not failing ?

bitter star
#

it doesnt look like it as my print string works until the end of the chain

bitter star
lofty rapids
#

so your print string works after the cast ?

bitter star
#

yeah

lofty rapids
#

the value is correct come out of the clamp ?

bitter star
#

yes

lofty rapids
#

it's not updating the variable ?

#

it should be

bitter star
#

no it's not

#

I know....

lofty rapids
#

are you setting that variable elsewhere ?

faint pasture
#

casting is not a "send a message"

solid needle
#

is this normal?

#

making an anim montage that is 197500 frames long

bitter star
#

yes in the laser BP

solid needle
#

the parent is 79 frames long 😭

faint pasture
lofty rapids
#

and you probably don't need cast if you selecte the exact object ?

#

it should be that class

faint pasture
#

Show where you tell Laser what it should refer to

#

show where you set Laser

#

Probably nowhere

solid needle
#

how the hell can i chnage this to a normal range

bitter star
faint pasture
#

How does it know WHICH one to talk to?

bitter star
#

I though casting to the BP and referencing it woudl work. Once I cast to the BP I can set the value of the variable from that BP

faint pasture
#

I'm guessing what you have is a variable called Laser which is of the type BP_Laser_whatever reference.
You need to set that. You're saying that Laser REFERS to a BP_Laser_whatever, but you never tell it which one.

#

casting is not what you think it is

#

is there anywhere in your code where you SET Laser?

#

You have a bucket that can fit a laser in it but theres no laser in it since you haven't put one in. It's just a laser shaped bucket.

proven sigil
#

does anyone know whay this would be failing?

faint pasture
#

assuming it's failing the cast which you mean by "failing"

#

Probably GetActorOfClass on begin play

bitter star
faint pasture
#

if the laser is around and there's only one of them it'll fetch that reference

#

but it's up to you How does your main BP know which laser it cares about?

solid needle
#

mb

faint pasture
#

also check what's being exported with a fbx or gltf viewer

faint pasture
proven sigil
faint pasture
#

is it a laser being held by a character? or on a character's gun?

faint pasture
#

have you told the gamemode to use MyController as the default playercontroller?

proven sigil
bitter star
faint pasture
faint pasture
#

if you do, show its properties for default pawn and playercontroller etc

#

if you don't, then your playercontroller isn't being used, you need to make one

bitter star
faint pasture
#

if you remove the cast it'll work

#

but you won't be using the Laser variable at all

bitter star
#

i dont care about the laser variable, i just created it to ref

faint pasture
#

you'll want to instead have:
BeginPlay -> Laser = GetActorOfClass(BPLaserWhatever)
Tick or Whatever Event -> Laser.Visibility = Clamp(whatever)

#

What you have is like looking someone up in a phone book every time you want to call them, when you could just save their number

proven sigil
bitter star
dawn gazelle
proven sigil
lofty rapids
#

probably along the way you didn't set you controller in the game mode override

dawn gazelle
# proven sigil ok so how would i fix this? sorry its my first project so i dont really know any...

Well you can't plug in the BP_FirstPersonCharacter into that target as it's not what it is expecting. In order to specify what your default PlayerController class is, you need to create a custom game mode. When the custom game mode is created and you specify it as the game mode to use for your level, then you can select the default player controller class to MyController. Once that is done, that cast should probably succeed.

proven sigil
bitter star
proven sigil
#

It’s late for me so I’m off to bed but thanks for the help anyways @faint pasture @dawn gazelle

faint pasture
#

and when is that variable being changed, all the time?

craggy flicker
#

Hey guys, I'm having trouble with some basic geometry lol. I'm trying to check if two boxes overlap. I have the four corners of each box as vectors. I thought I could do:
RoomA.MinX < RoomB.MaxX and RoomA.MaxX > RoomB.MinX
and
RoomA.MinY < RoomB.MaxY and RoomA.MaxY > RoomB.MinY

But I'm pretty sure my blueprint nodes need some correcting or im misunderstanding something

#

im trying to build a dungeon generator from scratch

faint pasture
#

and are they axis aligned or at any old orientation?

craggy flicker
#

completely so there's no overlap on any corner

#

they all basically start at the DungeonGenerator origin, then pushed on the X,Y axis as their position

#

then scaled via X, Y

#

for size

little coral
#

Hi Again

#

How can i stop the menu from creating itself on each level load ?

craggy flicker
faint pasture
#

might be correct but it's pretty unraveled

craggy flicker
faint pasture
#

just make a function to do the one

#

then call it in a loop on all 8

little coral
twin perch
#

got a quick question about the construction script.

if i spawn in an actor, is it possible to have it set a value on spawn ? like a constructor would in code ?

For example i want a damage number to fly out of my enemy, on creation of the actor i want my Enemy script to send whatever damage is being delt to the enemy to the actor on creation.

craggy flicker
versed sun
craggy flicker
#

bruh

faint pasture
#

lmao

craggy flicker
#

🤦

#

iSpOiNtiNboX

#

smh

faint pasture
#

watch there be a "IsBoxInBox"

craggy flicker
#

smh smh

#

im physically cringing at myself

little coral
#

there is no shame in learning bro

#

we all learning here

versed sun
#

you got +12 BPXP

twin perch
#

there are a billion usefull nodes in unreal ...

bitter star
craggy flicker
bitter star
little coral
#

i create the mainmenu widget in the HUD, and on it there is a button to load the level, when the level loads, i am back on the menu, it does not actaully go to the game

undone bluff
#

yea, frankly just make an entire gamemode just for the menu

craggy flicker
craggy flicker
undone bluff
#

why'd you use the same hud class for the main menu and game

#

unless you do them both in the same level, but then you'd not be having this issue

craggy flicker
#

i feel like having no main menu level is just bad design imo

undone bluff
#

interesting, how come?

faint pasture
#

never change level

#

no hard cuts from startup to shutdown

#

except for the unavoidable hard load when joining a multiplayer game

craggy flicker
#

isn't it a lot of extra work though

undone bluff
#

just cause 3 does it too

versed sun
#

any downside to that ?

undone bluff
#

initial loading time for one

faint pasture
#

it's proc gen so not much to load

undone bluff
#

well, unless you stream the world in later

#

or generate yea

#

though might as well do any loading you can async during the main menu

little coral
#

So what you are saying i should do this in the main level blue print or what ?

faint pasture
#

Do what you want

#

but making a gamemode and level for the main menu isn't bad

undone bluff
#

not that you should, it has advantages and disadvantages

craggy flicker
undone bluff
#

it's certainly much nicer to work with a separate level

little coral
#

we need an ai assistant in unreal engine pronto lol

undone bluff
#

and for some games it's the best way to go objectively

#

wth is that gonna do

craggy flicker
#

in visual studio

queen dagger
#

OMG I FIGURED IT OUT

#

i had in certain blueprint get playter pawn when it should have been get owning actor

bitter star
wise ravine
#

Hey, aren't Structures technically a form of communication between blueprint classes?

undone bluff
raw pilot
#

I don't get the issue, why is this not possible??

#

both of my variables are of the exact same pin type???

versed sun
#

is Stages an array of FQuestDetails?

raw pilot
#

yes it is

versed sun
#

or fStage Details

#

!= FQuest Details

raw pilot
#

its an array if of FQuestDetails

#

huh

#

hold on

#

i get this tryna change it to Fquest

wise ravine
raw pilot
# raw pilot i get this tryna change it to Fquest

LogBlueprint: Warning: Recursion: Recursion: Struct cannot have itself or a nested struct member referencing itself as a member variable. Struct 'UserDefinedStruct /Game/Quest_System/FQuestDetails.FQuestDetails', recursive parent 'UserDefinedStruct /Game/Quest_System/FQuestDetails.FQuestDetails'

undone bluff
wise ravine
undone bluff
#

no

wise ravine
undone bluff
#

it's no different from a variable

#

it's just a collection of them

lusty hedge
#

Does anyone know why a print string wouldn't print????

#

none of them are printing. but all of the other nodes after work

wise ravine
# undone bluff it's just a collection of them

Well for example, If i had a character blueprint that held it's health in a structure, and I wanted a separate blueprint class to access the characters health... I could implement the structure in the separate blueprint class and access the variable that way correct?

north rain
#

I have this variable that is marked as public and all the settings for it are shown in the picture. The object that this variable is in needs to inherit from the Pawn class so it can have AI capabilities and this variable needs to be exposed in the main editor window when the object is dragged into the scene. The problem is that when the object inherits from the Pawn class, the variable isn't visible in the main window, but when I change it so that the object inherits from the Actor class, it is visible there. I've tried looking this problem up, but I can't find anything mentioning why this happens, let alone how to fix it. Thanks!

wise ravine
raw pilot
#

jesus

lunar sleet
undone bluff
#

because you're changing a variable in the character, not in the separate blueprint

north rain
lunar sleet
#

Oh, mb misread

north rain
#

no worries

lunar sleet
#

So you can’t expose it if it’s in Pawn ?

#

But your expose on spawn is not checked in the screenshot

wise ravine
undone bluff
#

I mean if you change the variable you change it

#

the instance in the memory

north rain
undone bluff
#

the structure you define in code (or blueprint binary) sits on your hard drive

wise ravine
undone bluff
#

it's literally part of your games code

lunar sleet
wise ravine
lunar sleet
#

And did you make sure to recompile

undone bluff
#

well yea, you could change the data and then recompile your game

#

but that is completely unrelated to communication

wise ravine
#

this is just confusing me more 💀

north rain
#

Now its suddenly gone when I change it to Pawn

undone bluff
wise ravine
undone bluff
#

nope

bronze mirage
#

dumb question- i'm using the third person template, how do I make the camera not move downward when I use the built in Crouch node?

undone bluff
#

let me explain it this way

wise ravine
undone bluff
#

the struct in your content browser is like your player character bp

#

when you add the struct to your character it's kinda like dragging that character onto the level or adding it to your game mode

#

now when the game actually starts these are all just templates to create instances of

wise ravine
#

I see

undone bluff
#

i.e. a version of the character and the struct that exist in the memory (RAM)

#

these are what actually can be used at runtime

wise ravine
#

This make's sense now

undone bluff
#

every single instance is entiely its own object

#

so if you add the same struct to two BPs that just means you have two instances that inherit from it

wise ravine
#

Before I thought that you could directly change the value's of the variables inside of a structure during runtime. So I thought you could communicate indirectly between blueprints by accesing the variables held in a structure and setting and getting them

#

So like an alternative to directly communicating to a blueprint to get it's variable

#

but I see now, why that is not possible

undone bluff
#

the closest thing to that is how saving and loading works

wise ravine
undone bluff
#

writing to and reading from an actual file on the regular system storage that will not disappear when the program is closed

main lake
#

Why my characters are floating from the point of view of the other player ?

wise ravine
#

I Appreciate your explanation and help 🙏

#

thanks

undone bluff
#

if you want regular variables you can access anywhere that's what subsystems are for but require C++ to setup

trim matrix
undone bluff
#

well, it's an object you can store data and define logic in with a clearly defined scope

#

A game instance subsystem is pretty much completely global as the game instance is practically the game itself

#

the enhanced input for example is a local player subsystem

bronze mirage
#

i'm guessing this is for first person games, you'd want the camera to 'duck' with the player, but I'm making a third person game and it's just jarring. starting to wonder if I'll just need to roll my own crouch functionality

undone bluff
#

consequently the capsule moves down so it touches the ground

#

the camera inherits its location so it follows

#

probably just attach it to the mesh instead

lunar sleet
lunar sleet
river comet
undone bluff
#

and us both happening to mention recompiling

lunar sleet
magic horizon
#

ive created a lock on system that interpolates the camera to always face an enemy actor however ive taken a liking to the dmc camera system where it more or less just makes sure that both objects are in frame

#

is there something that I can do to check on both actors and sort of equalize where the camera is viewing based on that

lunar sleet
#

prly some math

#

distance to actor and dot products? 🤷‍♂️

magic horizon
#

yeah but its not necessarily taking a mid point between the two

lunar sleet
# north rain yah

I tested by making a test pawn with a test vector array and making that array instance editable. placed it in level and it shows

#

reparented to actor and back and still there

#

maybe you have some sort of bp corruption, you could try remaking the bp @north rain

north rain
#

@lunar sleet I'll give it a try, thank you for testing it out.

#

I wouldn't be surprised if it got messed up since I originally made it as an Actor, and then reparented to Pawn and that mightve messed some stuff up

icy plover
#

I changed the ThirdPersonController so that the left and right keys would rotate the character in place. Just like tank controls. This was the only part I changed. How can I increase the rotation speed?

frosty heron
#

Interpolate to target rotation instead

#

Keyboard a increment the target by x factor
Keyboard d decrement the target by x factor

#

X is your speed

#

Interpolate from current rotation to target rotation

faint pasture
#

you want value x speed x deltaseconds

#

and you're better off using add controller rotation instead of get and set unless you have some specific reason to do that

#

add controller yaw and add controller pitch

north rain
lunar sleet
#

Yeah odd

north rain
#

I guess maybe that Category name is just reserved even though it doesn't appear in the list?

icy plover
faint pasture
#

just multiply value, speed, and delta seconds, and feed it into Val

#

it's asking how much roll you wanna add

#

assuming you're in a pawn, you can add the values to YOUR controller's rotation, not just the first player controllers rotation

bitter star
#

How can I go out of an array (GetAllActorsFromClass) into a scene component object reference target? Basically telling the BP to select all actors of class and doing the same action for every single one of them?

#

the for each loop applies to all objects in the BP and I cant figure out how to select only one SM in the blueprint

gentle urchin
#

The foreachloop runs throigh all the actors.

#

Then you can "getCompomemtOfClass"

#

Or GetCompomemtWithTag

faint pasture
#

An actor might have 100

haughty iron
faint pasture
#

What is the actual mechanic you are trying to implement?

haughty iron
#

But getting all actors of class is expensive, could cast to a manager (game mode, instance ext and set an array on there, when the being play fires you get a reference to it and add itself to the array, when you need to trigger the action you loop through said array as all the needed assets should be inside it

bitter star
#

I have a NS that I want to fire on custom event. Couldnt figure out how to activate/deactivate with a flip flop so I used the toggle visibility.

haughty iron
#

https://youtu.be/EM_HYqQdToE?si=yWgu4bRCNLoftJPE for reference, there is sections in here about interfaces and event dispatchers that might cover what your looking for

Announce Post: https://forums.unrealengine.com/showthread.php?101051

This Training Stream takes a look at Blueprint Communication. We find that Unreal Developers of all levels can sometimes struggle through the concepts behind moving data between objects. So in this video we'll take a look at the different ways to make Blueprints talk to one an...

▶ Play video
bitter star
#

This works. Not ideal but it works

bitter star
thick bramble
#

Out of curiosity. What is preventing Epic from exposing more features into blueprint? Why isn't every built in function marked as BlueprintCallable(not counting functions that use non blueprint supported things, like e.g. pointers to structs)

faint pasture
#

When XXX in the game happens, you want XXXXX to happen.

bitter star
thick bramble
bitter star
#

My bad, that was for @faint pasture 🙂

icy plover
gentle urchin
#

Nothing is really stopping them

#

Time constraints and whatnot i guess

bleak crystal
#

sorry if im just barging in here!

got an issue to do with line trace, though -- been driving me a little bit insane. not an unreal expert so i figure maybe theres just some small piece of info im missing.

i have an actor with a static mesh that i want to be hit by a line trace. it is Not doing that.

  • first image is my current line trace blueprint (disconnected everything that comes after, all im looking to see right now is if it'll turn green when it hits my mesh. previous node is just event tick)
  • second is my mesh component's collision settings
  • third is the line trace going through my actor
  • fourth is a random unreal cube with default settings going through the line trace, proof that it at least works and is more to do with my actor.

ive tried just throwing the mesh itself into the scene on its own, but that doesnt do anything either. it's custom (not particularly amazing, meant to sort of be a placeholder atm) so if that can cause any issues, i suppose that might be what's happening. it's also a child actor of the blueprint that creates the line trace, but when i press play another child that only exists for a few seconds is clearly detected as well, so im not sure that's the issue.

if anyone can help i will cry tears of joy 🙏

frosty heron
main lake
#

Why does this raycast always goes forward instead of the direction of the camera where I'm looking at ? 🤔

frosty heron
#

Why do u need the rotation at all?

#

If u want it to point where the camera look at just get its forward vector

main lake
frosty heron
#

If it's always the player camera u can use the camera managee

#

Get player camera

#

I don't know what object current camera is

main lake
#

It contains the current active camera as I have a system where you can switch between FPS and TPS

frosty heron
#

That's just setting the camera in the server machine

#

Sure u replicate it

main lake
frosty heron
#

But depend on how u access it, u may or may not get the data correctly

#

Sry not gonna check it

#

I think camera should be handled locally anyway

#

F me dead if I have to wait a second to toggle my camera

main lake
frosty heron
#

U shouldn't worry about cheating when using blueprint only. Focus on with the limited power on what you can do

frosty heron
#

U don't even have server validation in blueprint

main lake
#

what do you mean by "server validation" ?

frosty heron
#

But it's cpp only

main lake
frosty heron
#

@bleak crystal u have more chance getting answer with 1 question at a time. Write it as descriptive as possible but keep it short.

Provide relevant material to that question alone

frosty heron
#

If I am I will make it clear

bleak crystal
lunar sleet
#

only doable in cpp tho

main lake
frosty heron
#

There's a process one can do with rpc in cpp to drop rpc when it's not valid

lunar sleet
frosty heron
#

Takes a few min to search it

frosty heron
#

Start reading then

main lake
frosty heron
#

Which you haven't done so ofc u won't knkw

#

I tend to ask my friend google

lunar sleet
#

and also maybe restart engine just for sanity's sake @bleak crystal

main lake
frosty heron
#

The scope shifted when it is a multiplayer game

lunar sleet
#

@bleak crystal did you say this object is a child of the actor that fires the line trace code? I'm confused

frosty heron
#

For all we know, u could be getting the wrong cam at the time

#

In client machine

lunar sleet
lunar sleet
#

your start should be camera location, your end should be cam fwd vector * desired distance + cam location

main lake
lunar sleet
#

world

#

relative means relative to attach parent, so pointless here

main lake
lunar sleet
#

k, so what's happening exactly?

main lake
# lunar sleet k, so what's happening exactly?

The raycast always point forward of the capsule / Character Mesh instead of the camera forward. Like for instance when I look up, I expect the raycast to go up but it keeps going forward (parallel to the floor)

lunar sleet
gentle urchin
lunar sleet
#

oops, didn't notice you fixed your issue, sry for the spam todo 😅

main lake
lunar sleet
#

sec testing

main lake
#

example

lunar sleet
#

works fine on my end, even works with Camera as channel

#

I put this in the FPS template

paper crypt
#

Hey! my project is so far coming along, my current attempt that im having an issue with is i want to create a function in my button to change the players POV to a camera pov. like a cutscene or like a telescope/binoculars zoom in games where you see through it and can hit ESC to go back to normal. Any ideas?

main lake
#

It works with the TPS Camera

#

but not the FPS Camera somehow

lunar sleet
#

why are you doing a validated get of the camera?

#

is this not inside the char ?

main lake
lunar sleet
#

if it exists in that bp

main lake
#

🤷‍♂️

lunar sleet
lunar sleet
#

your camera component exists in your bp, there's no reason to check if it's valid, you know it's valid, it's there

main lake
lunar sleet
#

oh, is that switching between 2 cameras ?

lunar sleet
#

ok, well did you check if it passes the valid check?

gentle urchin
#

and if the current camera is updated ..

main lake
frosty heron
#

Doesn't matter if it get the wrong cam at the time of accessing it

#

Imagine doing something like server rpc change cam value , then set the cam right away

#

Not gonna work especially with a slight ping

gentle urchin
#

No clue what this setup is about x)

#

havn't really paid attention, trying to actually get work done

frosty heron
#

If u wonder why because it takes x amount of time for variable to be updated from server to client

#

X being round trip time

#

Something you should look at if doing mp

main lake
#

wait a minute

#

the one above was when it was pressed by the host

#

however when trying from the client it's inverted

crude knot
#

I'm trying to set the image of the objects after clearing the children, its not working. Sorry if it's a dumb thing

main lake
gentle urchin
#

doesnt seem like it

main lake
gentle urchin
#

at the very least create a public function that takes in the new brush / image

#

then handle the updating inside the widget itself

#

Usually It's just neater to send all the data to the child widget

#

The entire S_Items

#

Like this

#

then on the sub widgets construct you can directly use this data

crude knot
#

Thanks, I'll try to make the changes

gentle urchin
#

Always try to encapsulate the logic of updating things to be within the thing that owns the variable

#

Keeps it easy to maintain, and bug fixing is just single sourced : )

#

Along with expanding functionality (Oh, now i want to do X when Y happens) is so much easier

crude knot
#

Thanks for the advice!

frosty heron
lunar sleet
#

Diff instances

#

So ColdSummer was right from the get go.

frosty heron
#

One is fps cam the other tps cam

#

Ye it's mp issue

#

Not the raycast

#

I mean I don't know math

#

But not sure why rotation introduced

lunar sleet
#

And this is why we don’t do multiplayer first kids 😀

frosty heron
main lake
# frosty heron Nope, read it carefully

on the server it's the same value which make sense as the host is the server so both value will be the same but yeah that's on the client where it's messed up

frosty heron
#

By same I thought u sync them

main lake
frosty heron
main lake
gentle urchin
#

13

main lake
gentle urchin
#

why less?

frosty heron
#

For reference I also don't know if I'm ready for mp

#

Anyway before diving to mp

#

U need to make a functional sp with heavy OOP

#

Not knowing oop = just work on it in singleplayer first

#

And keep going until you are comfortable

lunar sleet
#

Basically multiplayer is like learning a whole new engine almost

gentle urchin
#

atleast a few concepts , over again

#

and in bp only you're fairly limited to how you do things properly

lunar sleet
#

The laws of physics go from regular to relative essentially

gentle urchin
#

ends up with a bunch of "delays" and whatnot

main lake
frosty heron
main lake
frosty heron
#

And I'm not the only one with the opinion

#

Well I don't want to attack u

#

But my suggestion stay the same

main lake
#

the only issue I had was I didn't know how to call the parent of a child bp, I was searching through the search bar but the solution was to right click on the node and click on "Call Parent"

lunar sleet
#

Ultimately do what you want but I’d at least try to live in #multiplayer if you’re going this route, read all the pins and such

frosty heron
#

That's just one tiny little thing

gentle urchin
#

good understanding of OOP is relatively essential

main lake
gentle urchin
#

Not that one can't get out and about without it, but life is far easier with it

frosty heron
#

How many years have u used unreal?

main lake
gentle urchin
frosty heron
#

I'm gonna go b to work

#

Gl on your game

gentle urchin
frosty heron
#

Learn cpp if u r young

#

So u don't end up like me

#

Working as delivery driver

#

Get a job in game dev, up skill

main lake
gentle urchin
#

thats young

frosty heron
#

Fuck no

#

I'm 32

gentle urchin
#

both relatively and absolutely

#

I'm 33 😦

frosty heron
#

U r at the right age to start

gentle urchin
#

I wish i started 15 years ago

lunar sleet
#

People still hire you at 25 😀

gentle urchin
#

with cpp

lunar sleet
#

Imagine…

frosty heron
#

Drop Ur game and learn cpp , if I can time travel, I would slap my old self and learn it earlier

main lake
frosty heron
#

It's essential for multiplayer too

gentle urchin
#

2-3 years ago

main lake
gentle urchin
#

I've been with the engine for 8 years

main lake
#

oh then that's why 😄

lunar sleet
#

Prly cause he listened to advice 🙃

gentle urchin
#

It's one factor

main lake
gentle urchin
#

time spent in engine > years since start

main lake
#

and the fact that we don't have a free extension by Epic Games for visual studio cpp themselves gets me crazy

gentle urchin
#

I'm glad there's no clock on hours in engine

lunar sleet
#

(Time spent in engine + money) * fwd vector - age

gentle urchin
#

xD

#

brainpower

main lake
#

x)

gentle urchin
#

also needs to be in there

lunar sleet
#

And attention span tbh

gentle urchin
#

that too

lunar sleet
#

The age kinda covers that tho tbh

gentle urchin
#

I could've gone far more serious into cpp tho, I'll admit

#

I havn't done my due diligence

#

Since i had some prior programming experience with totally unrelated stuff, I just ... went ahead

lunar sleet
#

I know a little, but I’m procrastinating adding it to my current project, so far I tell myself I don’t need it, but I will eventually have to

sonic oak
#

I'm trying to make it so that when clicking on a part of a static mesh, it will change the material. Since the static mesh is made up of multiple parts with their own materials, I need to check specifically which face was hit. However, it always seems to return 0 for the face index regardless of which part of the static mesh I click. I've got 'advanced collision' enabled and in the static mesh and all of the subgroups under the LOD have collision enabled.

Any ideas?

main lake
#

So how am I supposed to sync those variables if it's not done already dony by the OnRep 🤔

gentle urchin
lunar sleet
#

Nice

gentle urchin
#

My current project is made 80% in cpp

#

with multiplayer, my least favorite part of unreal xD

#

and the thing i lack the most experience in

lunar sleet
#

What’d you use to learn UE cpp?

#

Or cpp in general

gentle urchin
#

Experimenting alot, reading some source code here and there

#

So if i were quized i'd probably lack some fundamentals 😄

lunar sleet
#

But the basics? Tom Looman and such? I did CS50 so I learned some C and Python, but tbh I only started understanding OOP properly by using UE

gentle urchin
#

I never completed the CS50

#

I'm like 2 weeks in and its .. meh

#

Im an automation engineer , so got some experience with ST

lunar sleet
#

And I kinda can read cpp cause I know what it looks like in bp lol

gentle urchin
#

I've considered picking up a book or two about cpp, but can't really find the time to do any serious reading about it

#

Any sparetime i got is spent on the project 😛

lunar sleet
#

I have a hard time reading now, after having my brain trained to ingest video content instead lol

gentle urchin
#

Haha that too.

#

attention span has gotten narrower

#

damn short format video content

lunar sleet
#

Indeed 😞

faint pasture
lunar sleet
gentle urchin
#

damn

#

I cant stand those long ones xD

main lake
#

Why is "Client 0" printing twice ? 🤔

gentle urchin
#

I find them painfully long

lunar sleet
#

Wrong reply but you get it

lunar sleet
gentle urchin
#

Ah well, they try

#

some is good

#

I complain louder than I'm meaning to lol Easy to critique them when I got nothing at stake or to show for x)

faint forge
#

I have several number of hard references to other BPs, for example in the PlayerController I have hard reference to a specific PlayerState. But for example now I wanted to try another duplicated modified version of that PlayerState and I should have to replace of the references, in PlayerController and other BPs.

To avoid now and in the future to make several amount of changes that slow down development I wonder if I have add my PlayerState reference in... the blueprint function library?

I should avoided from the beginnign this hard ref way but I learned unreal through the process

gentle urchin
#

Is it an option to create a Base playerstate that you run off from?

#

you still need to fix all the ref issues as they will be new refs

#

so all old pins will break

#

if you however have a base one you use, you can just extend and override what you need

#

other options is the good ol' interface or a component on the Playerstate.

faint forge
#

for sure now I have to relink a lot, but I am hoping to find a way that allow me to fast debugging in the future, changing to different PlayerState, Controllers etc

gentle urchin
#

Components can be added to anyone

#

so I'd suggest considering that

#

then they can hold states etc by themself aswell 🙂 Interfaces cant

#

and require explicit implementation per implementing class

faint forge
#

I cant find a youtube video that I think it wqas adding the cast in a BP function library

gentle urchin
#

Go the component route instead if you can 🙂

faint forge
gentle urchin
#

Pattym has an example use of component with his Actor Registrarion comp

#

this is part 2, i'd perhaps suggest start at part 1

#

Actor Components are basically reusable script modules that you can attach to any Actor class

faint forge
gentle urchin
#

(you wouldnt cast to your specific playerstate)

faint forge
#

and then if I need to test anothe different PlayerState, I just either change the component or create a new one

gentle urchin
#

you'd want to stay as independent as you could 🙂

#

Any Other actor that needed access to this would simply do

SomePlayerStasteRef -> GetComponentByClass(MyComponentClass) -> DoThing()

faint forge
gentle urchin
#

If its a single player game you can mostly just use the static "GetPlayerState()"

faint forge
#

in my Bp Character right now I am casting to PS_Fight lets say
and I want now to test PS_FIght2
problem is that this little change is fine but I have several references to PS_Fight in different BPs, from GameState to PlayerControllers
I want a way to change the reference to PS_Fight to Ps_Fight2 in the fewer steps possible
and this PS_Fight (and its slightly changed duplicated PS_Fight2) has specific variables than I am accessing, thats why I was casting as Cast to allows me that

gentle urchin
#

And I'm saying, if you extract your logic from PS_Fight and move it into a AC_Fight , then this can be put on any PlayerState and it will simply work

faint forge
#

ah

gentle urchin
#

Assuming the Component can hold all the necessary info ofcourse. which it probably can

gentle urchin
# faint forge ah

you'd still need to fix your references once , and refactor the code to live inside a Component,,

#

but aside from that all future changes to PlayerState classes will be effortless

faint forge
#

I get it now, to move all the code from PS_Fight to the component, and then everytime I am "Casting to PS_Fight" just to say "Get PlayerState" then "GetComponent that I created" and from there I can get all the variables (and logic that I moved inside there)

gentle urchin
#

Correct

#

100%

faint forge
# gentle urchin Correct

is there any limitation in performance or multiplayer implementation (I am planning in some moment) that I should have in mind?

  • to use a Component
    to move all the code from PS_Fight to the component, and then everytime I am "Casting to PS_Fight" just to say "Get PlayerState" then "GetComponent that I created" and from there I can get all the variables (and logic that I moved inside there)
    if I need to test anothe different PlayerState, I just either change the component or create a new one

  • or a Blueprint Function Library
    where I Cast to PS_Fight
    and in case I need to test another PlayerState, I just change it there

gentle urchin
#

Nothing to think about at all

#

the latter requires you to still fix all the references

#

as the old links depends on the old Playerstate

#

the former does not, as the component remains the same, regardless of which playerstate is used (as long as it inherits from playerstate)

faint forge
#

ok thanks!

#

I think I cant add an actor component to a GameInstace, right?

#

I was thinking to do the same with my GameInstance, instead of using Cast to get variables

surreal peak
#

@faint forge GameInstance is actually not an Actor

#

So you can't add components to it

#

Also what is your solution to actually get the component if you are trying to avoid casting?

#

GetComponentByClass and similar stuff is probably more expensive than just casting. And an Interface does in fact cast.
So even if you use a Component you'd probably need to cast. Which is totally fine.

#

But I haven't read the conversation, so might be redundant info

faint forge
#

maybe I should just use a Blueprint Macro Library?

surreal peak
#

What do you mean by that?

gentle urchin
#

So they dont rely on thatSpecificPlayerState

surreal peak
#

So they want to change the PlayerState in the GameMode and it should still just work?

gentle urchin
#

Its mot the cast per'se but the hard link

#

Thry want to change to an unrelated playerstate, yes

#

If their logic resides in the comp, all they gotta do is add the comp to the new PS

surreal peak
#

That's a strange thing to do.

faint forge
#

I have many references to a specific Player State, called lets say PS_1

but I want to try some changes, so I duplicated and renamed as PS_2

#

with some changes

surreal peak
#

Oh buddy

faint forge
#

but all my several references along my BPs go to PS_1

surreal peak
#

You don't duplicate classes to begin with

#

That's what inheritance is for

gentle urchin
#

Yeah base class was suggested

gentle urchin
#

Drawback would be if you add Marketplace asset tonit that requires you to use their PlayerState etc..

#

Then component has an advantage in my book

surreal peak
#

The reason you are struggling is cause you are doing it wrong.

If you want to slightly alter logic of PS1, make PS1_Child and override the functions you want to alter. Or change the variables in it. The casts to PS1 will still work fine then

#

Duplicating to PS2 is not really a solution. The way the GameMode and Game framework classes are structured makes it somewhat needed that you stick to a PlayerState class in your given GameMode and if at all move down the inheritance chain

#

You can use the Components, sure

#

Then use an Interface fwiw to grab the component

#

Some BPI_PlayerStateComponentGetter that just has a function to get the Component

#

And implement that in the PS1 and PS2 and return the component thete

gentle urchin
#

Im lazy with that 🤣 just using getCompOfClass

surreal peak
#

Then you can do GetPlayerState and call the interface function on it

#

I mean sure, you can do that too

#

Your code :P

gentle urchin
#

What does the interface bring to the table? :p

surreal peak
#

Simple Cast + Get vs searching the whole component list

faint forge
surreal peak
#

If you do this once to get the component then it's totally fine

#

Like if you init something and you need to get some movement component of an actor, or a mesh component of it.

#

But if you need to get the mesh comp in 40 places, I would use an interface

surreal peak