#blueprint
1 messages · Page 198 of 1
So I have a widget i use to display data from a power generator. This widget is created from the power generator actor. When it's been created, I then call a function on the widget to pass data to it. In this case, the power generator itself.
(I'm not sure how useful these screenshots will be)
yeah I get it but it feels a bit different with widgets
that's in BP_PizzaPrep
so when I create the widget from this class it's not (?) passed to WBP_PizzaBakingWidget
therefore I need to set BP_PizzaPrep manually somehow
so I do this
My example was with a widget. 😉
now I feel even dumber 😦
The initialize function is what I call on the widget from the place that spawns it so it knows it's been given the data it needs to update and do it's thing. (Updating a lot of sliders)
when casting, what is the input object
I still need to get an actor instance from a scene to plug in there
Add a function to your widget for setting the prep ref and call it here on the widget.
To be fair you could probally just expose it on spawn and it'll show up on the create widget node.
expose it on spawn - the BP_PizzaPrep variable in both of the widgets?
My guy
We’ve told you this in a few ways now
It’s not cast -> then find ref
A cast checks if the object you fed it is the right one
hey
so i have an interface with two functions but i cant for the love of god figure out why its saying implement event not function
pls need help
if it's yellow its and event. If you want it to be a function, you can add a return value. If its a constant function you can make it constant in the interface which will do the same.
so i need to add a return value in the interface ?
yeah
I think you can also convert events to functions in the right click menu on the event node
thnax a lot dude
Try implementing the event and see if you can convert it
This works for non interface functions, and it will only work sometimes for interface functions, but it won't give the option unless you do some trickery first.
i tried it said error
ill try what the guy told me first and see
Good to know it's not that straight forward with interface
even when i added a return node still the same probleme
make sure to compile the interface, and you may need to compile the blueprint that implemented it.
Oh, I meant to add a output pin.
I usually just add a return bool that represents a success.
in my case i need a text but thank u so much
would u belive it took me legit 3 hours
thank u man
I've been there
so annoying thou
I don't know, I still don't get it.
Don't be hard on yourself. Nobody understands how casting works at first. Even the best explanation is often leaving people clueless haha. Once you get it, it will just click
I know.. it's just frustrating. there are times when I feel like I finally got it, then I hit a wall like now and I just don't know. I end up guessing, not understanding, because I run out of ideas. Not the best way to learn.
What do you need a cast for currently?
Honestly I don't even know if I need one
well that's not really helpful 😄
I mean I'm tackling a new thing - UI/widgets, I don't even know if what I'm doing makes any sense and if it'll produce the output I need it to produce. but before that I need to set references properly because I keep getting "accessed none" errors no matter what I come up with
it's a widget within a widget, and both of them need to access an array from an actor the player interacts with when the widget is created
Just for you. 😉
Let's say you wanted to cast to an Actor, if the reference you inserted into the object was a widget, the cast would fail. If the reference you inserted was an actor, pawn, or character, it would succeed
thank you pattym
well BP_PrepStation is an actor
so then I believe your problem with casting is a lack of understanding of child classes
it's a mix of a couple of things. data types are being one of them
if you know the difference between classes, then that's 75% of it right there
a cast will only succeed if whatever you feed into it, fits into the same class or a child class of it
The only thing you could possibly cast to BP_PrepStation is any actor you spawned in that is BP_PrepStation
or a child of it (which I'm assuming you don't have a child of it)
we're probably not getting anywhere, you might just have to continue throwing shit at thewall until it starts to stick
This might help you as I actually talk about hierarchy.
In this informative video, delve into the fundamental concepts of hierarchy, casting, and interfaces within Unreal Engine 5 (UE5).
Unlock the power of organizing actors and objects in hierarchical structures, master the art of casting to interact between different classes and blueprints seamlessly, and explore the versatility of interfaces for ...
:/
thanks though
I'll check it in a sec, just gonna clean up the mess in my widgets before I tab out
Learning how to get a reference to a actor is usually the first big perspective change to this type of thing. Player references is easy, since you can get that in many ways. A random actor in the scene you have to already have a plan on how the reference will be found. The easy solution usually is to either plan on the thing that is spawning the actor to do the reference linking or you could have the actor itself reference something like a game mode, game state, or event the player. If its a small project this is all fine. @tropic peak
Does anyone know how to get input actions to work while editable text box has focus? You would think it would be possible to hit the enter key after typing in a password to continue, but nope.
I'm at the stage where I just want the things to work. I'm not worried about performance or any other things, I'll get to that later.
My personal gateway to casting was when I was told to say it as "treat as" instead of "cast to". You get an actor pointer back from a trace, you tell it to "treat as MyBPCharacter". If it can, then it succeeds. It it fails, it cannot treat that actor as what you wanted.
It just blows my mind how I try to do what people here tell me and I still fail. I did exactly what pattym recorded for me and I still hit the same issue as before
You cannot. EditableTextBox eats all inputs. Amusingly except for modifier releases.
Thats wild
hiii! silly question, why it's the owning player of my uuserwidget bp unknown? why could it be happening?
Thats better than nothing, Thanks I'll try that
Node hasn't run yet. So there's no value in that return until after the IsValid runs it.
even in here stills null idk why
That's before the IsValid has ran. It breaks before execution, go to the next.
If the IsValid fails, it's not finding the component.
oh, I see now. thanks :)
As an FYI, get owning player returns a player controller, not the pawn it controls. I mention that incase your stat stuff is on the character itself.
omg I'm retarded
jashdajsdhajd
I was getting the controller instead of the pawn, now it works. thanks :)
is it possible to use pointers in blueprint? I would like to save pointer variables instead of direct variables
no. object refs are pointers though
And saving a pointer doesn't make much sense
You can't load a memory address from disk
ooh, didn't know that
then that answer is pretty much enough for my case. Thank you!
What do you mean by save?
making non-local variables
bear in mind it won't let you use it for primitive types though. Structs and ints and such can't have pointer vars in bp
Ah that makes more sense
yeah, they don't take much place in RAM actually. I was worrying about huge classes such as character, game mode, game state etc would be heavy if put their variables into multiple places
since they are pointers, it won't be a huge problem
No, they're already pointers behind the scenes
It's all good
It's pretty much impossible to take a uobject or actor by value
It is impossible in bp
Also don't forget that you actually can save pointers in savegame. 😄 Still love that topic.
wait, how does that happen though?
like.. you predict the RAM location or.. what.. 😄
You're C++ familiar?
nope, I just know the basics
Basics work. So...
It only works with editor placed actors. Essentially it serializes them, and then deserializes them into that actor on load.
With C++ you can extend it to any actor, and then you just delete actors that have been removed, and spawn any that couldn't be found
It works with runtime created ones too.
Does it? I don't remember being able to do that in pure bp
Not in pure BP no. You need access to two specific things which is UObject::Serialize and the ability to specify the name of something when creating or spawning it.
so if the build is the same, apparently it allocates the same RAM points
Ah yeah, that's what I'm saying
In C++ you can make it work with any, but in BP you can directly save pointers to editor placed actors and reload them iirc
ooh
No, it just has id systems it matches them to
When you serialize a pointer property, Unreal writes it out as a path of itself and it's outers. Every object in Unreal has an outer. EG Actors are outered to their world, actor components are outered to their actor.
AbilitySystemComponent on MyGunActor in a map named TheReach for example might be like
"TheReach.MyGunActor32.AbilitySystemComponent"
This is also how pointers are networked. They're converted to a name that can be used to look up the object.
to match the actor's new RAM location
This breaks normally because when you've spawned 50 actors of MyGunActor. And destroyed the first 40. You have MyGunActor39 to MyGunActor49 left.
When you restart the map if you spawn ten gun actors you'll have MyGunActor0 to MyGunActor9. Not the same name. However in C++, you can directly specify these names.
So in large if you first make a pass that creates everything with the same name if it doesn't already exist, and then replace all of the data in everything, all of your pointers are restored as well.
that's an interesting matter. I really appreciate you for sharing this
I got it now. I'm a "only blueprint" person for now, but I hope I'll hop into C++ and participate in these adventures even more soon
Thanks to you two, again
It's a really fun leap into the engine. Unlocks so much more potential
@dark drum So this i what I have so far. Where do I go from here to get a drag & drop system and empty slots?
Is there a way to debug widgets? if I have a function attached to a custom event in a widget should I be able to see what that function produces in the designer view or is it going to only work on runtime?
also do I need to have a custom event in a widget blueprint, when I'm not really calling a speciffic blueprint via events but creating it via create widget?
Construct will run after the widget has been added to a parent, like another widget or Viewport.
Preconstruct is ran right before Construct. But it is also ran at design time when values are changed on the widget.
looks like the thing I spent the entire day on doesn't work then
in sound cues, is attenuation the thing that gives it the spatial sound effect?
I have a crazy Input action bug going on. I have a prompt widget with a dynamically loaded button widget inside and those buttons have input actions on them for keyboard and gamepad interaction. Works just fine, until the prompt is deactivated and then recreated. Then the input actions no longer works. The buttons still work, it still has the same focus it had when it was working, the widget reflector is identical to when it was working, but no input actions.
Has anyone seen this before?
I'm guessing its a common UI stack issue, not 100% sure though, or why it only effects the button when the prompt is deactivated and recreated. And only if we are using the buttons added at runtime. Seems to work fine if we hardcode the buttons
Any chance you're using ActionDomains?
I had this with the default Back action using action domains. Code around input actions really breaks down with them at the moment.
I have no idea what ActionDomains are.
Unsure then. When you deactivate said widget, is there still an activated widget in the hierarchy?
by hierarchy, do you mean the common UI widget stack?
Anywhere in the viewport.
You can use this to test
CommonUI.DumpActivatableTree 0 1 0 0
Should send a bunch of stuff to your Output Log window.
using that command I do see an issue, when the prompt is open the second time, the button widget is not activated for some reason. I wonder if that is the cause. Let me try to force activation every time its created to see if that does anything.
That would definitely be the cause then. 😄 CommonUI Input Actions require their owning widget to be activated.
Oh, I'm already activating the widget everytime, wtf
I wonder why thats getting deactivated
Remove the arguments. The 0 1 0 0
I think I have a basic misunderstanding of deactivating and creating common UI widgets
Do the non argument command when it's activated the first time and then do it again once you deactivate and reactivate it. See if there's anything in it's activatable tree that is still deactivated.
If it is within a second activatable widget and that parent isn't activated, this child can't be either.
Working:
Display LogUIActionRouter Dumping ActivatableWidgetTree for LocalPlayer [User 0, ControllerId 0]:
Display LogUIActionRouter ** Active Root **
Display LogUIActionRouter WBP_QuitGamePrompt_C_0: IsActivated? [true]. LayerId=[376]. [0] Normal Bindings.
Display LogUIActionRouter WBP_QuitGamePromptButtons_C_0: IsActivated? [true]. LayerId=[391]. [2] Normal Bindings.
Display LogUIActionRouter -Legacy_DT_PromptInputActions_Confirm_Settings: Owner [ConfirmButton], Mode [Menu], Displayed? [false]
Display LogUIActionRouter -Legacy_DT_PromptInputActions_Return_ControllerOnly: Owner [ReturnButton], Mode [Menu], Displayed? [false]
Display LogUIActionRouter *****************
Display LogUIActionRouter WBP_LegalScreen_C_0: IsActivated? [false]. LayerId=[75]. [0] Normal Bindings.
Display LogUIActionRouter WBP_LoginWidget_C_0: IsActivated? [true]. LayerId=[75]. [4] Normal Bindings.
Display LogUIActionRouter -Legacy_DT_AuthMenusInputActions_OpenSignup_ControllerOnly: Owner [Btn_NewSignup], Mode [Menu], Displayed? [false]
Display LogUIActionRouter -Legacy_DT_AuthMenusInputActions_Quit: Owner [QuitGameButtonMain], Mode [Menu], Displayed? [false]
Display LogUIActionRouter -Legacy_DT_AuthMenusInputActions_Continue: Owner [LoginButton], Mode [Menu], Displayed? [false]
Display LogUIActionRouter -Legacy_DT_AuthMenusInputActions_Back: Owner [BackButton], Mode [Menu], Displayed? [false]
Not working:
Display LogUIActionRouter Dumping ActivatableWidgetTree for LocalPlayer [User 0, ControllerId 0]:
Display LogUIActionRouter ** Active Root **
Display LogUIActionRouter WBP_QuitGamePrompt_C_0: IsActivated? [true]. LayerId=[376]. [0] Normal Bindings.
Display LogUIActionRouter WBP_QuitGamePromptButtons_C_0: IsActivated? [false]. LayerId=[391]. [2] Normal Bindings.
Display LogUIActionRouter -Legacy_DT_PromptInputActions_Confirm_Settings: Owner [ConfirmButton], Mode [Menu], Displayed? [false]
Display LogUIActionRouter -Legacy_DT_PromptInputActions_Return_ControllerOnly: Owner [ReturnButton], Mode [Menu], Displayed? [false]
Display LogUIActionRouter *****************
Display LogUIActionRouter WBP_LegalScreen_C_0: IsActivated? [false]. LayerId=[75]. [0] Normal Bindings.
Display LogUIActionRouter WBP_LoginWidget_C_0: IsActivated? [true]. LayerId=[75]. [4] Normal Bindings.
Display LogUIActionRouter -Legacy_DT_AuthMenusInputActions_OpenSignup_ControllerOnly: Owner [Btn_NewSignup], Mode [Menu], Displayed? [false]
Display LogUIActionRouter -Legacy_DT_AuthMenusInputActions_Quit: Owner [QuitGameButtonMain], Mode [Menu], Displayed? [false]
Display LogUIActionRouter -Legacy_DT_AuthMenusInputActions_Continue: Owner [LoginButton], Mode [Menu], Displayed? [false]
Display LogUIActionRouter -Legacy_DT_AuthMenusInputActions_Back: Owner [BackButton], Mode [Menu], Displayed? [false]
WBP_QuitGamePromptButtons will be your issue then. Something is deactivating it.
So the buttons widget is active the first time its open. Then I close it by calling the deactivate node on the parent widget (prompt window). Then recreate the buttons widget again and re-add it to the parent widget. At the tail end of creating the buttons widget, I activate it everytime.
What's going on?
Calling Set Actor Rotation in the character blueprint = no flicker
Calling Set Actor Rotation in blueprint component = one moment of flicker
Exact same code
Component tick is probably fighting something else with timing. If it's a player character, chances are you should be trying to set control rotation. If it's an AI, you should use SetFocus calls.
I think I see the problem. "Deactivate" just hides the widget. The buttons widget is still in there from the last time the prompt was open
I may geniuneinly just be dumb with how often i get stuck on dumb stuff.. Can anyone tell me why the particle system spawns but not the pawn class BP in this drastically simplified code?
Check NoCollisionFail and see if it spawns.
for added context, the 'spawners' are placed in the world along with the grid that serves as the map in the construction script of my grid generator. and before even trying it i bet thats my solution lol
This is fine. The button stays there. But the issue is that your containing widget is not reactivated.
what I was doing instead, was adding another button widget to the prompt. I was adding a new child to it everytime I opened it, without clearing first
of course it was something else super simple that i just didnt notice. appreciate the assist! but now i fear this leads into actual complicated problems now.
The usual case for this is that you didn't project the AI to the navmesh or tried to spawn it in a place it cannot actually fit.
speaking of navmesh. is it as simple as assigning a navmesh to my spline mesh to make my ai follow the spline to the destination? you may remember helping me set up the spines end point. More importantly than that question, any idea if its possible or how to use the data from my spline to alter the properties of the tiles in my grid that it hovers over or intersects with? As of now Im just placing road tiles on top of my grass tiled grid to represent the path from spawner to center of grid but I'd like for the spline to just affect the tiles thats already in my grid instead of placing a new mesh for the splines
hopefully that was a least a little coherent lol
Making an AI follow a precise path requires implementing a custom path follow component. At least it used to unless something has changed. The best you can do without it is custom nav areas with lower move costs.
I'm not sure I follow with the tile question though?
I want a sequence to play when the character steps into the battle ground
Just some warming up sequence
But thing is when the character steps into that ground the enemies will come to attack
What do i do?
I tried set game paused but that pauses the sequence aswell
SPAGHET.
spaghet where?! thats clean
Better?
Code review approved
It gave me anxiety to move them around like that.
I may have to return to this question with a clearer head lol. But as of now, i generate a grid using the grid execution macro, then I use random floats between 1.0 and -1.0 to generate random heights for the tiles. I proceed to check for the corner tiles of the grid and place my spawners at those corners. The bp for the spawners constructs the splines leading from the corners to the center of the grid. As of now I then add spline meshes to my splines(those stone tiles) but I would like to just use the data from the spline to determine the properties of the tiles from the initial grid. I.E. change the height of the tiles along the splines
Does anyone know how I can make a replicated sprint system? It's not very easy from what I can tell. I've been at it for well over a month since at the slightest trace of ping, spamming sprint will cause the player to jitter all over.
Argh.. it was this "optimization" that I had
If I remove this then there is no flicker when calling Set Actor Rotation on the BPC
Doesn't make sense why Set Actor Rotation is affected though
Hey! This is probably really simple but I'm not sure what to do here. I want this BP_Flashlight to attach to the FollowCamera component on my player character. What do? When I try "get FollowCamera" from BP_ThirdPersonCharacter it says it's not a component of BPThirdPersonChar, so it must have a target
Because if you're setting it in the component tick but the component isn't ticking every frame, and something else is setting it elsewhere, you have frames in between where it can fight for differing rotations.
GetPlayerCharacter->CastToMyPlayerCharacter->GetFollowCamera
What is the best way to get my UI to communicate with my GameInstance? (Instance is listening for UI input)
Not sure I understand the question?
I just want to understand how casting works
GetGameInstance->CastToMyCustomGameInstance->WhateverFunctionYouNeedToCall
Now the only issue is that I'm not sure how to position the flashlight where I want so that it's not blocking the viewport
How do you deal with this kind of errors in widgets? "ToppingIcon" and "ToppingName" are UI components which I can't "set". For some reason it displays just one item from the array too..
Think of it as TreatAs. You have a pointer. Like GetPlayerCharacter. This returns the instance that you're playing as. Lets say you have B_MyPlayerCharacter, which is a direct child of Character.
You have this inheritance tree.
UObject
AActor
APawn
ACharacter
B_MyPlayerCharacter```
You've asked for the player's character, which is a B_MyPlayerCharacter. But the engine doesn't know about B_MyPlayerCharacter, because that is your project class. They had zero way to know what that was when they made the engine so the getter simply returns it as an ACharacter pointer.
Even though it passes if back as ACharacter, it's still a B_MyPlayerCharacter. You simply cast that pointer type from ACharacter to B_MyPlayerCharacter which lets you access B_MyPlayerCharacter functions and properties.
Alternatively you have a differing hierarchy.
UObject
AActor
B_MyCoolWeapon
If you cast GetPlayerCharacter and try to cast it to B_MyCoolWeapon. The cast would fail. This is because the character is a B_MyPlayerCharacter. And your B_MyCoolWeapon does not inherit from B_MyPlayerCharacter in any way and therefor will fail the cast.
Thus it can be much easier to rename the cast node in your head to TreatAs.
EG
GetPlayerCharacter->TreatAs B_MyPlayerCharacter
You're trying to treat the character you're given back as if it was a B_MyPlayerCharacter.
Thank you! you just explained what a thousand youtube tutorials failed to explain in just one minute
You have to understand something to explain it. 🤷♂️ Youtube tutorials generally miss that first part.
Unless you can predictively guess the next word to use to explain it, although this doesn't work very well.
(Damn you LLMs)
Gotta say. As a Mass Effect player. I still can't get over the idea that people call them AI. They're barely even a VI at this point. :/
Yeah they kind of just say "do this, then do this" without explaining why lol
"That's not correct, you're wrong because the stars don't align with jupiter."
"Oh! I'm sorry about my mistake, let me try to rephrase that in a way that is still completely and utterly wrong."
Should my main menu be in a seperate level? So while in the menu the player doesn't have to have the map loaded in?
Depends on what you mean by main menu. Also depends on whether your game has multiplayer.
No multiplayer, main menu will be the UI the player first sees, and where they will choose which save to load in
IMO I would still put it in it's own map. But in singleplayer it isn't necessary. You can show it anywhere as long as you want to.
In multiplayer you need a main menu map because it's how Unreal handle's disconnects and such. Net drivers shut down kicks the player back to the main menu along with doing some other cleanup stuff.
ahh okay
I'll just make another map
Is there a function I can use to evaluate whether a given vector exists within X distance of another given vector?
There should be a distance function for it.
I'm literally a moron
I USED the word
And didn't even think to search Distance
I was messing with Nearly Equal
😄 Alternatively it's just (Vector1 - Vector2) -> Length
Yeah, my brain is stuck in 2D from using IntVector so much for the past 2 weeks
I really regret not just going all vector
I may go back and clean it up still
Guys, does anyone use the smooth sync plugin?
Nope
can souls-like combat be created entirely with bp? I know a bit of cpp, but I'm considering whether to start researching to code more complex parts of the system or to build it entirely with bp from the start
this is probably simple. When the flashlight is attached to FollowCamera, it blocks the viewport. I want to set it backwards on the x axis ever so slightly so that you can't see the flashlight. I tried set world transform and local transform
why not just make it invisible
Will this work? Because I dont think it's supposed to
Can I get a ref to the char that way?
Yes
you could probably also use Get Player Character too
What do you mean by SoulsLike? Haven't played it a ton. Felt bad when I tried.
Perfect. 2nd question, are structures independent to the actor which contains them?
I'm pretty sure they are*, but I wanted to confirm
I do set the visibility to invisible. Is it because of the order in which the code is?
set mesh to be invisible
dodging (and i-frames), parry, stamina, hp, fp (or mana), heavy and light attacks, shield, long range weapons all that
soulslike is basically arpg
@tropic peak isn't that what this does?
i guess also handling modular armor, weapons and all that but that wouldnt be combat
Unsure what you mean by independent? A Struct is just a defined set of data. If you put a struct on your actor, it'll exist on the actor. But you can put the struct on something else too and that thing will have it. Vectors for example are structs.
I mean their values, are their values concurrent across all of the actors which they are implemented in? Or can the values be different in each actor?
Ah. Yeah, similar to Jedi: Fallen Order I suppose. It's easily doable in BP. But having said that I would very strongly encourage you to ignore what people say about GAS being difficult and use it. GAS's abilities and attributes are great for games like this.
They're like any other property. Each instance starts with whatever you set as the deault, and after that can be changed per instance to be different.
Also maybe this is something I don't see, but If it returns False.. Why does it go to True?
also the elden ring wiki has this charts, im new to unreal so idk a lot about blueprints but it ressembles them, are this charts complete enough to make a combo/attack system for a boss?
Make sure the node gets called. Do break point or print string
nice, i havent heard much about gas, i'll look into it
Go to the next break point and check again
yeah it gets called
Post the result
This is the main reason I say GAS. You can easily make things where you set effects that apply tags to a character. EG something as simple as attacking and parrying. Doing a block for example might place a simple blocking effect on the character. But for a short time there will also be a Parry effect with it. Read effect here as buff.
In the attack skill, if you hit a target that has the parry effect and said target is facing the attacker, instead of dealing damage to them, it can trigger an effect which leads to the defender's parry ability triggering. You can sync animations and such between the two skills at this point via playmontage or however you choose to do the animation sync.
You can do all of this yourself. But it's a ton of extra work to build the framework GAS already gives you. And the C++ requirement stops at Attributes for the most part. Which you don't "need" for this, but can be nice.
@sharp totem This post might interest you as a basic simple intro.
#blueprint message
well I feel dumb, it was simple. I needed to also set the visibility for the flashlight child actor component. It's probably not even necessary to have this component, it's just what came with the flashlight asset
Try not to use child actor component they are buggy
yeah I can just delete it
U bought a flash light system from market place ?
Damn that sounds cool, tysm
What do you mean?
Go to the next step when you hit the break point in does save game exist then check the return value again
Oh Yes it does
I need it to be false so it initializes some stuff
It returns true, correct?
Well save file do exist, wat do you want the code to return.
Delete your save file if you don't want your save to exist
Correct
How do I intercept any key events while a widget blueprint is in the viewport?
Red above
I'm just not sure what causes it to exist in the first place
Hi All I have a problem with Boxtrace for My Third Person Character the Boxtrace is weird when character rotates about 20 degree but it looks fine at 0 Degree - 90 - 180 / any help would be nice 😄
False - If the save doesn't already exist, then create it
True - If the save does exist, then load it
My issue - It never returns False
Check your save game folder
anyone see this before ?
Where do I find that?
I got a free flashlight asset pack from marketplace
where is the "Is Variable" setting. I'm tryna enable it but I can't find it. (I'm in a User Widget Blueprint)
send a wider screenshot
You mean this ?
^
i did red mark it on the picture i send you need to create a button first to see it in details
yeah but i'm not trying to limit it to a button, i want it no matter where my moues is, if i press a key I can see the key pressed
is there a way to "Watch this Value" inside a function?
Just print string
They r not reliable, especially when it comes to pure func
Sadge, alright thx
So you want a script that prints the name of the key that you press
how to handle the same input action doing multiple things depending on context?
There's the obvious way of doing some flow control and routing to different functions from the same input event, but that can get a little messy.
Alternatively, one could make several nodes for the same input action event and run a corresponding check on each one, but that also seems bad for readability.
Then, there's input mapping contexts, but I feel like it's a bit overkill to use these for stuff like changing from melee to ranged combat, for example?
sort of, yeah, I just wanna know when the player hits a certain key
Hi Aim im not sure how but there is a event called Any Key that can help 😄
ill try that
Spent 11 hours today rewriting a large portion of my dungeon generator code because I wanted to open a space in the workflow to add and remove more things before placing the tiles. As an added bonus, I now also have a much cleaner looking floor plan.
Can someone please help me understand why for one breakpoint there is a set location for the struct, but on the next breakpoint that value is 0,0,0
is there an easy way to make a tuple in blueprint?
Hey! I've got an interaction system where you can press E to interact with whatever actor you're overlapping, as long as the blueprint interface is implemented. The problem is when I use E to pick up a flashlight and equip it, then I can't interact with anything else. It's like the overlap collision is conflicting with the other objects.
Turn off the flashlight’s collision once it’s picked up
I have the collision coming from a collision box. When I try to turn off the box's collision, it says it's garbage
why would you do it through overlaps rather than line traces?
i couldnt get it to work with line trace
?
Im fairly certain that's what I did, but I'll do that again
id be curious what it prints if it doesnt work
I'll let you know
Okay, why's my sprint system so jittery the second it's exposed to ping? Isn't this how you're supposed to do this?
Am I just stupid? I mean, probably yes, but.. I keep trying to set the name from my actor component to the widget, and it's just not working... any ideas?
it was on the construction event forever, i just changed it to tick to see if that would change anything, and no, it didnt.
Is there a way to preview combo box state changes in the designer? Like, can I test what "on hover" looks like without needing to launch into the game and call the widget?
How you getting main character?
I set a reference to the player blueprint as a variable in the widget bp
Is it set?
yep
Beginplay -> Get owning player pawn -> cast to class -> set main character
there's a hard reference set
ship info is a struct, with the ship name value.. i'm calling the info to set the text on the TXT_ShipName text
Yes
im casting from the widget because I need to access the ship component, which has the ship info struct
that is right. is it always jittery or sometimes? could be the way youre passing the boolean. remember the bool takes however many ms to arrive so its possible to send true then false out of order
i.e. you press the button and release it immediately, the two signals to the server are now racing
If main character Is already that object type you don't need to cast unless it's just a pawn reference
Can you show beginplay?
Construct I mean
Sprinting in multiplayer with blueprint will never work
Your only option is to work with cmc framework
Which is to toggle the bitflag
Cpp only, look up del goodie cmc tutorial
You will never get smooth movement in multiplayer with cmc using blueprint no matter what people tell you or those fake shitty youtube videos
Always if I spam sprint.
How would I go about this?
Del goodie cmc video goes thru everything. Both the theory and the practical
Tldr you can't do it in blueprint
Is there a specific reason to this? Or just that the excess delay causes the outdated information to arrive much sooner than the new sprint information?
Cmc uses bit flag to update proxies states afaik, I don't remember the details but again the video would explain everything you need to know and do.
Alright, thank you.
i removed the tick, and cast and added it to the construct event, and im actually getting something back, but it just the default setting for the component, not the info from the player bp
Show
couldnt you do it through blueprint if you sent a time the key was pressed
Nah it will never work
What would the time do?
Sprinting works for me in bp but I've only tested with 2 players on steam. Probably not with more players
You should test with lag
well i.e. you get stop running signal so you stop, then you get start running signal but the time is before the last signal so you ignore it?
And if you do it on server I wouldn't call it work.
Client prediction is necessary for movement, either you have it or just don't do mp game
Yeah, this is why the issue is coming up in the first place.
Okay where did you set it now? Do everything on construct. You don't want to keep setting on tick. Unless you are passing the var in exposed on spawn
I am, 200-300 latency in and out for everyone as well as 1-2% packet loss.
it's on construct, the reference to the BP is set as a variable, I actually set the variable to the BP reference, instead of a pawn reference. i have nothing on tick. that was just a temp test
Yeah I am referring to the other person whom said his sprint work in multiplayer with bp only
LOL! MY BAD! Same issues, haha.
why wouldnt this work
Yes but where are you filling the value of it?
You can afaik changed the movement to be client authorities but then you won't have any correction
the value of what?
Main character
the value is a hard reference to the BP now, that is the value.
That's not a
How variables work
You don't just select the object type and expect it to have a value
i'm pretty sure that's exactly how that works.. that's how I was abloe to pull the ship component, and the get info from the ship component.
otherwise it wouldn't have known where to get the info from
Are you getting errors?
no it compiles fine, it just doesn't give me my desired answer./
Is main character set?
oh wait..
After you play do you get errors
You getting accused none error i bet
^
yep
He doesnt
Pass w.e you want the data to be pulled from. I'm assuming your player character
I suggest to make your main character instance editable and expose on spawn
Set it in create widget
Hey guys I'm trying to do a combo system, im extrememly new but from what my theory is if you press a button then if you press it twice or more within a few times then play the next animation
Wait I just thought of something
Creating a counter for each time its pressed
you're a natural
that's not sarcasm either
Might want to think about input windows and input buffer too depending on your need
unless you go the other route which is anim notifiers
Gonna be real have no clue what those are I'll look them up
one step at a time
weird.. so when I changed it to the ship info quality, it gsve me: EQuality::NewEnumerator0
just get the counter working to play different animations and then pat yourself on the back for doing it without help
so its not giving me the info..
or.. it's not giving me the name of the enumerator, just the fact that it's enum0
you need to convert the enum to string, there's 2 nodes
one returns that weird string you got, the other returns a human readable version of it
does it do that automatically? I haven't used it much yet lol
Ty for telling me about input buffers bro
It's fantastic
And I appreciate you!
well, figured out the enum issue, but its still picking from the default struct value.
Enhanced inpuit is actually good enough to make a combo system without much code
i really like the Enhanced Input System.
Honestly same I'm gonna do more research into it
Didn't even take minutes I've got a working combo system albieght its only strings
Anyone know how to transition back to move states after an animation is done playing?
Maybe #animation
I implemented this line of code following a yt tutorial to make a rifle that shoots, one problem. i cant figure out how to make it so that it will spam shoot if i hold down the left mouse button. can anyone help?
is there any sort of hold input bp that will repeatedly continue aslong as im holding it down or something?
if you learn how to use the enhanced input system, it's fairly easy to do.
whats that 😭
there's several ways you could go about it though. Probably not the most efficient way, but could use a do n for how many bullets you have in the magazine, and then put a delay for how long you want between shots, and then have a command that resets the node.
hence the not most efficient way. lol
Most Broken way
no its just for this rifle
Timer or delta time is your friend perhaps
i just want it to constantly rrepeat
not the way id ever go about it. i'd just use the enhanced input
okay so how do i go about this
well, enhanced input is a bit more advanced.. best to learn flow code and order of operation first.
is there no simple way outside of enhanced input
Came across an interesting problem, curious if any of you know what's going on here
Both of these events successfully spawn and possess a pawn. However, when I connect the "started" pin, I get "Accessed none trying to read player controller" error. When I add a breakpoint, the player controller is valid. If I do an is valid check, the player controller is valid. The accessed none error seems... erroneous
the error does not occur when I use the "completed" enhanced input pin
i mentioned one very simple way, though not efficient. look into set timer functions, and flow code functions. It's important to understand if you're gonna make blueprints. the enhanced input allows you to set behaviors on input keys without having to specify in the code..
Enhanced input is pretty simple to setup, there should be a number of tutorial available.
Old input system is deprecated, there is no reason to use the inferior system
Enhanced input have triggered pin which get executed every frame. You can use this to check if you have a valid gun, if you do, the gun bp will decide if it can fire or not based on cool down (fire rate)
Fire rate, damage, current ammo, ammo type, etc can live inside the bp_gun
I set it so that theres a boolean when its pressed to set as pressed and then on event tick it checks if its pressed and shoots with a 0.1 delay between each shot (its a rifle)
is that good or do i do ur method
Can you show exactly what you did when you touch triggered pin?
I press the I button on my keyboard
Tick runs every frame, delay not gonna do what you think it does
Nah like show the actual code where you have the accesses none error
Get Editor Property apparently cannot access properties that are within structs in assets.
How do I access such properties?
Breakpoint and is valid check show the player controller is valid, only the output log is saying it's not valid
Where is the is valid check?
Output log is saying you are trying to access nothing at some point
I assume it's internal as clicking the "is valid" in the error log just opens the standard macro
I'm just saying I don't see the is valid check in your code
I believe C++ created structs can have properties manipulated via editor scripting, though you may need to execute python code to do it (as opposed to set editor property node)
i added rhe delay before it sets off the shot, it worked fine. it puts time inbetween each shot without being too noticable
That's because I don't have one. I'll try debugging the possess node in cpp and see if it's coming from in there
I will never do it that way. Also can't tell if it actually work or not. May or may not be noticeable but can't say the behavior is what is to be expected
If you are trying to access null ptr in cpp you will crash right away
This should be coming from your blueprint. Click on the branch in the error log
I already have a bunch of other code in this blueprint that uses Set Editor Property with no isseus. It's only these particular params in a struct that are inaccessible. I would prefer to create my own custom node that is just Set Editor Property, but not crap.
You r not even showing where it throw the error , the error is coming somewhere else where you attempted to do is valid check
If I click branch or is valid in the output log it just opens standard macro
When you click on branch or is valid from the error log, print screen that.
Shouldn't take you to the inside of the macro
You are doing is valid check somewhere on null object
This is precisely what I did for my editor tools (created custom set editor property node, that executes python code). I'm able to use it to modify struct default values just fine
Somewhere in your bp player character
Is the inv input action you posted in playercontroller
Wait... if you were able to do this, then why does the professionally-made function from Kismet System Library have this major flaw? Maybe I should update my library if they fixed it.
I'm not sure honestly, I never even bothered with the set editor property node because I had issues with it from the getgo and in my research it seemed like most people executed python code instead to change variable values
I never have to deal with python code
Is there library out there with a function that does exactly what Kismet Set Editor Property does, but can access parameters regardless of how buried they are in structs?
Why don't you just edit the default value in the structs?
Are the change based on some data?
It's obfuscated code from a game that is not mine. Even if I could, this would still need to be automated because my changes would be wiped out every patch and there are ~600 assets to process.
Not sure about a library but this is what I used to modify C++ structs via python
Thought I’d elaborate further for anyone googling: I’m trying to write a python script that modifies the members of a user-created struct. It seems you cannot accomplish this with blueprint-created structs. Attempting to do so always results in “Failed to find property” error. However, doing this with C++ is trivial. For instance, say I creat...
last post
In my case I have an editor tool that allows for the customization of NPCs right in the editor without having to open a single BP
The NPC class values are all set via editor utility widget
makes modifying NPCs blazing fast
Sounds good
Lol this was the perpetrator, it also executed when I pressed the inventory key since it's any key
the component is what isn't valid
I don't know how Python interacts with UE4. Whatever this is, it needs to be "plug-n-play" with my existing blueprints. I need a node that can get/set any property of any type in any number of layers of structs of an asset by property name (non-useless version of Set Editor Property).
This has to exist, right? Structs are so common that I am still in disbelief that Kismet screwed this up.
All the info I found with regard to editing structs or nested struct values seem to suggest that 1. The set editor property node will not work and 2. The struct must be C++ created
Unfortunately if both of those don't apply to your case, I don't know a solution
WBP_PizzaBakingWidget is an overlay with two buttons at the bottom and a scrolling box at the top. Inside the scrolling box I'm trying to display all toppings used for making pizza. Each toping is a data asset having name, image, description. WBP_ToppingWidget is responsible for displaying these details for each topping. I have three issues that I don't understand.
- When I'm setting the topping name / image into a widget text / image I'm using ToppingIcon and ToppingName variables (which are created by widget components, and can't be set). When the widget gets displayed, I get null reference errors.
- If event pre construct is not attached to "get toppings" event it will not display any toppings in the crafting UI. "Get Toppings" runs the function from screenshot in previous question (to populate the name/image)
It is simply null at the time of accessing
Your topic icon is not set when you try to set the brush
- To populate the ingredient list I'm using a function PopulateIngredientList as seen on screenshot. I iterate over all toppings in an array and then use the create topping function.
yeah, but how can I just ignore that?
is valid?
Why do you want to ignore? The question would be why is the function get called when you don't have valid instance
well you can't really "SET" these
Set what?
ToppingIcon / ToppingName are the ones I'm using
so as widget elements you can only get them
If you are actually drag the component it should always be valid
I did
At this rate since I don't have your project I'm just gonna guess that you have a variable declared called toppingIcon
What is invalid is WBP Topping Widget could be getting the name wrong
Well there you go
Why do you want a pointer to topping icon?
Go to your widget designer, click on topping icon. In detail panel make sure a tick box called variable is ticked
it is ticked
You should see ToppingIcon component variable
that's how I got those vars
Well use that one instead, it should never be invalid unless u delete it
I did
Bigger picture , need to see components too
In here, you are not doing anything when you create WBP_Topping_Widget; at least not in the picture. You are just creating it but doing nothing with the ref.
I can't download the pic with bad internet connection but you could mention if the error is not run time
There's a clear diff
What does the error says anyway. I can't read from my end
I did mention that the errors pop up when I enable the widget when the game is running
Blueprint Runtime Error: "Accessed None trying to read property ToppingIcon". Node: Set Brush from Texture Graph: Create topping Function: Create Topping Blueprint: WBP_ToppingWidget
Blueprint Runtime Error: "Accessed None trying to read property ToppingName". Node: SetText (Text) Graph: Create topping Function: Create Topping Blueprint: WBP_ToppingWidget
You are having compiling error
What does the error says here?
oh that -nothing, I broke the node by accident
it's not there (the error)
it's compiling just fine
I see the issue
You never set wbp topping widget
You just passing null ref
To fix this , make it point to the widget you created.
From create widget return value, drag the return value and connect it to set wbp topping widget
@tropic peak
I'm here, I'm reading and trying to understand 🙂
Gonna go now , it's easy fix. Gl
❤️
you're a star @frosty heron
that fixed displaying the toppings but null errors are still there 😄
You know what accessed None errors mean, no?
Ok
If I can't set the variable, then how can I make it not null?
Let’s try this is one more time
(it's a widget element)
You are using a CreateWidget node somewhere right ?
yes
Ok. The return value gives you the ref
K. Click on the magnifying glass in the error and screenshot where it sends you
Function to populate the topping icon / name
What are topping icon and topping name, other widgets ?
And how did you GET them, is this logic all in the same widget ?
I get them by setting them to be variables and then dragging onto the graph
Alright
So you just ticked the isVariable checkbox and then dragged them from panel right?
that's correct
Put a breakpoint on CreateTopping
Then step through the code and hover over the input and output pins one step at a time
Also
Make sure CreateTopping is not called anywhere else other than that screenshot you showed
there?
ARGH
I think I might have found it, i need a minute
I think CreateTopping was being called from two places
yes that was causing the issue
thank you @lunar sleet, you're a champ
just one more thing
oh I think I know
Getting the hang of it then
it looks like DisplayPizzaMakingWidget is not called anywhere 🤦
Now you know how to debug
I should really just turn UE off at 10pm and call it a day rather than produce a ton of weird stuff to fix the next day
yeah this week I'm doing 14h+ a day of unreal so after a certain point it's just zombie development
Why don't you do in character?
Set view target with blend is a good node for cam switch
You can get player character and cast to your character bp and get his camera there
Typically on beginplay store a reference to character on controller
Use that reference get his camera do what you want to do
Watch videos on blueprint communication
And variables
Set view target with blend is the path with least resistance
There are soo many ways to switch camera some context is needed
Yes that's correct, my pfp is red panda. It's many times more cute than raccoon, good on you to notice
If I were to have any questions regarding a problem in my blueprint, would this be the right place to ask then?
yes
Okay nice. So the problem should be quite simple. I have attached a screenshot of a camera that I'm trying to set up (from scratch).
The video I follow didn't do any more steps than me, and they somehow made it work. I've tried looking around but I don't know what to exactly search for either...
But what is my target?
Since you're not in your controller you need a reference to your controller and plug into target
get player controller
So "Get player controller" targets player state, which it says I'm not either...
you need to connect the return value from Get Player Controller to the target input of the Set Control Rotation
But haven't I done that?
No it says target self which is whatever bp you're currently in
If I do that, then there is no problem, but my camera can't move?
Have I missed something?
what should that be connected to? Because it's not in the video either
ignore what I said
okay
Those are input actions
oh right
Sorry if I'm being too dumb, but I don't think I understand the question...
But what is the problem then? Is it because I'm writing inside of a "pawn"?
What are you trying to do
trying to make a movable camera. Like a character that can look around
I've made zooming in and out, with limiters. But that's it
Just follow this
Hey guys, in today's video I'm going to be showing you how to create a free look camera system in Unreal Engine 5. This allows you to hold or press a button that lets you move the camera around the player without changing which direction the player is moving in. This works great for third person shooters, a great example is PUBG.
#UE5 #UnrealEn...
working with widgets/UI is such a pain in the back
Slate > *
@mental trellis btw, later on in my game, my character might deal 100 damage instances within a second and I want to show pop the damage text for each of them
will be using a normal text widget be ok? or lag is guaranteed?
Should be fine. If you're worried about creating a ton of widgets, pool them? Use slate?
Fortnite uses slate when it needs a lot of ephemeral widgets iirc.
slate it is then =(, didn't have a good memory working with them
Just do it in umg and if it gives you 2 fps, do something about it.
Could always use niagara for damage numbers
How would that work? Damage numbers as a particle with a unique texture per number?
or perhaps some sort of 0-9 texture which atlasing?
I'm honestly not sure. I just know it's popular.
Just flicking through the first result I found and it's definitely sampling some texture, so no really dumb unique texture per number
It's the same general idea as subuv sampling, like you would do on a fire particle sprite sheet. Just instead of flipping through them, you pick one subuv index and stay on it.
You could even go as far as to create a particle per digit. That'd make it real simple.
This gives me a great idea for a project for somebody actually.
Most all programmers feel like this unless they're UI specialists, it seems. To give you some advice to make your life easier. Stop trying to tie gameplay code into UI. Gameplay code just works and does things and has delegates that say something happened. UI just sits on top of that. Gameplay code should have no idea about the UI at all. When you do this, you get a nice decoupled UI system where one thing does it's own thing, and the other thing does it's own thing. You'll get much cleaner and simpler to follow gameplay and UI code.
this did throw me off for a sec xD
I'm a UI specialist really. Still a bit stiff on UE4/UE5 systems but I love UI programming a lot. This is how I've been handling UI for the past many years in Unity and ROBLOX. Trying to tie gameplay code to UI never ends well... as many bugs I have ran into have shown me.
Fantastic advice.
A good MVC approach works really well with UI. It's basically how UE is designed too.
I recently remade a power generator system component and fixing the UI was as simple as getting the relevant data from the new class and binding to the new event dispatchers. (of which all happens in one initialize type function) So it definitely pays to keep UI as read only as much as possible.
Set geometry collection node does not work!! Is there a way to spawn a chaos destructible mesh at runtime?
It gets even better with more generalized gameplay systems. It's one more reason I recommend people not to be afraid of GAS. In a small side project of mine, I can display any attributes I want just by picking them and the style. EG ProgressBar, Text, etc. I have a small set of generalized widgets that take in parameters from a definition which describes the attribute. If I want a stat sheet for a character I just make an array of attributes I want it to display and give it a abilitysystemcomponent. It pulls them from the component and displays them in the correct style.
Even more so on this are generalized systems like turning one thing into another. This one is a huge pet peeve of mine when I see gameplay programmers making a special thing that makes this, and then a special thing that makes that, etc. Cause as a UI person I have to follow along multiple systems doing the same thing. Everything in a game that does this is nothing more than your average crafting system. You need two structs to define the entire system. One that has a list of generalized things. I use a struct of a PrimaryAssetID and a float. And then a second struct which has two arrays of this and some other data like craft name, craft duration, etc.
This system works for literally anything that has inputs and outputs.
- Forge in a game like Valheim that takes in ore, crafts ingots and spits them on the ground.
- survival game crafts items from one inventory to another
- RTS game takes global resources and creates a unit in a building
- Tower Defense building upgrades
- Survival game building system
- Perk systems
- Talent trees
All of these can be defined as a list of things required and a list of things given with a duration of time taken(even if instant). And I see gameplay programmers making one thing that makes weapons, one thing that makes survival gear, one thing that makes furniture, another system that handles perks, etc. Just boggles the mind how complex people want things.
that's 100% true but I need to develop a system that sorta looks like the inventory, and I need to be able to move selector in WASD directions. It's not only a chore, but I have no idea why it doesn't work. I can't wait to be done with that so I can do something that doesn't break my brain
hey guys
hope u all doing greart
i have this probleme where if the player keeps spamming the interaction key the text will keep displaying forever
You need C++. That's 4 lines of code in the Game instance to add WASD to the cardinal nav focus movement. 😄
well it's not just that
moving the selector around is one thing, knowing where to move it is another
overall it's all bleh.
A guy in the UMG channel made a plugin that allows you to override the default UI nav keys. 🙂
That's what focus is for. It handles that for you.
huh
Unreal defaults to the arrow keys. And DPad on gamepad. If you set focus to a button in a grid and press arrow right or DPad right, it'll try to pick the button to the right of it to focus.
One thing I've learnt is don't fight with the widget nav system (focus and focus path) lol. To many headaches from trying.
Guys, if I'm using Data Assets to create my units basically to be unique and have different things and in the end I spawn class BP_Unit, but imagine you have 2 workers from different factions, one is gathering by transporting and 2nd one is adding resource instantly without need to transport.
Do I just create this logic in one class and switch on enum which I them provide in Data Asset (like this unit InstantGathering and 2nd one NeedToTransport).
Or should I utylize class inheritance? I wanted to kind of avoid creating each class for every unit, but is storing the logic in one class for let's say 4 different type workers heavy? I'm just thinking about future and if I'm not gonna end up shoting myself when trying to fit everything in one place. Like I don't think 3 more lines of code will change anything but it's more about clarity of things? Should I use components maybe for these kind of logic?
It's the Delay.
- Press once to create widget, set it in the Text pointer and start delay
- Press again to create second widget overwrite the first widget in the Text pointer, delay is started already so ignore
- Delay eventually runs and removes the second widget created but not the first because it has no way to reference it since you overwrote it.
I wouldn't even mind if it worked with the arrow keys
not gonna lie I tried using chatgpt to get ideas how to develop this and yeah, it's all garbage
I might need to look up a tutorial on inventories or something
Depending on the level of customization you're after, defining behaviors using uobjects isn't a bad way to go. It's how GAS does it. You can then define the behavior within the data asset.
When you create the unit and assign it a data asset, it'll create the specified behavior object.
are there any nuances about players using (possessing) pawns instead of character classes for multiplayer? (The game is 2D and I want to change collision boxes from capsules to cubes, therefore will start it from pawn)
I believe most of the automatic replication is handled inside the character class so if you're using a pawn, you'd have to set it up to replicate yourself.
replication? what is that?
Do you mean Behavior Tree as Behavior Object? Or just normal UObjects? Do you mean that I put the logic into the UObject and then on run time I add Uobject to the Unit based on what is in the Data Asset?
dude im sorry but im kinda new to this bp stuff
can u explain a bit more
The process of sending from the server to clients and visa versa. If you're planning multiplayer its pretty much the first thing you should learn.
Personally, I have very simple BTs for my stuff and I specify these on the unit's data. So for me the way I implement this is that I have two pawns. Both use the gather resources so they go to the resource and harvest it into their inventory. At full they swap to the storage BT in their data asset. One of these makes the unit move to the storage, the other simply moves the item to the storage.
oh, i got you. So, more simple thing would be to disable capsule from physics interaction and just hide it?
Either the be honest, it depends what sort of behavior you're having. If it's pretty basic and doesn't need a BT, then uobject is fine and you can have a generic function called 'Perform Action' that the unit calls when it should perform an action. You can then create children of the base action object and override the function to define what should happen.
BT's would most likely be more flexible though.
,
I can relate to this a bit, because that is how I also did it at first and I could just swap different BT for different kind of workers, that would be easiest, but right now I'm trying to not use behavior trees for what player units are doing, so I'm doing ''behavior'' in blueprint.
I just wonder what is the best way to create 2 different similiar events and then asign them to type of worker. I wish there was a way to create like whole event, close it into capsule make it variable and add it to the unit based on input info from Data Asset.
I'm thinking components and add component on run time but then it's like do I call to Unit > Gather and then Gather calls to component, but if you have 2 components then either I have to call to both of them and 1 that is added will respond and the rest will call null, or I make all events and possibilties in 1 class and switch branches on input Data from Data Asset so like Gather > Go to resource > Gather > Deposit (here branch if needs to transport or instant deposit), would it be the way ?
Why are you avoiding that for player units?
I don't have good anserw for that other than it's just a bit more performant to have this simple logic in the blueprint and not in the behavior tree that ticks all the time. Also a bit easier to get unit out from the gathering state.
My knowledge is missing the part how to add UObject with logic to the Actor? Is it like components? Oh it's like Construct Object node?
Because the logic is flawed
This is my primary AI tree ran on all units in game when they're spawned. I just change the primary and secondary behaviors mostly. Like primary behavior is for sending them to attack or move. They'll carry out primary tasks before secondary and then move to the next behavior. usually this ends in them idling to look for targets.
@normal viper you can try using retriggerable delay instead
It will reset the time if the node gets fired before the timer end
dude i dont know what that is
EG Move to and aggressive Idle. MoveTo is put in primary, aggressive idle in tertiary.
Ok dude, time to put in some effort
Don't know what you want me to say
nah man like just explain what the hell is retriggerable insted of trying to show off
not all of us know everything
All good, replace your delay with retriggerable and maybe it turns out ok
Not sure why you add to viewport again at the end tho
aight ill try
Doesn't seems to do anythinf
@normal viper actually I just read the code again, you will still have issues.
My suggestion is to create one subtitle widget only and just update the text whenever the function is called
You are creating a new subtitle everytime you want to update a text.
What you should do here imo, is to create a subtitle widget if none exist and if it exist, just update text
I tried to make this logic in behavior tree, it was working ok, but it wasn't really good in beeing responsive to player inputs? I probably just made it wrong etc. but now I moved it to blueprints it's much better performance and the responsiveness is amazing. Like you click, it attacks, you click stop it stops and resets target. With trees sometimes it didn't go out from the tree and it was still doing one of the task even if it was aborted, or going back into Attack state sometimes the target was set, so it couldn't set new one and a lot of shit to think of so it worked in every case. And it also had to go trough ai controller, set bt.. set target.. and now it's like Click> Attack > if no target > Sphere Trace, Set Target and attack, which is crazy good responsivnes (almost like you play league of legends), but works for x + units.
I think I will try to learn a bit about UObjects and see if they can be usefull. I wish I could make some things more modular but Components don't fit 100% what I want to do and probably creating something like Spell Gather 1 and Spell Gather 2 and assigning it to unit into slot [Gather] would call what ever was added to that slot it would be perfect. Maybe UObjects can do that.
This crashes the editor when I try to use the array after I set it this way. So how best to go about doing this? I need to set a chaos geometry collection that spawns when the specified static mesh is destroyed.
man thank u so much
i fixed it
and im sorry for what i said before i really didnt see ur message
thanx again
@normal viper hey man, it was my bad for getting moody but anyway are you sure it's fixed?
from what I observed again, there should be another issue
problem is you are creating multiple instances when you should only reffer to one
yeah
if you want to drop your latest code, I can try to look at it to potentially fix some edge cases (bug)
here u go
@normal viper use this node instead
Also your code is fine except the normal delay. But you can further optimize by creating the widget only when interact is called
but if you don't need that optimization, it sort of work as is (just change the delay to refrigerable delay
That looks like a map, not array
what does the crash says anyway
Yea lol same dif(I know not really) still its causing my game to crash
Perhaps one or all of those pointers you passed are null?
Well it does says you are trying to access out of bound index
An array of size 10 is 0 to 9
and there you are trying to access 10
I know but I don't think I am
add break point on where you think the crash happend
this is it
the only time I use the array
I mean map
and for some reason it crashes 100% of the time
I'm not sure tbh, map and array is like very different, if you dont call this node does it stop crashing?
Map doesn't have concept of order afaik
you won't even get an index
but the crash is array related it seems
yea if I dont plug that return value into that pin I never get a crash the moment I do I get a crash
add breakpoint on the is valid check
then step through
findout where do you exactly crash
nvm I think I just found it lol
I have no clue why I even added that -1
nop did not fix it
you need the -1 actually, trying to access length would be the case of accessing 10 in an array with a size of 10
where the array ranged from 0 - 9
so yeah, it's not the map that is crashing, deffinitly the array
o yea
#blueprint message
looking at this, it shouldn't crash your project
show the entire picture
are you trying to get the last index of an array?
this would already give an error since you are checking if is valid but also casting
I was getting the hit part but some time damage is enough to destroy two more parts at once so when that happens I get the another part and destory it two
better to add an Is Valid Macro and properly handle the case in different executions
ok how would I do that?
unrelated but instead -1, you can just grab the array and type last index for neater code
Also everytime you are accessing an object reference, you want to cosndier adding guard (eg is valid check) unless you always expect something to be not null
in a case of a hit mesh or a scenario that it can be null then you deffinitly want to add a guard
ah is valid should be run first I see
doesn't a cast imply an is valid?
he is using those pure function cast
but yeah maybe you are right? it has the success node
can't it just be that Selected is Hit if cast succeeds and array contains it?
Hopefully this fixes it
use the is valid macro , you will end up with less node
nop still crash lol
you shouldn't really crash from accessing null object in blueprint anyway
I KNOW
what im saying is, I don't think the crash comes from any of the blueprint you showed
but it's only pure guess at this point
If you look at the crash logs, it might give you more indication as to what did the thing that caused the crash.
This is the code that is causing the crash
But I dont see how
I removed every thing to do with the array that could cause a crash just went and got random instead of hit
might not be this code at all
make this code not run
idk a thing about GAS other than it's huge and I don't wanna mess with it unless I have to
Ahh yeah we can forget the gas part
basically I am spawning locally because delay when shooting sucks
but I also tell the server to spawn a replicated fireball so everyone can see it
that sounds like working around GAS, probably look at how the demo projects do it
I'm just trying to figure out how to sync this in the best possible way, it do be weird if I got a headshot but everyone see me miss?
What does it say before the error stuff?
I was expecting more than the previous 3 lines lol.
sorry it spams a error with my AI patrol points that has nothing to do with this lol
but I am going to go fix that now lol because its easy to fix
Anyway, it looks like it's something inside BP_DestructionMesh that you spawn.
yea its my destructible mesh
this is what spawns it
and the moment I plug that collection pin in and test it crashes
My money is here
ok what am I doing wrong?
try to unpin it see if it stop crashing
it does
but then my destructible mesh does not get changed either... Also there are some times it work fine without crashing for like two or three hits then crash
how is collection in even set?
construction script seems to be a pretty bad place to init stuff from object ref
issue here is you are probably passing bad data imo
like where is collection in even set?
why is it on construction script?
best way to get to the bottom here is to use IDE anyway since the project crash on CPP function
like you can't see what it's trying to do without actually diving inside
still crashes
yea no suprises
i mean there is no attempt to fix the crash soo far
it's not gonna go away until you find out what the issue is
I removed it from construction to begin play
I would say what ever you pass to set rest collection is not good enough, right now it's all just guessing game.
The only way to find out is to actually dive into the code
This is what I am passing in and I am manually setting that data like this at the begin play of my buildable
I would love to figure out how to auto tie a static mesh to its corresponding destruction mesh but I have not been able to figure that one out yet
Hey guys I was able to make a combo melee attack using Enhanced input. EI makes it pretty easy, All I did was make a few Input mappings and named one combo that one activates after 2 inputs of light punch
Then it activates an animation montage
However If you keep pressing it the input just repeats
anyway to buffer it using EI or code
Watch
When you guys rebuild your functions so things work differently, do you keep copies of the old versions or just delete them and rely on version control if you want them again later?
https://www.udemy.com/course/unreal-engine-5-soulslike-combat/?couponCode=LETSLEARNNOWPP is a good course that will help you alot or you can find something on youtube. I could try to explain it to you but there is so much more then just click like you are and you would be back in 10 min any way
I normally just delete them. I might keep some functions if I think I might revisit the logic.
I personally leave a big fat mess down under my function untill I KNOW I have every thing right lol
i have some files i wanna import, for some reason it just wont, i dont know why. i have seen other people import it just fine yet for me it bugs and dosnt allow me to. help?
Are you trying to drag and drop them in to the editor?
That is what the wantstreereset is for. When you set a behavior you normally reset the tree so that it will restart the primary behavior again. So it starts doing something new immediately. It will abort any lower behavior.
"Import normally" meaning you used the import button in the editor's content browser?
Just confirming what you meant. Are you trying to import the whole batch? If so, what happens if you try one file?
Actually boys ive almost got it
Oh god why
What's happening? You try to import and just get no response? Or is there anything showing an error?
why not?
Lol, I do this when fixing other people's logic. "I think I know what the intention here was... But just in case we'll leave this chunk of insanity down here til we're done."
Im almost there It stopped firing off every second after I created a delay and a boolean in place
Hi Can Someone help me with this Boxtrace. The trace is weird when the Character is not in 0 - 90 - 180 -270 -360 degree
It now acts like a regular melee attack but now I need to get the combo working properly. It has decent input buffers instead of just restarting the animation over and over again
You need to rotate the box's orientation.
hii thx can you tell me how i can get the trace box orientation
Hope I don't mess any chat flow but I was wondering if anyone could point me to online sources or clarify what would the difference while in runtime between streaming level instances versus spawning an actor of the level instance BP (the BPP_x UE creates for you). Seems to be the same result
It's on the multiboxtrace node. You probably need to convert the forward vector of the arrow to a rotator and use that maybe.
When I drag and drop it shows an X and when I import it’s just blank nothing happens
To this .
Yes Thx It Worked Thx Alot 😄 just needed to get arrow world rotation and put it in trace orientation
Anyone able to humor me with why this might not be doing what I expect?
Expectation:
- Look at every Floor Tile we're about to place when we drop the NextRoom into the Dungeon
- If that Floor Tile already exists, remove it from the incoming Room (so we don't duplicate Floor Tiles)
- If it doesn't exist, add it to the Dungeon, and then look at each Room we already added and remove any Vacant Spaces we find that share the incoming Floor Tile's location
What happens:
- Everything works fine except it doesn't actually remove the Vacant Space from the existing Room (the final, uncommented loop at the end)
In the screenshot you can see a Room where it placed a floor tile but didn't remove the previous Room's Vacant Space from that position, and the debug text shows that the coordinates are equal.
For Each is a copy.
Holy shit
This explains so many problems I had earlier
Alright, so easy fix then is to just expand it to manually remove that item from that index in the array?
😄 It's fairly easy to make your own ForEachByRef node though. You just change some of the stuff around after copying the original ForEach
😮 Sounds scary. I'll have to look for a tutorial.
Wait
If For Each is a copy, then why does my dungeon work at all?
Like, you can see in those same screenshots, the first check which works fine is a For Each on the Floor Tiles for the next Room, and then I just drag a pin and remove from the next Room directly
That's how I've added literally all of my room components so far o_O
Where is the add?
That long line over to the right is the one that Removes the element from that array if it was found in the dungeon already
That small box here on the left
that remove is modifying the array
the last remove is modifying a COPY of the entry in RoomList
Oooooooooooh.
you are copying the entry, removing a tile from it, then discarding the work
Yeah alright I'mma need to look up that For Each by Reference thing
This smells like C++ territory, how long does this take to run right now?
Not long. Sec I'll find out.
In theory, this fixes it right?
Takes about 3-5 seconds to generate a 25 room dungeon from scratch.
Including the mesh spawning or just generating the data?
Incl mesh
You could do the data in like a millisecond in C++ if done right, probably less time. Holler if you ever want to go down that route, I've done similar stuff. I'm working on a high performance WFC implementation.
Might be worth pursuing in the long run. The thing that I think it holding it up is my approach to placing Rooms... Rather than placing them sequentially, I create a "Pool" and draw Rooms from it that fit with whatever I've already placed, like a puzzle (no corridors, no spacing between Rooms). I generate a new pool of Rooms any time I am unable to find a piece that fits.
I haven't messed with optimizing the room pool creation yet though either, so it makes hundreds more than it needs to.
What I found works great for the "Does it fit?" test is bitwise logic
Elaborate on "bitwise"?
basically I have 8 states that a tile can be in, so 1 byte can represent any combination of the states a tile can be (basically, representing what's allowed right now)
11111111 means anything fits
10000000 means only floor
etc
so then the logic of "does this room/stamp/pattern fit?" is basically doing bitwise logic on the elements of 2 arrays and anding all the results together
if every tile is allowed, the room/stamp/pattern is allowed
I was looking at some WFC videos before I started this project and ultimately decided that it confused me and I wasn't sure how to implement it. So I'm building this entirely from scratch, and it's my first programming project in 15 years.
The check you're talking about sounds extremely similar to what I've ended up with though, just probably way more optimal.
You can see that you have something very similar going on
you're basically doing overlapping model with N x N patterns and I guess randomly generating them instead of learning from an example?
also you're probably not doing the propagation step
-
This is the normal ForEachLoop. That highlighted node is the only thing you have to change.
-
You can copy the macro by double clicking on the ForEachLoop to go to it's implementation. You right click it in the list and copy. Make your own Macro Library of Object type.
-
In the copied macro drag the input array and get the ref getter instead of the copy one. Connect the Array Index integer to it. Drag it's output to the Outputs thing to create a new pin. Delete the old one by copy.
You might actually be more like the simple tiled model with irregularly shaped tiles
your rooms don't need to match overlapping right, just match at the edges?
What I do is...
- Check each Room in the Pool for a Door that faces the Exit we're currently trying to attach a new Room to
- Check if any Floor Tiles overlap
- Check if any Doors would be blocked by incoming Walls
- If any of these fail, the checked Room is not a valid puzzle piece
ok so sort of the same idea but a bit different
I'm guessing you fill in holes after the fact?
And then after finding a Room that fits, I go through each of its components and decide whether or not to keep them. So for example, the Vacant Spaces need to be discarded when another Room's floor is in those spots.
What holes?
vacant spaces or positions not claimed by a room
idk what your room shapes and sizes are
Oh. That's all variable - I'm making it modular so I can use any meshes and have it properly scale and assemble them automatically.
Do you have some way to run this async or does it just stall while thinking?
idk if BP has any async or not
the 3-5 seconds that this takes, can you move the camera or is it just frozen?
Oh, I can move around. It's laggy in the editor but I haven't tested it packaged yet.
The problem I had was that when I move the "planning" code to the Construction Script (to occur before hitting Play), it started thinking it was an infinite loop, which I can't fix without that 0.0s Delay in there.
I can mess with all that later though too.
Ex) I can hit Play and watch it generate
I'm working on calculating the pitch angle my AI need to look at to shoot at a specific location on my character, but I'm having a problem with solving at distance. As magnitude goes to infinity, arctan goes to 0, so the offset isn't calculated anymore. Any thoughts on how to resovle this? I've been banging my head against this for ages!
I don't have it filling Vacant Spaces yet. Eventually I will use them to add secret rooms etc... They're indicated by the Yellow debug boxes.
I run into the same issue with that node
that just shows where you're looking, but I need to calculate an offset from where they're looking to where they need to look
there's so many "I'm looking in this direction" things in Unreal
control rotation, base aim, focus now, probably like 2 more
find look at rotation is another one, but it seems to be calculated the same as above
You don't need much for AI focusing stuff other than the above. You set the target or target location. And then your control rotation drives an animblueprint's 1d or 2d aim offset.
If you guys are interested in WFC, this plugin I made also uses WFC with some in-editor editing features:
https://www.unrealengine.com/marketplace/en-US/product/procedural-level-generator-01
I'm sure other ones are better, I'm trying to make mine fast
it ONLY takes in and spits out raw tilemap data. What you do with it (heightmap, spawning actors, whatever) is up to you
bitmap and settings in -> math -> bitmap out
I'm also interested in making my plugin faster, I tried to make the level in chunks, but still slow in some cases especially when the user add so many checks and conditions
How does WFC decide where to place things like traps, decorations, or secret areas?
depends
In my usage we'll be doing that as a post-process
Generate dungeon, then add extras?
Does it do overlapping or the socket approach?
Yeah several passes.
Check pathfinding, add extras, then select meshes for the tilemap, smooth walls if wanted, etc
We want to experiment with multi-layer WFC, I think it could be pretty powerful
Pathfinding is a thing I haven't even attempted to learn yet.
I'd recommend making your fundamental data representation some sort of integer grid
I'm also kind of trying to hold out until they inevitably launch a dungeon generator version of their new PCG tool.
I made a socket system that also combines with an auto socket detection
I haven't tried that style, only overlapping
UE 7.13 - New Dungeon generator!
UE 7.22 - Finally stopped dungeon generator from crashing, mostly!
Right lol
Realistically you'll never see that from Epic. Too game specific.
They're getting close though with the Biomes thing. Biomes are basically Room Themes.
You can define a Dungeon "Biome" and a Crypt "Biome" and make it place actors based on the Biome, which is cool
But I think it's still a nightmare to get it to place things in a way that snaps together nicely
I need to check on that actually. It might help our PCG at work. Takes a ton of time to generate PCG on our maps
ATM we just have separate PCG graphs per biome type.
Yeah I haven't messed with it too much yet. I get the impression it's still going to change dramatically between UE versions, so I'm afraid to commit.
What we're thinking of doing is "biomes" through wfc.
Basically you have a top layer that does WFC at say the 10m pixel scale
that lays out land, water, mountain, whatever. Its colors are biomes
then the next layer lays out individual building plots or features at the 1m scale
as a seperate WFC run per island in the upper layer
then within the islands of that one you run a WFC at say the 20cm scale to lay out walls and windows and such
Interesting.
each layer defines the wfc example for the next layer. Haven't tested it but I think it might end up with some cool results.
Caves of Qud does something similar
WFC scares me. I don't feel like I see dungeons that resemble actual structures come from it too often...
(Then again, I haven't looked THAT much into it to be fair)
I bet PCG could make a sick Cave dungeon in its current implementation though
Take a big block of dirt and just bore holes through it
Can WFC make neat, rectangular rooms? I feel like all I usually see as WFC examples are things like your video's thumbnail, where the architecture isn't necessarily "realistic".
yeah it can
that's for an organic cave
This was before I have frequency hinting working so the rooms are denser than they should be
Fascinating...
It almost looks like it's printing variations of a template over the board?
Basically every 3x3 pattern in the output will be from somewhere in the input, and the 3x3 pattern frequencies should corrolate. If you draw more outside and less inside, you should have less inside. This was before I had that bit working correctly so it drew more inside than it should have. Still wouldn't be a bad map with a bit of post processing and it can crank these out indefinetly.
How much "randomness" is there in WFC generally?
I have my generator creating each Room as follows:
- Pick a random Area for the Room (Area range limited by variables)
- Break that Area into "Chunks" of Floor Tiles (Chunk area also defined by variable)
- Convert excess Area into Stray Tiles
- Place the first Chunk at relative position (0,0)
- Pick a random Chunk, pick a random Edge, place another Chunk on that edge, repeat until out of Chunks
- Place remaining Stray Tiles randomly around the Chunks
So, it's random floor plans, with usable floor space controlled by how large I want the Chunks to be (the Chunks come together to create a nice "core" area in each Room, and the strays end up as small hallways or protrusions, which I can add things to later)
so i did a simple animation of fading in and out for text but the fade in works and the fade out doesnt
the text just vanish
and when i added print string to see what going on found that the animation and the setting text to empty fire in the same time
Don't bother clearing the text. You'll be setting it when you use the widget again anyhow. Just fade the text out and let it stay faded out.
this text apears when interacting with actors and i have multiple actors that displays text when interacting
isnt it going to cause issues if i leave it faded out and interact with other stuff ?
Why would it? You should be setting it when interacting with something else.
- You create widget for the first time with blank text.
- You set it for an object which sets the text and animates it in.
- You stop interacting with that and let the text fade out. It's now invisible.
- You interact with second object which immediately sets new text and starts fading it in.
IE On the last step, the text is already set before the fade in animation starts. So there' sno issue to just fade it out and leave it there til something else needs it.
well that make sense
thanks man
ill remove the clear text
and leave it fading out
Its always interesting checking out the templates from time to time. There's always slight changes between versions. Like when was there a weapon component in the FP template lol.
Still waiting for them to remove that construction helper shit from the C++ templates. 😦
I only created it to nab the pickup rifle. 😅 Now I need to figure out the reasoning for the setup haha.
Hey
I am using the Adventurer's Inventory Kit and following the developer of its video asto how you integrate it into ALS
My issue is that in the first 20 seconds of the video the dev changes the game instance in ALS to BP_GameInstance, which doesn't exist in ALS for me
In this video, I've tried to show you guys how to integrate Adventurer's Inventory Kit with Advanced Locomotion System V4. In the next video, I'll be showing changing ALS states according to the equipped weapon. I hope you guys enjoy it!
Marketplace Link: https://www.unrealengine.com/marketplace/en-US/profile/Tala+Esenlikler
Thank you all for w...
also - it seems that person who made the video for the integration has the inventory kit already integrated into ALS which is.. very confusing?
a little stuck, it suggests that I set stop jumping to a button up event but I'm stuck on how to go about this
Hello! I was under the impression you could update the value of a key in a map by adding it with the same value, however that doesn't seem to work. Am i missing a setting or? I've verified with a breakpoint that the tmp int is 1 and the name is one of the keys in the map. But when I check the value of the key after this node has run it is still 0
what is wrong with my directional movement input?
I need to have movement in a relative direction, even if I rotate yaw pitch or roll
Yes, that's how you update the value. If it's not working, either you're not using the actual variable (pass by ref issue maybe) or you're overriding it later down the line.