#blueprint
1 messages · Page 244 of 1
We want to save the variable obviously
do i use a cast or a get player when calling the function in the widget
both
first you get player, then cast to your class, then drag out and get the function from it
plug the final color into the function input
it says they arent compatible
final color is a slate color
make it a linear color
look just make sure all variables are linear color
and recompile and reconnect your stuff
theyr all linear color
i did 😭
now it wont let me connect it to set brush tint color
then convert the color
break the brush color and connect the values manually
idk, figure it out :D
development is mostly about solving these little issues as well
you're at the finish line with this function
😭 now the image isnt showing
are the sliders changing the character color ingame though?
no
well you need to sort out your variable types there then i guess
it just made the character black again
how can i make the texture change on the animation im playing in the menu live when changing the sliders
idk what you mean by that
well yeah this should work
then you set the value
i think just your variables are a bit messed up
if it's black theres something wrong with the color most likely
make sure youre connecting the values properly
is there a way to change out your leveling data tables with a setting set up in the UI while ingame
you cant modify data tables ingame
idk, the setup looks fine to me. Make sure the values are all fine, test it with some other values manually
dang wanted to set up a way they could adjust the games max level from inside the game
maybe it wants 255 instead of 1 or something, im not sure. debug and test
when changing it manually it looks fine in the player bp and in the menu on the animation loop when changed manually, but when i use the menu to change it, its just black
create a new linear color variable with some random color in the widget just for testing and plug it in the function at the end
to see if that works
when you move the sliders it should then update to that one color
nope
no if i change the color manually in the material it changes, but using anything w the widget makes it black
okay go in your player bp, on begin play put the SetPlayerColor function and as input choose some random color
see if that works
one more thing that could help you, you can use slatecolor for FinalColor like i did to also update your image properly
you can split final color and it will give you a Linear color in its output
so it's an easy conversion
Do you know a place to list just about every nodes?
still nothing
did you try this? #blueprint message
is it bc of this one?
where is this?
player bp
just remove that and try moving the sliders in the widget
no
sliders dont change the player color
well, you made a mistake somewhere then
idk
if youre calling the function from player BP and it works and changes the color, like you just showed
ive sent screenshots of al i have
setting a color manually in the player bp works, the ui dosnt
idk. Check everything, debug slowly
simplify it, go step by step
it can be anything, like even an accidental space character in the parameter name
just go step by step
put print strings, debug, see node by node how it works and youll find where it breaks
its an important skill to be able to debug your nodes
see if the sliders actually fire the events, see if the Final color is being set correctly, see if your parameter names checks out in the material and in the function, check if the player character cast doesn't fail for some reason
etc
identify the precise point in the logic where it doesn't do what you want it to do
only the top one printed
well the second one is just tied to an event that youre not calling
so of course it's not gonna fire
that's just if you wanna set the color of the sliders from somewhere else, like on a game load
oh
yea
then put the print string in the beginning of that event
see if it fires when you move sliders in game
yea it does
but the last one doesnt?
then put one after "cast failed"
see if that one fires by any chance
when you move sliders around
yea it does off cast failed
you can also btw just run the game in another window, select the debug object and see it firing real time
but anyway
thats how i am using it
then you select debug object
then you can see it fire
when you do stuff ingame
but print strings work too for this case :D
anyway, now you identified the problem - the casting to your player BP fails
did you cast to a different class than the one you're using as your player character?
no
then why does the cast fail
show me the name of the BP where you made that color changing function
the player character bp youre using for the mouse
and you're absolutely sure this one is the mouse youre playing as, yes?
yea, i dont have any others, the only other player bps have completely different names
then I don't understand why the cast fails
try plugging "Get player pawn" into the cast instead
nope still failed
did you mess around with the player indexes or something?
no
and is it a single player?
yea single player
what's the widget type? Just User Widget?
yea
still failing
whats a more efficient way of checking this bool?
Anyone ever have a blueprint that, even though it asks for an object reference (a specific one) and you give it, it does not take it?
what is this abomination
very kind of you
i'm not sure of how to use it in this scenario. but the reason i'm not using it is because its picking a single target
it would be probably better if you showed exactly what's happening in your case
i dont want it to apply a status to multiple targets. i'm making sure the target is not dead before applyinh
and what is it supposed to do?
cause you can't see much on that screenshot
fair enough
but you could also use a While loop
i have 4 party members. i'm looking for it to target a single party member thats not dead at random. its a turn based game.
so it says if unit is dead pick someone else
would an IsValid be best there?
I would probably keep track of alive members in a separate variable
then just get a random from that
"get all actors of class" usually means you didn't do something very properly
but it will obviously loop if multiple people are dead and one is alive which is not efficient
have an array AlivePlayers, if someone dies remove them from this variable
then just get a random from that array
i only have the 4 members. its just easier to grab all party members for me this way. performance isnt an issue so i just kept rolling with it.
and you dont have to loop anything
yea i figured that would be the solution. i was hoping for something more lazy haha
this is lazy enough :D
still cant figure out why its failing 😭 💀
just before that cast node, put a print string node there, and drag out from "get player character", find "get display name" and connect that to the print string
see what it prints when you move the sliders around
nothing prints
I really don't know why you wouldn't be able to access the player character from there
It works fine for me
you could do a workaround and make the function in gameInstance or GameMode or something
surely you can access those from the widget
how would i do that
before you do that - how are you creating the widget with the sliders?
are you adding it as a child to some bigger container hud widget?
and in your player controller you add it to viewport?
its its own one made when the player clicks the customize button on the main menu
then to go back to the mainmenu
hmm okay I don't think the issue could be from this
but idk this is not usually how I do widgets
I have one main container widget and all other windows and menus are just children dragged into it
but I'm not sure if that would change anything about your issue here...
how would i do the workaround in my instance?
do you have a custom gamemode and gameinstance BPs made and set?
that's fine
game mode is thirsperson
can you see if you can access and cast into your game instance BP from that widget?
same like youre trying to do with the player character
see if that fails too or not
wont let me connect to the set color node bc its not my player
well ofc but that's not what I asked you to do :D
just wanna know if the cast fails or not
okay then let's offset that function through the gameinstance
it's a bit scuffed but whatever, if it works... :D
basically just create a "middleman" function in your game instance
wdym
in your game instance create a new function, call it idk something like "SetPlayerColorGI" (for Game Instance)
give it an input of Linear color
then inside of that function, do the player character cast and call the actual SetPlayerColor function from that cast, and connect the linear color input into that
and then in your widget you call the function from Game instance instead
it's gonna do the same thing, it's just gonna go through the GameInstance function first
(this of course wouldn't be needed if the widget let you cast into player character but really I have no clue why it doesn't)
like this?
wdym 😭
I meant to call the function you made in the player character
just in case you wanna put some more stuff in that function (which you later might), you dont have to copy paste duplicate it here as well, you know
yep
now call this game instance function instead in your widget
no
put print string on this cast failed too
in the GI function
does that fire by any chance?
it fails
um
okay then the issue isn't that the widget can't get player character
so you can revert back to that
the issue really is just in you trying to cast your player character it seems
but without seeing the project I really can't tell why that would be happening. You made some mistake.. somewhere
probably
ive sent all the screenshots of it lmao
no the screenshots are fine
I mean somewhere else
deeper in your core game logic
did you set these defaults for your projects?
yup
okay
and you said youre using this somewhere else during the gameplay and it works fine?
in many places
same
Are you even using the custom game instance
yea
Show? Also name your assets better
and i double checked a sec ago
I dunnoe, your custom gi is called game instance too
Just name it different and check again then show
Ah yes, thank you
yea.. bc i was suggested to title it that lmao
Who did...
right here
huh
For blueprint assets, prefix with B_
thats all ive edited
i havent changed anything w my game instance
been setup for saving for a few days havent messed w it since then
I prefix with BP_ cause I'm a bad boy
That's me on my new project as well but I wish I didnt
I'm still using wbp too
Instead W
Feels old school
Add break point, learn how to debug
Analyse line by line
I mean tbh any naming convention is fine as long as youre consistent with it and you understand it
Having standards is good, especially if you are making something public
wow alot of negativity lmao
ok lol
A healthy one
anyways
none of my other casts to my player fail, this is the only one i checked my other objects again
The only two reasons a cast would fail:
- The object you're feeding in is not valid at the time the cast is being executed.
- The object you're feeding in is not a member of, or a child of the class you're casting it to.
If you're certain that the object should be of the correct class, then the only option is that object you're feeding in isn't valid to begin with at the time the cast is being executed.
so how is my player not vaild
When are you executing this logic?
to change the color, in the main menu
begin play in the player bp
You're executing that within the Third Person Character, there's no cast here.
the cast is in the widget
in the menu..
Where's the cast that is failing?
At what point is this called? Construct?
idk ask @zinc jasper i copied their setup
Can you follow your execution line back and see how this gets called?
its in a custom event
And what calls that event?
Like herding cats lol
ive already sent these screenshots lmao but
Don't expect people to do your homework, instead here the screen shoots, fix it.
You should ask specific question
im not expecting them to tho.. i have been asking questions along each step 💀
I don't see the relationship as I don't know how these last two screenshots are connected.
theyr the same bp
Breakpoints
Btw, if people say “learn this or that” they mean to help you learn so you can figure things out yourself. If you rely on others to hold your hand every step of the way in perpetuity, you’re going to hate gamedev 😀
What event calls the cast?
And aside from Datura and Authaer , few have that much patience 😁
and where am i relying on holding my hand? this channel is for help, that why im here lmao
You posted a screenshot that shows an execution path with no start, so I don't know what the fucntion/event is.
Break point break point break point
I’m referring to the negativity comment you made. They weren’t being negative, they’re trying to teach you which tools to use to debug yourself
You’re going to have a really hard time if you don’t learn that asap
lol if i felt it was negative, it was to me, i understand theyr game dev tools 💀
Ok, learn break points so you can follow the execution path of your game and figure out what is failing and why
That. Is how you will thrive.
Like cold summer said a few hundred times 😀
If the issue is the widget not executing the function, I don't even see it get called anywhere.
Hi, when there is a button still green, when click other button it makes the button red instead of green. How to make boolean keep true instead of false when click other buttons ?
I see set player color is being called somewhere , but don't know what that's got to do with the widget unless you showed what the func do
i added breakpoints in the widget, nothing happened
Is it one border for all buttons?
K so you never call the functiob
Show where you call the function that you break point
Move the breakpoint further up to the line until you find the part that does fire. In this case I would put it on ChangeColor to start
i had them further nothing broke
So where do you call change color? Show
At the top
ive sent all the screenshots i have lol scroll up
Using those on value changed binds
Put the breakpoints on these points - add a print string on to cast failed to have something to attach the breakpoint to.
She said ChangeColor never breaks afaik
nothing i tried broke
If that’s true then neither of the onvalue changed binds are firing
Did you move the sliders?
Change color is called when a slider is moved
Based on your code
What causes the "Object Name In Table" to be included here? I'm trying to replicate this in another project
Wait it does print?
it prints off the failed
Did you add one after the screenshots?
R u looking at different blueprint?
its in the screenshot i sent..... just pulled away from the other nodes, bc here u said add a print
Ok, so your print works but your breakpoint never stops execution ?
yea
Show latest screen shoot with the break point and print string
Ok, try this out.... Drag off from the "Get Player Character 0" and plug it into the in string and tell us what prints.
On a side note, if your breakpoints aren’t firing but the print is, save everything, restart Unreal
nothing when i do this
Datura already explained to you what casting does and under what condition it will fail.
and i already showed that thats not my issue afaik
So player character is None
Were you getting "dsfsdffsdf" before?
the player is set to be third person character tho
Well that's the issue if it print none
since i added it yea
Player character is null at the time of accessing
Yea I'd restart too at this point.
Null will print nothing btw
i did already lol 😭
why is my player null then 💀
Ok... Are you actually possessing a character at the time you're doing this customization?
im using my player character
Are you certain that a character is spawned and is possessed by the player?
ok i completely restarted my pc, now its breaking at
Ah we’re back in action!
unreal just being dumb and me not being much smarter isnt helping 😭
That's good.
UE be doing that sometimes
Still need to figure out why player char is nullptr tho
Up near where the play button is, you should be able to click the green button and it'll jump to the next breakpoint.
the cast and set player color also break when i move through to the next node
Ok perfect 😄
So then the widget is working as expected.
Did the color change on your character?
no, it broke
It hit a breakpoint you mean, yes?
yea
it loops back
from all the nodes? or just the other 2
All
We've determined the widget is working now, your character is being retrieved and the set player color node is being called on the character.
the sliders move, the color dosnt change
Ok, so now if you double click on the "set player color" node, you can breakpoint some parts within there, see where it stops.
hit one as soon as i hit play
I wasn't here, but Kira's entire problem earlier was that from a widget they couldn't access "Get player character", it just returned nothing
so together we tried making a "middleman" sort of function in their gameInstance, but even in that function the "Get player character" couldn't be accessed. Even though they say they use it elsewhere in the logic and it works fine
and I have no clue why you wouldn't be able to access Player character from the game instance
Well, restarting pc seemed to fix it
wait it works now?
Yeah
no 💀
It stopped returning null after restart
some of it yea
The player char works
oh
so just do the thing we did earlier Kira
put the player character cast at the end of the widget logic
and call that function with that final color input
Ok, so this at least confirms that the set player color node is indeed being called on your character. Your cast is no longer failing. Now you'll need to determine at what point things stop working. What does the rest of the Set Player Color function look like?
unrelated, all my ui is on screen now 😭 ig ill fix that later
nope, player is still black
when youre moving the sliders?
and did you remove that one node where youre setting the character black?
no cahnge when i move the slider, when i then load into the game the player is all black
Btw, idk what exactly that Milo Color variable is, but you usually need to do something else to change mat colors
we did that already though
the function looks solid
Did what
I didn’t see the whole function
lol its not working 💀
I feel like it's gonna be something stupid like you forgot the color set to black on event tick or something
That doesn’t look right to me
I mean I don’t do it that way. 😅
i have no idea 😭
let's do a little test
disconnect that orange line on parameter value
right click the parameter value and split it
Converting 2D texture to a vector 3D or what is that doing exactly
and write in all 1s
then run the game, move a slider and see if the character is white
it's a linear color
Ah
Nah its a LinearColor to a Vector materials use vectors for the params.
nothing changed
10 bucks says param name issue
yea
its not we checked already
Should’ve taken that action then 😀
Yeah good question. Could be getting overridden
i did
What color would 1,1,1 return
it's gonna be something really stupid that we can't see
white
Ok
Do this
Breakpoint on that set param node
When it drops, hover over the mesh pin
It’s a long shot tho
and over the orange parameter value
But also pls share latest screenshot
aye if it’s not disconnected now
yeah connect it back as it was
what am i looking for lol, it hit it when i moved the slider
well, that's good
which ones 😭
we told you
the mesh and the param value
light blue and orange
i looked at them lol
and?
Are you absolutely certain the character’s material is set to your MaterialInstance and not the regular Material or something else
what am i looking for 😭
yes
Type the words/values you see there in this chat 😀
mm this is very tense
oh a video
hm those look fine
but uh
now that I've seen this, I have a different question
that mouse on that video - is that THE actual player character?
no
did you just drag an animation there
its an animation the player has
because youre not setting the color on beginplay on the character after the level loads
you're just changing a variable in a different level but then not passing it to the character when it actually starts to exist
i had a node for that, but u said to delete it 😭
but you had BLACK as input there
you need to have the variable there as input
the one that you've been setting through the widget this entire time
but the variable is in the widget how am i doing that, casting?
i didn't realize you're trying to do this in a completely different level without the character even existing
oh
okay
but you're trying to pass variables between levels
use gameInstance for this
I like the mouse
make a "PlayerColor" linear color variable in your GameInstance
in the widget, when moving the sliders, change this variable instead
then on BeginPlay of your player character, run that function and plug in the variable from the gameInstance
because GameInstance doesn't get reset when changing levels
cast to get game instance then?
yes
yea
now you need to set that PlayerColor variable (the one from GameInstance) at the end of that slider widget logic
Btw @zinc jasper I use create dynamic mat instance myself
here?
yeah but that's an extra step you don't always need
this is just a single node and it works on everything that has a mat instance applied on it
I also used to use what you said but I migrated to this, it's way easier :D
Yea, not always necessary - only really need to if you're using a material across multiple meshes and want them to be different.
no need to create a dynamic instance when it's already created basically
Good to know
no
I only used those param nodes for Niagara so far
here
replace the whole end after the set brush tint color with a cast to game instance and set that variable
to the Final Color value
this?
yeah but actually connect the node :D
shit yea
now this is not gonna change the color of the animated character in the menu, but try to change the sliders around, and then play the actual game with the character
see if the color updated
yea its updating now
yay
🥳
and to change the menu character, you have to get a reference to its mesh
then you can run the same material parameter change thing on it and change its color as well
ty for helping glad its finally cooperating 😭
lemme try
Damn took 2 hours
see the entire problem was that you were doing the setups in one level and expecting the result in another level, and we didn't have this information
so we could've just been guessing forever
that's why exact information when getting help is crucial
the video helped in the end
apologies i thought it was a given 😭 mb
How to set the other button green while previous is still green?
seems like when you're pressing any of those buttons, you're checking if any of them is green, and if it is, just make them red, making you click twice, yes?
why so small
but I mean just set the button green after that check anyway
that's all
not sure where the issue would be
ok i cant figure this part out lol, its using the same mesh as the player character
get a reference to it
and just apply the same logic to it
at the end of the slider widget logic
that's all
but if its using the same mesh how do i get a second reference
the animation in the menu is just an animation for the player, they share the same mesh
so?
how do i get a different reference for the animation than the player
um
it's a completely different object
how would you NOT get a different reference?
idk 😭
forget about the mesh and the player character
find out how to get a reference to that animation mesh
how am i getting a reference to the animation?
the one you placed in your menu level
that's the correct question
is it an actor?
or did you just drag an animation into the level
just dragged it in
okay maybe make it into an actual BP actor
have the animated mesh as a component there
ok
although... why not just use the player character itself
you can have it play animations
idk, i only had it there as a placeholder 😭
didnt get that far yet
if you use the player character itself, then you don't have to worry about getting a reference to some random dragged in animation asset
and you can just reuse the function you already made
the one that sets the player color
Like most problems we encounter lol
this would be a 10 min job if we knew they were changing levels between the functions 😄
Yeah but the first 110mins is usually spent identifying the root cause 😆
But my bool keep set to false, I want the bool keep true whenever I click the other red button. So it only set false if I click the green button again.
why not just set all to red first when any of them is clicked, and then set the one you clicked to green immediately after?
that seems easier to me than using a loop for this :D
it's basically what I'm doing here lol
to switch between three widget cards with different settings
I would totally make a generic button widget that store its state internally
That way you don't need soo much copy paste for every button
I mean I only have 3 and this menu is still a very much work in progress, very early state
I have a lot of buttons that can be toggle on and off
but my point was that just setting all to off and then immediately the one you just clicked to on is probably easier than looping or whatever
To set everything off, I just get all the button in the child, loop thru them and turn it off
you could just get the container where they're in and get all children
Yea container
yeah :D
exactly
but you don't need a complicated loop checking every single one if it's supposed to be on or off
If the menu is simple then maybe not necessary to make a generic widget
But my rpg will have toggleable buttons everywhre
In the inventory, in the menu, in the settings
yeah, shouldn't be hard to just put all that are mutually exlusive into their own containers (or array variables perhaps)
and then just turn all of them at the same time, then turn one back on
Anyone knows how can I get the angle between my Actor Forward Vector and the "0,0,0" location on the map ?
I mean if I'm parallel to the "0,0,0" it should return "0" but if I'm upward it should return "30" for example
The "Y" angle (pitch)
why "actor forward vector" though?
do you mean just the angle ABC, where A = actor location, B = 0,0,0 world, and C = actor location projected on Z=0 world?
It works but, when I want to click the green button again it wont come red
Yes
that has nothing to do with actor forward vector though
that's what confused me
then before the logic, do a check if you press a button - if it's already green, just turn it red, and do nothing else
if it's red when clicked, just run the existing logic you already have now
I will explain better : I'm trying to "force" the World Rotation of my Actor to "50" with the use of "Rotator from Axis and Angle" and "Set Actor Rotation" nodes.
The problem is : If my Actor is upward a little bit, it never reaches the "50" degrees angle that I want.
And if I set "50" in the "Y (Pitch)" value of the "Set Actor Rotation" node, my Actor is rotating on X and Y
The goal is : When I press "A", I want my Actor to rotate downward until 50 degrees
In the Y axis
oh I think I understand
can't you utilize relative location of a component of that actor somehow?
I don't understand why my Actor is rotating on Pitch and Roll at the same time when I set "50" on the "Set Actor Rotation" node on "Y"
I guess I can
I actually had a problem similar to this.. I think.. if I understand correctly. Imagine you have a tall stick standing vertically and you nudge that stick at its top to any direction. Now the stick is tilted into some direction, and you want to calculate the stick to continue falling down into the same direction
I kept having issues with it rotating weirdly on other axes as well
so I just postponed the issue 😄
So I'm not the only one with that weird behavior lol
And to "resolve" this issue, I had to use the "Rotation from Axis and Angle" node and use the "Actor Right Vector"
But I need to set an "Angle" in that node, so.. I need to calculate my Angle before doing this operation
So I can change the value on the "Rotation from Axis and Angle" node
this vector math is not intuitive for me so it's a bit hard for me. But maybe a little dirty workaround could be making a SceneComponent in the actor, then rotating the scene component to face where you want, then parenting the rest of the actor components to it and then just tilt forward with relative rotation
Based on that previous angle
But I need my Capsule Component to be the root of this Actor..
So I can't add a Scene Component in my Blueprint and parent the rest to it
aaah it's a character
Yes sorry
what exactly are you trying to tilt on pitch though?
cause I don't think you can do that to a player character with a capsule
I'm just trying to make something simple :
When I press "E" my character should rotate upward on the Y Axis with a maximum of 50 degrees.
And when I release "E" it should rotate downward on the Y Axis as well with a maximum of -50 degrees
(World rotation)
by rotate upward, you mean the entire capsule should tilt/pitch up?
Yes exactly
and you're using the default player character with the default capsule?
Yes
How ? It seems to be a simple rotation that I want
because the default player character is a pre-coded thing that has its limitations
one of them being you can't change the pitch of the capsule
you can change the pitch of the camera but not the capsule
that's basically hard-coded
you'd have to use a custom player pawn for this
or you can tilt the character model/mesh inside the capsule if you want, but not the capsule itself
So that's why when I'm trying to change the Pitch to 50 it rotates with the Roll too, right ?
idk
So the Player Class is meant to be rotated on the Z axis only ?
capsule should only be rotated in yaw
anything else might give weird results or not work
I don't understand the logic behind this but well..
Thanks ! I will try to find another way !
you can open the c++ code of the premade player character movement
if you wan't to understand it
:D
it's just how it works
I just don't understand why they did this
if you need some special/extended functionality, you have to make your own or edit the code of this one
because of just how it works and calculates stuff and interacts with the world and physics
Ok I guess I should go for it
it's what they decided
🤷♂️
you can rotate the camera and the mesh inside the player character
just not the capsule
(except on Z)
Yes but if I rotate the Mesh and not the whole Actor, my "Forward Actor" will not change
I will think about it.. thank you very much for the explanation !
i mean with this default player character you shouldn't even be rotating the actor at all
since its using different nodes for input
But I wanted to use the Character class to use the "Character Movement" component
For fly; walk; swim etc..
To make it easier to use
well, yeah, that's fine
but you have to obey the limitations
and use the proper nodes for it
Hmmm ok.. I understand
I will try to find a workaround for this rotation case with this setup
Or maybe I can use the "Add Local Rotation" node ?
what are you trying to do though?
like I said you can't do that to a capsule
only to a camera or mesh
I already made it for the X and Z axis. Only the Y is giving me problems x)
I'm trying to make an airplane
okay nvm I guess I'm stupid
but I think this is not gonna behave like it should lmao
Yes the only problem with the Y axis is that it makes the X axis rotating with it
I think that even if you somehow figured this out, it's not gonna behave nicely
I don't think the capsule is meant to do that
It sounds like Gimbal Lock
The quaternions is your solution
So why it works with the X axis. It shouldn't work.. it should work only with the Z axis if I understand correctly
I will investigate on that. Thanks !
If you ask in #game-math they probably have idea.
Ok thank you !
I'm trying to make a repair system that costs more based on the durability left on the item. The clsoest I can get is going in the wrong direction. I have it as (durability/maxD)*itemPrice which gets me the exact numbers I want, just backwards, Is there a way to get it to go the right way in a simple format like that, or do I need to deep dive into math again for this? Kinda just looking for some advice and tips
I've already done ([maxD/durability]-1)*itemPrice which got it in the right direction until the item hit 50% durability, then it capped out with the clamp I have set
(1 - (durability/maxD)) * itemPrice
If you have an item that is worth 100G, and item max durability is 100, with durability at 100, the repair price would be 0G. (1 - (1)) * 100 = 0.
If that same item was at 50 durability, then the price would be 50G. (1 - (0.5)) * 100 = 50.
If that same item was at 25 durability, then the price would be 75G. (1 - (0.25)) * 100 = 75.
Thanks a ton for that. I've been racking my head on how to do this and all I could think of it wanting to flip the percentage somehow. You saved me a migrane
You were close 🙂
Hello guys. How would you implement a dodge skill? I just want the character to move sideways.
I've successfully made it by changing the velocity in the character movement component, but the friction from the character movement makes it slide just a bit and stop.
On a reasonable velocity it barely moves, on an absurd value the movement works but if the character happens to be slightly off the ground it gets yeeted into space, so its not reliable.
Thoughts?
How about using root motion with montage?
while browsing the unreal forums i came across this struct bug
This can randomly happen on compile, the variable using the structure will vanish in the Variables list, in the graph it will show up as greyed out/ not found. The error will say the variable has an invalid type. The most annoying thing about it that all links in blueprint to any structure inside that structure will be deleted, like where Break,...
is it still a thing in 5.3 or is it fixed?
first time im hearing of this as a newbie
whats the best way to not fall victim to this? other than version control obviously
Declare the struct in cpp
There are many errors associated with bp struct, some of them even corrupt silently
Tldr avoid bp struct
yeah this is scary stuff lol
And consider your self lucky for finding the bug earlier
haha yeah
so do you personally use structs declared in cpp or some other data type that can do the same job as a struct? I was using structs for my card game where i held the card info: enum of card name and an integer for card strength
I've never used those. I'll look into that, thank you so much for your reply!
I used struct declared in cpp. You don't even know programming, you can make a bp struct for template. On the bp srruct asset, right click and click preview header.
Create a file in your source folder, paste the code.
Compile. Done
ok thanks
Hey all, does anyone know what causes this error? If I switch the class of the Spawn Actor from Class node to Actor, then back to the actual class I'm trying to spawn, it works for that editor session. The moment I reopen it, same error as in the screenshot.
I've tried refreshing nodes, refreshing all blueprints, compiling from source, deleting and replacing the node, deleting and replacing the function. Not a clue why the node errors.
it's probably one of the variables you exposed on that actor
could also be bp corruption if you've got Hot Reload enabled
hello, is it possible to convert a struct to json in blueprint?
I think there’s some plugins
Hi, So I have 1 Event dispatcher from button 1. But what If I want other 3 buttons have the same event as button 1. Do I need to make manually again so I have 3 event and connect it to the first one? Or there is other way to do it?
@wispy kayak event dispatcher is a multicast delegate. Meaning it can be binded to multiple objects.
When the event gets broadcasted it will fire on everything that listen to it.
You don't need to make multiple events as long they have matching signature.
You just need to bind it
Yes! A plugin called JSONTools or something like it is built-in.
It can be fed arbitrary struct and read it back, I'm pretty sure.
(you just have to activate the plugin)
Works like this
And then readback
Hi! I'm making a Wave-Editor, for this I'm using an editor utility blueprint's Slider to spawn and delete BP's in the level
I really liked how in this older example of the code you could see the BPs spawn and despawn as you scrolled through each wave
But that broke
It's still spawning and despawning the BPs as you scroll through the Waves, but now it only visually updates the level after you finish scrolling to a specific wave
Here's a video of the old version:
But here's how it looks now:
I didn't catch it when it stopped updating while you were scrolling through it, so I don't know if any of my code adjustments caused it.
But does anyone know what has any suggestions for what could fix this? Any help is deeply appreciated!
(Whoops sorry for flooding the channel! Thought the video's would be useful in illustrating the issue but they really take up a lot of space 😅 )
Hi, so I have problem when I reopen the menu again and clear the children, the button switch opacity not working but the rest code is working fine. If I dont clear the children the new child button for switch opacity is working but the old one child is not working.
that's because what ever responsible to trigger them only use the reference to the new instance
what you want to do here, is when you clear the children you need to make sure to set the state as it was before the children get populated
go through the references too
I'm doing a line trace on a custom actor of mine but it is failing, even though I see visually the debug line going through my actor. The actor has a scene component C1, C1 has a child scene component C2, and C2 has a child dynamic mesh component C3. C3 is where the trace should happen, and C3 has collision enabled, complex as simple, BlockAll preset. In the BP, I've tried with and without Trace Complex, with and without Ignore Self (this BP is not the actor that I want to hit anyway)
did you check the collision in the object viewer or in the level? Are you sure C3 has collision data?
if it doesn't have collision, you can add it in the static mesh view
it's a dynamic mesh not a static mesh, and it doesn't have simple collision data (if I add it it works), but my goal is to trace against the mesh triangles (complex collision)
Same code/mesh works (line trace hits) on 5.4 but fails on 5.5
I am developing a multiplayer game the idea of the game is that there are players and random npcs and when the player touches the NPCs they changes their material color and follow the player around and if two players came in contact the player with highest number of NPCs absorbs the other player NPCs and the NPCs follow that player.
Now what I want is to apply the logic when two players collide the NPCs change their material to the player with the highest number of NPC and follow that player. I've tried many options but the NPCs just end up running the wrong direction, doesn't change their material or they don't follow the player.
Don't use Multicast for stateful entities
AI is Server Only
Get to change the color of a cube and sync with all players first for a start.
I already did that the NPCs change color when they collide with player
your code shows a lack of multiplayer basic
Setting the material can be done via OnRep variable
Multicast have no place here
also the collision happend in every instance of the game, you should only care when the collision happend in Server
so need Switch has Authority on the collision
make no sense for every players (server and client) to tell the AI to move
again, AI is server Only. make sure that code only runs in server
ok thanks i don't fully understand this is my first multiplayer game but i will try to apply what you said
I would suggest to read the pinned material in #multiplayer
If Collision Happend (On Server) -> Server Set Material (Replicated variable) -> Tell AI to move
Client On Rep Material -> Set Component Material to Material
Ok thanks
how to exclude a bone of skeletal mesh from overlap event?
or set the collision preset for a specific bone
my door still is not open and this is the code
Try visualising the line trace
See if that correctly casts
i am novice i only followed the tutorial
Your first problem is the actor has tag is not connected into a branch. The second issue is your branch after the line trace is not connected into return value so it will always do the same thing.
That's not what is causing the issue though
the branch is odd, but it will always execute
Yeah, what I meant.
I’m not sure if the get actor forward vector is the issue
Hence the request to see the line trace
check #ue5-general
also, @lime oar, please don't crosspost your problem into multiple channels
ok
and yes, as Leonhardmaster points out, the second issue is your line trace is not set up correctly.
i tried to fix but i don´t know if it´s correct
you want to be getting the forward vector (of the follow camera)
if that second point is at 1, it's good
and i want to make a popup with a message of "Interact"
but i couldn´t find the interaction interface message
where i connect this new branch?
the new branch is connected in actor with tag
is this correct?
what should i do now?
@thin panther
You're trying to check a tag when the hit hasn't been successful
The first branch should be checking the boolean on the line trace
like this?
@thin panther
You still need to keep the hit actor plugged into the cast
Great beginner/intermediate tutorial explaining how to Line Trace: https://www.youtube.com/watch?v=XBhgzQ7hStA&ab_channel=UnrealDevHub
Learn how to use LINE TRACE in your games! Line Trace has many uses, and here we will demonstrate how to implement it in your game to register an overlap on your character.
Want to learn how to build games in UE5?! Subscribe to Unreal Dev Hub for more UE5 Tutorials!
Want to support my channel and help me continue to create educational content...
like this?
the door still it´s not open
the door doesn´t open for nothing
@thin panther
You're gonna need to show all of the code
You still havent fixed the other issue, that being the line trace
You need to get the forward vector of the camera
where do i connect the forward vector?
I reccomend watching Michael Pattison's series on UE5 interaction. It's a lot more comprehensive than other's
Unreal being really weird, i never even do any modification that's related to VR and then suddenly i got this error. wtf? This is so random. Can i just delete this? will it affect anything going forward?
Now i cant move diagonal. This is so random
It was ok everything prior and then suddnely its like this?
Are there any tools/plugins that make debugging blueprints better? It's really annoying how often you get this when there are very obviously the information available.
Is there a good way to make fast mesh booleans at runtime? I'm trying to do it for multiplayer. Basically, I want to replicate the destruction physics of DRG, which are definitely not voxels because they would have to be insanely small. It's procedural mesh generation.
This my series ACuppaTea was referring too. It goes over how to create a more scalable interaction system. It won't be perfect for every scenario but can be a great start. Once you've completed it, I even have a series where I show how to make different type of doors.
https://youtube.com/playlist?list=PLcwVLBaUNnHra8G8ZBUkzPNu7qDM9OmZe&si=I9S_YHO99-PHt1Y1
I think people have done that with geometry scripting. I def wouldn’t do it in bp for a multiplayer game tho
You can use a custom collision channel that's set to block by default. You can then just turn it off for door so they won't stop the trace.
i need thess interact interface but it´s not showing in my blueprint
That normally means it's out of scope and hasn't been calculated. Calculations are dumped when the tick ends so unless it's a value stored in a variable that persists there won't be anything to display.
i am watching one of your videos right now
Sorry, i meant to say custom collision channel that the line trace can use. (like the ones used for visibility and camera)
I guess you could but it would probally be more effort than it's worth. It's quicker to just make a new one in the project settings, set it to block by default and then on mesh you don't want it to block (as in not be an obstacle for the line trace) set it to ignore)
You need to first follow the interaction system tutorial. The system used to interact with the doors is setup in those.
ok
I have done that in single-player and it's still horrendous
In terms of perf or what? And I’d do that in cpp anyways
That stuff is intensive af, you want it to be as fast as it can
Performance wise
It's quite easy to make, also with collision, but the performance is still bad
Yeah, messing with geometry at runtime like that is expensive either way. Best you can do is optimize it and make it fast (via cpp)
Still geometry script or procedural mesh component?
Geo script. Idk about proc mesh comp for this, haven’t tried it or heard of it being used that way
But GeoScript, even in C++, still isn't fast enough for multiplayer?
When you create a custom channel it’ll ask you what you want it to do by default so you might not need to manually update each
Eh… it could be but that’s something you should ask in #multiplayer . Replication and everything else comes into play
How is it in your project? Does it work well or when does it start to lag?
I haven’t done it myself, only saw people talking about it at one point or another
can anyone help me with this issue. im using the third person template on the unskinned one and have it so when i grab the ledge the character turns to the lege and grabs it. but id like to use the first person template camera like on the skinned version but when the character turns to the ledge the camera dont rotate that direction with the character. im pretty new at all this and any help would be amazing
Look for use controller rotation settings on the character’s details panel. There should be one for the pawn (camera).
This is during a breakpoint though.
For example, if you have a structure that is broken, and that structure contains an array, you put that array into a for each loop and pull "set" the variable coming out of the array.
The break will have "no debug data", the array will have "no debug data" and the variable will have "no debug data". The only place you can "see" the data is if you mouse over the actual structure.
If you do the same thing in C++, you can watch all of the values and they'll persist.
Unless I'm just insane, I haven't had coffee yet 😂
Thats exactly what i needed am i able to toggle that on and off so when i grab the ledge it turns it off
Yep
Just grab the camera from the left panel, drag into the graph, right click search for the setting
sweet found it thanks wasted so much time trying to rotate the camera its self lol
Hi everyone i'm using the fps template and I'm running into an issue where my bullets do not collide due to their spawning point being inside of the mesh that I wish to hit, is there a known fix for this problem? In the linked video you can see how the objects respond find untill I get too close, at that point the couch will no longer move around when being shot. https://streamable.com/1usywe?src=player-page-share
The bullet leaves from a socket at the end of the barrel to the center of the screen
Your gun is sticking inside the couch what do yo expect. You can make your capsule wider is one way to solve this as the gun is colliding too soon or make the bullet spawn point backwards.
What do you mean with make the bullet spawn point backwards
Moving the socket backwards in the skeleton editor.. otherwise the better way is to increase player capsule radius because this will also solve for any other weapons and also fix the gun sticking inside the couch. This is because the capsule is too narrow for the gun.
thank you
The capsule is set as the root for the player so that makes everything else scale with it
could you explain why this would work
The capsule radius shoudn't scale anything, this is a separate setting in the capsule component. Just increase that till the gun is not sticking in the couch.
mb, forgot about it being a property
It's a bit wonkey bit it works so thanks
does removing a widget clear it's dispatcher bindings? I would assume so, but idk, and I am rly hoping it does haha
No, the binding are still bound unless explicitly unbound or the widget is destroyed. For a widget to be destoryed (garbage collected) it has to be in no slate container (remove it from it's parent) and not be referenced anywhere.
yea with what I have setup it is completely gone. It's like a mini game thing, everything is contained in a game widget.
Just be aware that garbage collection can vary in terms of when it runs. It could be every couple of seconds or after 10 minutes.
its like this, and there is about to be a shit ton more lol, and end game removes the current game then this game. I mean yea I could just reparent all of them to a base class that has the dispatcher in it, but I have a significant amount of mini games
I'm having an issue with some functions I use to interpolate between values not being framerate independent. I wanted to avoid having a lot of logic rely on Event Tick, so I have many functions similar to the image attached that use SetTimerByFunction name to repeatedly call interpolation until the target value is reached (I use this for floats, transforms, rotation etc in many places in my game). I figured because the interp node uses GetWorldDeltaSeconds that this would be framerate independent, but it is not, leading to some gameplay problems at higher framerates. Can anybody explain why this isn't framerate independent, and what I could do to adjust these functions to make them independent? I'd still like to avoid moving all this logic into EventTick if possible.
When you go to remove the widget, just call the 'Unbind All' on the relevant event dispatcher.
Simply put it's because it's not running on tick. Instead of the timer by event, use timer by event for next tick.
Alternatively, you can cache delta time and keep adding it each tick until it gets uses by the function. This would need to be done on tick.
oh yea lmao, I was thinking of needing the reference to the actual dispatcher in the bp lol, and reparenting everything was going to probably 100% break some stuff
Does anyone have any documentation or guides on how to make a preset slider for graphics settings and have it to be modular? Something like the picture:
I have a widget for the arrow that has the hover and click events in it and I use an event dispatcher for the onClick to call it somewhere else.
I have a widget for the slot itself which is just an image with a bottom anchored border, and the setting widget itself with a text block overlayed over it.
I want to make a system where I can set how many slots spawn, and use an array of sorts to set the text based what slot you are on. Is that feasable?
wow idk how I didn't think of using SetTimerForNextTick. Do you think it will be as simple as just replacing SetTimerByFunctionName with that node?
Yea, it's technically still tick but when it's finished it's done. So it's like a temporary tick lol.
thank you so much for your help!
something that has been intriguing me.
Does a Static Mesh affects performance if it is not on Screen???
I know that HISM only if it is on screen
kinda noob question though.
Yes, they can still affect performance but due to frustum culling it's not usually as much.
So its fine to have 200.000 static meshes in my game as long as only 10 are on screen?
That would depend as they would still take up memory, just not processed by the GPU. Why would you have that many but only 10 shown?
what's the best way to smoothly move one static mesh to another (on tick)?
use a vinterpto
in like a 2d game, you see stuff from the sky. so you dont see all the objects
so i was thinking if it is worth it to make it an HISM
because no more than like 50 will be seen anyways
I mean a bird's-eye view usually means seeing quite a lot
yes but like 50 is still very few, right?
its a tile game too
depends on mesh complexity but yeah
but pattym's question is still valid
better to spawn things as needed than just have them all sitting in memory
so you start a map and your camera from the top. enemies are cubes
you would load them as they are needed?
but they are moving around even though they are not on screen
for stuff that doesn't need to move, I would just store their locations and spawn them as needed. For enemy AI, it's a bit different, I think level streaming is the way to go but realistically you need to build, test, optimize in that order
Hello, anyone experienced in EQS, I'm having issues trying to get AI to see player at height. So I use a pathing grid, which generates around context. And in this context I want to return grid around querier, BUT at player's current height. Is that doable, or is there another way to approach this? Because as it is, if my AI is below player, it doesn't see it
I really need some help. I am trying to make my crafting able to use any items in chest around the player. Find and calculating them is easy but for some reason removing them just dont work https://blueprintue.com/blueprint/i3idkyc1/ this is my blueprint
How do i multiply this Byte that comes from a color
i need to work on this color. darken it kind of
Convert byte to int, then multiply by float?
yeah just got it now
thanks
kinda messy though
so much spagetti for just simple oparation
is there a way to get " Game mode UI only "?
What do you mean?
You can set the input mode as UI only
I shudder to think why you have that screenshot ready 😄
lol i only ever saw the "game mode only/ game mode and ui only"
thanks x)
i just googled it this minute lol
just copied the first image i saw that had only the node in focus
@thin panther hm that locks out keyboard inputs also, any way to allow those ?, or do i have to override in the specific widget for those ?
oh
game and ui means ui takes precedence, but both receive, and game only means... game only :P
So, I made this linetrace system for my shooter, the problem is that it doesnt hit the actors for some reason
Any idea why?
are those objects blocking the collision channel you're tracing against?
and do they have collision?
They have a collision yes
hmm i have input on my character "B" which shows the widget, but it runs the "B" event on the widget at the same time how come it recieves inputs before its visible ? (its colapsed by default)
I dont think so
How can i check that?
look in the objects in the world. Make sure in their collision profile, they have visibility set to block
so i have another issue where when i set the controller rotation Yaw to off it breaks my look up and down and i can no longer look up or down even if i set it back to true during game play like when i leave the ledge and toggle the Yaw rotation back on
how do i add my own comment bubble like this?
Hover over the node with the mouse button til the small ... appears at the top left of the node, click it and the comment box will appear.
oooh. thanks!
thats rly tiny
lol
Yeah it is and it doesn't appear straight away. Takes a second to appear.
this is good to know. i hate having to make big comment boxes for a single node
thisll make it cleaner

I have a component that I'm adding during the game to my character blueprint. Because players can reconnect (and lose all knowledge of components getting added to a character blueprint) I need to add them client side to my characters when they do have it, when a player logs in the server. Any guess on how I could make that happen?
This seems rather convoluted. I'd break it up into smaller pieces and functions. In my examples here, it's assuming that everything is using a common inventory component, and you'd just need to input an array of inventory components to search through.
https://blueprintue.com/blueprint/s0qlpsif/
https://blueprintue.com/blueprint/qgkrs_5n/
https://blueprintue.com/blueprint/t5l_28mr/
https://blueprintue.com/blueprint/e62484qo/
This is untested, but I'm fairly certain it would work.
What is this component for?
Basically it's a weapon
Thank you Ill try it out