#blueprint
1 messages · Page 370 of 1
Go back to Get Player Controller (0)
This is in the game state, which doesn’t have a great association with a specific player
Ah. You said that was a widget. Yeah you'd need to get the player controller globally then.
oh, no this is a function in the gamestate. Sorry
hold on, before i do this i wanna ask the correct way to go about this.
The game is about collecting cats. (ex. going up to them and pressing E. I have the HUD which i have text of how many cats are left. Considering the gamestate is meant for storing the state of the game (ex. cats remaining). The whole interact thing is through an interface, and inside the actual cat actor it sets the cat to found (and is then supposed to communicate to count down by one and change hud). I assumed the whole keeping count of how many cats remaining would be in the gamestate no?
whats the way to go about this?
as well, this will be annoying but eventually i want to make a hint system where one of the cats remaining makes a meow sound to help the player find the cat. Zero clue how to go about that as well, but thats a later issue. Not sure if that affects how we code it now.
Realistically you'd keep that actual count in the GameState as an integer. And have a setter function for it that first sets the new count and then broadcasts a delegate(event dispatcher).
Your userwidget's Construct could then GetGameState->CastTocCGameState and both set the text initially and bind a delegate to set the text when that delegate is broadcast.
In this way your GameState doesn't have to care at all about the UI and your UI can just listen and update when the GameState says it's changed.
as an int, not a float. Got it.
How do you make another actor jump whille not possesing them
Unless you can collect half of a cat. 😄
no, originally i had it as an int but i read something somewhere and for some reason i decided against it 😭
that was funny though lol
Hi I’d like 0.463 of a cat please
coming right up!
“The right way” is generally nebulous, but Auth’s reply is definitely better practice than how you have it set up. I never have my game logic setting text like that.
by best practice i mean not the terribly shitty non functioning code i currently have 🤣
is that setting function also in the gamestate?
as well, should the setter function subtract 1 from the cat, or should i do that in cat actor?
Cat can call Game State -> Collect Cat, which can then subtract 1 from the cats to collect and can add 1 to the cats collected - using setters
But I’m saying that in a vacuum
where did we get a cats collected variable from haha
oh, is that for the hint system?
speak of the devil i just found a cat. Hes on my lap
no worries lol
I say do what makes the most sense to you
collectCat is a function inside gamestate correct?
unless you suggest putting it elsewhere.
whats up with the delegate/event dispatcher as well?
RAHH IM BACK TO THE CASTING OF BP HUD SOMEHOW
i thought i got it, although now im having this error. Blueprint Runtime Error: "Accessed None trying to read property K2Node_DynamicCast_AsC_CGame_State". Node: Bind Event to ED Cats Collected Graph: EventGraph Function: Execute Ubergraph BP HUD Blueprint: BP_HUD
How its setup: Gamestate has a function called collectCat. Collectcat has a event dispatcher called ED_catsCollected. It calls ED_catscollected at the end of the function. In the BP_HUD, i have Event on initalized set into bind event to ed cats collected. I think the issue is with Event on initialized but im not sure.
call the jump function of w.e character you want to jump.
On you're event dispatcher, add an int property and pass the new value through when the dispatcher is called.
On the custom event, also add an int property (so it matches the dispatcher).
Then move the 'Get GameState' -> 'Cast' to the on initialize event so the binding can be created correctly.
You can then correct the 'Custom Event' to use the int that gets passed through to update the text without needing to pull it from the game state.
Would anybody have any idea on this issue?
hello,
I am having an issue with Damage Event for my Perception AI. If I test my code with the X keyboard shortcut, it works and calls the Damage Sense in my AIC_NPC AI Controller.
But if I call the Damage Event in my Weapon Blueprint, the Damage Sense is never triggered.
When looking at the debug, the damaged actor is correct ( of type BP_Stalker wich is my ennemy type )
I dont know what I am doing wrong
In debug, I shoot on the ennemy, the Damaged actor is the BP_Stalker I shot at. So the damage event should be reported on the AIC_NPC that is implemented right ? Just like when I press X
It looks like its attempting to initialize gameplay tags but one of the paths is empty. Double check to make sure you don't have any empty/null gameplay tags in your project and then rebuild.
I looked through them before but couldn't find anything that would cause an issue.
You have a null 'Gameplay Tag Table List', either set it or remove the entry.
Ah that was it. thank you, that helps a lot!
Anyone know what that yellow message is meant to mean ??
not sure if that appearing is a good or bad thing thats all
well its probably not a GOOD thing but it doesn't have to be a bad thing.
Do you have shadow artifacts? If you do, then you should address the message
well at the moment I am using a mix of placeholder Geomatry standing in until I finalise a basic level layout so I'm thinking is might be that causing the yellow warning
the geomatry one
It's essentially just telling you that you have too many lights trying to affect a pixel and that you either need to reduce the light count affecting an area or increase that value.
when I say geomatry I mean them ones
arrr so it'd be a case of increasing say the attenuation on the lights so less of them cover more area would prob solve that issue
why wont physics work on this actor?
i want it to collide and simulate physics with the level but not the player.
any idea how I would delay the spawning of player character ?? essentially whilst all the sub levels load is I don't want player to be spawned and then when ready I tell game mode to spawn player
Delay node before the spawn 🤷
so my issue is Game mode has stuff by default to spawn the player I need to delay this so I can manually tell it to spawn player when ready
Spawn a dummy empty pawn then switch to the character once everything is done
GameMode can delay beginning play and spawning default pawns until you set it to.
Ughhhh an Authaer comes instantly and knows a better solution, good that i killed my ego a long while ago 😄
so your saying I leave default pawn null and manually set it when I want game mode to spawn it ??
No. GameMode has a boolean thing for... Sec I need to open IDE.
bDelayedStart. Set this to true.
And then whenever you're ready you can call StartMatch
arr okay
so apparently this isn't something I can set in cpp in my derived game mode
It is. You can even do it in BP. It's in AGameMode, not AGameModeBase for clarity.
arrr my derived game mode is the latter as I couldn't inherit from GameMode
i've changed that so I'm deriving from AGameMode
whats differce between them both the none base one to the base one
Make sure to change your GameState as well.
so gamestate is the default one I've not made a derived Cpp yet for that, I prob should though tbf
And the difference is basically just matches. GameMode extends the original to add a "match" like system. You could look at it's implementations for that boolean and do the same thing yourself without the matches.
arr okay I spose I can still dervive from the gamemode one and jsut not use the match stuff if I don't want to
You don't necessarily need a derived one if you don't have one already. But I would. GameState is useful. But at the very least you'd need to swap it out for the other. The game won't work if you're using GameMode and GameStateBase.
so i've gone with the following using that bool to delay player spawn and just using the restart player function to then actually spawn the player
and for now this seems to work okay so think i'll call that a win of sorts
i didnt even need to do all that. I could just have set the initalize to first do the cast.
is there a reason you suggest doing the rest of that stuff?
on second look, it appears i overlooked something. Not sure how to differentiate between the cats (unless i duplicate the bp)
Yes because most of the time if a value has been updated, the things that need to know will need to know the new value. This can save you having to manually pull it from the game state.
Ideally, we wouldn't even do the binding in the widget itself but one step at a time. 🙂
what do you mean by wouldnt even do the binding in the widget? where would we do the binding?
id like to do this right so i dont learn something wrong and have to forget it.
It can vary. Where do you currently create the widget from?
a hud class thats set to the gamemode.
You could do the binding there after you've created it. You can use the 'create event' node and connect the created widget and select the function.
This means the widget doesn't even need to know about the game state. (Assuming you do my previous recommendations)
As for why, it can allow widgets to be reused in different places more easily. Especially when you use child widgets.
nevermind 💀 . one step at a time as you said. Let me do the previous things first quickly
how do i set this custom events property to match the call property?
If you pull from the red square you can create custom event and it'll automatically match.
Alternatively, just add the same properties to the custom event.
got it. Had to recreate the event so it worked.
Yea, there can be lots of little changes you can make but going through them all at once can be daunting. Things that for smaller projects probably won't make a difference but it can be good to get into good habits. 😅
exactly why im so persistant on doing things the right way, that way i dont learn bad habits
Just to clarify, there's not many 'wrong' ways, just better ways. Understanding how to do things 10 different ways is great when you start to build your own systems. This allows you to better pick methods that best fit your usecase.
Sometimes I'll use a less optimal way because I can't warrant spending the extra time to do it. 😅
Granted there's been a few occasions where I've regretted it. 😂
yeah, for sure. Glad to get the logic right in my head so im not having a yandere simulator type game 💀
uh oh.
Refresh the event dispatcher call node.
i didnt even know you could do that wtf
thank you lol
alright, its working. Awesome
now im running into the issue of the fact that i have 3 of them, and when i click one, the rest of them dont work.
its due to this logic here
would the best way to fix this just be duplicating the actor bp every single time?
No, you shouldn't need to duplicate the class if it functions the same.
what do you suggest then?
How could i fix this problem? i have to differentiate between the cats somehow
So what's not working exactly?
actually, duplicating the cat actor might be the best course of action for later on. Im looking to impliment a hint system to where a cat meows if you cant find it.
Is the 'found' variable set to false on the 3 instances placed in the level?
not sure how to check that, but if it helps its the exact same blueprint class placed down 3 times. So i assume after i trigger one, the rest become found because theres no current way to differentiate between the cats.
Each instance has its own set of variable values that are unique. Changing one won't affect the others when changing at runtime.
Add a print string to the start of the interact and check it runs on all of them.
no, it only writes on one.
Can anyone point me towards tutorials for editing animations within Unreal Engine?
maybe i dragged the mesh instead of the actual actor?
It could be an issue with the way you handle the interaction itself. How do you trigger the 'interact' event.
It's possible, select them in the level and make sure they're all the actual blueprint and not just the mesh.
interact interface
You might be better to ask in #animation I'd imagine the folks that frequent that channel would have some good sources.
Yea, but how are you calling it.
ahhh
thank you
i have found logic twice which is why i cant interact
alrighty ive got another thing
currently im manually setting how many cats there are. I figured i could use get all actors of calss, and set the actor class to actor cat. From there i could drag out the out actors and use it to set how many cats there are remaining (initally, on event begin)
although i cant drag out actors to cats remaining
is there a conversion im missing?
that way i could just drag cats out and not worry about counting the total cats every time
You can get the length of the array but its useless overhead that you create with get all actors of class, thats dirty
If its really just at the beginning of the game, ok it wont hurt you too much but there are probably still better ways
If you don't want to use the get all actors of class, you can just add some logic to the cat on begin play that would increase the count by 1.
You have to become the purest coder in existence, you shouldnt even use a engine you should use raw c code ...... or even better a pc with punchcards and raw boolean logic as language !
Because there's no need to loop through the array, it's probably the most efficient method to be honest.
Isnt get all actors of lcass doing a loop internally trough them all ?
to spit out that array
Meanwhile me putting references in the game instance because im lazy XD
It used to be in early versions back in UE4 but now it's a hashed map so is actually pretty quick.
The issue tends to be having to loop through them as people might not always understand how many entries it'll provide.
Mhm gotta have to watch the mythbuster vid again
If you actually need to get all of a given actor it's not a bad option, you just need to be wary of needing to loop through them.
Looping through to find a single instance isn't ideal. I've seen that a few times. 😅
This seems like peak programming to me
😅 there's a get all actors with tag to mitigate the BP loop. Lol.
I guess we can't reveal all the secrets. Lol
I wish actors had a default gameplay tag container.
It's funny. I have yet to ever use the loop with break for anything in the entire time I've used this engine.
I used it yesterday to find a specific child widget. 😂 (From about 13)
I have a habit of making functions for my getters like that. So they all just return out.
very curious as to why the default third person character blueprint was changed so drastically in UE 5.7 and why "EnhancedInputLocalPlayerSubsytem" has been seemingly omitted
was it just for general streamlining?
Adding the input context mapping was moved to the player controller I believe.
It could also be seen as a general matching C++, so if you are BP only, you can just add a bool check in that 1 function to prevent all movement for example.
While BP doesn't have access to the C++ function that internally does that.
its definitely cleaner than before
how do I make this overlay fill the screen?
Set the anchor points to the edges of the screen?
I'm sure there's a button that does it for you.
they are
i cant drag the anchor points out any further
I think the sizebox is messing with it but its not a child of it so i dont get it
they are
i think if you have a sizebox it limits them to the size of the sizebox
becuase if I use a different anchor type i can drag it around freely
why is the umg stuff so hard to work with
It's not.
I dunno i cant ever get it to behave
What you have up there won't be affected by that sizebox. The sizebox doesn't wrap it. The only thing that will affect it are your anchors in the canvas slot.
this one? I dont see any anchor options for it
Select the overlay
it seems to be locked to the size of the sizebox even though it isnt a child of it
Uncheck SizeToContent
on the overlay?
the canvas panel doesnt have that checkbox
unchecking it on the overlay didnt change anything
Probably because it has no content.
But your anchors are correct. It's that size because its container is that size. If you want to change the size of the overlay, you need to change the size of the canvas panel.
how do I do that?
Maybe the root item has some preview size setting?
copy pasting the widgets into a new blueprint makes it do waht I want
Did you check the settings of the root item? Or the preview settings at the top-right of the viewport?
nothing seems out of place here
oh if i set it to fill screen the overlay fills the screen, it doesnt in game though
so copy pasting it to a new widget didnt fix it
what Im trying to do is have an overlay that fills the whle screen so I can check if the mouse has clicked off the actual widget
And that is the details of what, exactly?
The root item
Which is?
Well, unless you're adding that widget as the root widget in your hierarchy, it will only fill the area it's given.
No I mean it's the details panel of wb_slotactions in the message I'm replying to
I guess the root widget is the canvas panel then
Its goofy to see some BP graphs from stuff you work on. 😛
(not bad of course, just goofy)
maybe I wasnt very clear about this the other day, but how do I rotate the player to point at the cursor, but on its own local axis?
rotates on world z right now, and I cannot figure it out
Just ignore the bad rotation, seems like the easiest fix.
You don't care about, what is that Roll? So, just 0 out roll.
cook up the rotation as if it was not tilted, then combine rotators to tilt it
that is already only rotating on z
Ive tried with local rotation too, does the same thing somehow
the only thing that gives the intended result is "add local rotation", but I dont know how to do the maths for adding instead of setting
bro put a not instead of using the false
oh thats an actual node, I thought you were just saying to do that
still, no idea what to do with it though
combine rotators
mess with it
Can anyone help me with blueprint math? Given a base value of 130, how can I repeatedly subtract 30 so that each subtraction uses the previously calculated result instead of the original 130
Can you provide more context?
A = A-30?
Exactly as you stated? Can you show the code you're having issues with that is reusing the original 130?
I'm having trouble figuring out how crouch is implemented by default in Unreal BP. Crouch and Uncrouch don't seem to trigger the OnStartCrouch and OnEndCrouch events. Are they supposed to?
Should be fairly simple, start with a variable that holds your original value, then set that variable to it's own value - the amount you want to subtract (in this case 30). Should be something like
Current Value = Current Value - Deduction -> Repeat
yes I had no idea what I was supposed to do with that
but I managed to find a way with add local rotation and minus the difference between current rotation and where it should be
Not sure where to post this, but I think here.
Do you think that this movement system is viable? I made it myself and think it will be easy to change values.
https://docs.google.com/presentation/d/1eZ-U3efKJBMJ4HvnMvbnXCvX7YV4n6nS9TC8diTpXZE/edit?usp=sharing
The end product that I hope to achieve is something like here: https://youtu.be/PHXinBn1pyA
Viable for what?
If it's single player anything goes, you can do whatever you want. Multiplayer takes a lot more consideration.
Do you think it would work for multiplayer?
Now for you the words of every wise developer
The movement in MP is a little more complicated. From my limited knowledge with the CMC the client executes movement, saves some data in batches and sends it to the server for confirmation. If the server movement matches, everything is ok. If not, there is lag or rollbacks. It also does some smoothing and automatic replication of course.
So it depends if you took it into consideration when making your own movement system.
What are you worried about? Lag? You can simulate network lag through the editor
Hello everyone, I've got a problem : I'm trying to make a "Press E to interact" widget show up and disappear when entering/exiting a box collision for a door. The thing is that it works for the exiting part but not the entering one. If it helps, collisions of the FP character are Query & Physics & the collision box of the door is Query Only
Thanks in advance !
Begin Overlap (Widget) and EndOverlap (BoxCollision), is it intended?
Maybe, but if you have to ask...
It'll be hard
Anything is technically possible
I didn't see it I must have done it too fast, thanks !
Not just lag. Mostly if it's going to work. As in whether it's possible for other players will see the movement or not, because I had an old movement system and when playing 2 editors the movement didn't rotate on the other player
Actually on 2nd look here I see nothing going on that can't be done by Character with a bit of extra code
It's basically the exact same as any other character system where you can see the character aim in yaw and pitch
would it be correct that inside an actor i get objects (in the entire level and outside the blueprint actor) with a tag and do this? cause in any case targets are expecting a scene component and a primitive component
you can hide actors
in real time? its just that I want to hide (and disable it case they have some functionality), constantly in case of gameplay circumstances
when I show (set visibility, enable tick,) of the ui, I get this weird artifacts. Does anybody know whats the problem here?
Assuming you mean the goofy grey cube.
You can see, its cuz the shader has to compile.
Are you running a packaged build, cuz a packaged game compiling shaders seems odd.
Thank you for the reply. Its a stand alone mode.
Thats why then.
For the best results use a packaged build, or just the normal play in editor.
I know the explicit standalone has its own shader caching, so it has to compile more, thus more artifacts like you appear to be seeing.
Thanks. let me give it a try in a packaged build
Noob here.. How to send variables to a different blueprint !?
I am building a counter that counts the amount of people I save reaching them to a certain area !
So the collision counter is between a follower blueprint and a trigger box. I have the functions done but how do I send these functions/variables to my first person HUD ?
casting is one method but not recommended. Storing the variables in a gameinstance or gamemode and bringing them might be an option.
How do I do that ?
use get game instance or get gamemode node and cast it and get the variables.
Blueprint interfaces is another widely used method.
You mean I can use that to globalize any variable ?
You could.
I'd recommend looking for some HUD tutorials on youtube, most will give you the info you need to update the HUD. Then you just change the variables for your own etc.
Im trying to make a 4 montage attack combo. It worked fine until my roll or hit react montages interrupts this, making me unable to attack as the variable will still be set to true. I tried to fix this by making the variable false when interrupted and resetting the count, but now when I spam left click, the interrupted is triggered and im stuck spamming the first attack. I can still do the combo but only after the notify is triggered, but I want to make it so I can spam left click while having it ignored as a interrupted. Any help is appreciated
If the montages can be interrupted, relying on delays and notifies goes out the window since they won't be reliable anymore.
One "not so great" fix when the montages can be interrupted would be to reset every other state before starting a new montage.
And why is it breaking when spamming - I'm not sure, hard to ready anything on the screenshot
Hmmm, but you have the bool blocking entering into these montages so an attack shouldn't be able to interrupt another attack.
Just a question, might just be me but why is the attack float set at the end after delay?
Does that originate back to the normal combat anim
hey guys any one have idea of handling the loading screen for unloading a level full of actors and assets and load another level with a lot of actors in it !
i made it this way i put an empty level between these 2 levels to handle this loading process to be able to at least play the loading animation on the widget ! problem i am facing is the loading screen even freezing for short amount of time and i dont like this at all i need to make it way smoother
Are you using level streaming ?
Spawning actors is done on the game thread so it will be synchronous, hitches are unavoidable unless you spread the spawning over time
Starting another montage on the same montage slot will interrupt any other montage playing on it.
I can only assume that your roll and hit reactions are also montages which is why it interrupts the attacks.
I just noticed he is setting the attack bool to 0 on both interrupted and notify, so yeah, if the notify is not at the end, it will be possible to interrupt with another attack
I would move changing the bool from the interrupted of the attack montage to the start of the other montages that can interrupt it. It is not a great solution but it shouldn't bug out at least.
Triggering montages can get complex. A hit reaction for example probably should interrupt an attack montage (and stop the combo), but doing a roll shouldn't be allowed during an attack.
It would look at using a gameplay tag container that could be used to help distinguish the state to determine if a montage can be played.
Hi, Im new to unreal and am having issues calling events/functions between BPs. I have this event in SLAMMesh Blueprint (img 1) which I am trying to call in OSCServer (img 2) but am not seeing it appear. am unsure of the correct approach, as few online options tell me to use functions but that also doesn't seem to resolve the issue
What is the note under the Event definition?
Ah I see, you marked it with pass by reference. But it doesn't work like that with custom events. I wonder if this is also blocking the call to the event, I'm not sure though
Huh wait, but it is the default behavior with arrays. Hm, I'm stumped, that's new
Seems correct, try to unconnect the "player controller" input, it will desactivate every controllers
no i am not using level streaming so i have to use spawn over time ,interesting its like puting half actors spawn at the start the other half could be load while game is running !
Yes with some kind of spawning queue, with prioritization, you can get something smoother
good point thanks !
even like that every controller continue to works... 😄
Why isnt the gameplay cue playing the montage? And any prints i put inside print nothing either
Where are your print ?
I removed them because they werent printing
stupid question but have you got a slot to play the montage in your anim blueprint ?
Ok ! Well I can't really help right now, but any reason why you play that in a gameplay cue ?
not sure it's the safest place to do it
No particular reason, I wanted to play a sound as well in the impact location so thought might aswell do both montage + sound in a gameplay cue (also because never used them before so wanted to learn about them)
I may be mistaken but Cues are more to play sounds or vfx, but not montage. For hit reactions I did it in a gameplay ability
but well, I won't commit to this
well
I did notice that I can only make the animation play if i validate it as the server
kinda wantd to play the animation locally as well
Any idea why it doesn't work ?
You didn’t pass in a controller.
Just looks like you got it confused, like a ton of people do.
if i put the game mode ui only, i cheat in a way
but before to call my function i set the mode to
so why the disable doesn't work... 😒
yes i did juste before, we told me to remove the controller to disable all controller, but resulat was the same
i have also tested with get Player Character
and i'm sure that pawn and character are valid
i check that as well
Ok, so then let’s reset. Lol
Cuz idk any context around this.
Your trying to disable all player input, and it’s just not disabling?
Even with the controller connected.
exactly
but when i call the fonction : Set Ignore Move Input
from the controller, it block the move input, issue is i have also button input.. so i can't use that
that block the movement input but not all other input so that doesn't help
Then what would disabling all input get you?
Then the button still wouldn’t work anyway.
don't understand, can you rephrase?
Oh, I miss-understood.
I thought you said that ignore movement, also disabled your button.
It’s that your button still works.
Get the “controlled pawn” from the player controller.
Getting the 0 pawn, could be pulling a different one, if multiple exist.
i tryied also the get controlled pawn from the player controller
same result
is it because of the new enhance input system?
You can override inputs in your uis
does't the disable input work with the new enhance input system?
I’m actually not sure.
It may not. Lol
But, the it’s easy anyway.
Just remove the input context.
how do your remove the input context?
Should legit be “remove mapping context”, from the enhanced input component, same way as added.
it works but it looks like cheat 😄
because i feel like the disable input doesn't work in fact...
I would’ve assumed it still worked, cuz the input still has to like “go somewhere”
It doesn’t just go to every actor in the world.
i will create a global fonction that will find all player controller, and enable and disable the mapping context for all of them. and i will call that fonction from there it will be better
it works, i will assume the node doesn't work with mapping context
Same way you added it
I'm curious, were have you setup the input action events? In the character?
Into the controller itself
I don’t put anything inside the character
Controller call function in the character but all input are managed by the controller
Ahh, that's probably why the disabled input wasn't working.
You'd have to disable input using the controller as the target and source I believe .
so am I not thinking right but do Actors not have a cull distance ??
I don't think so. It wouldn't make sense for them to. Culling is a rendering thing. So it'd be on the primitives inside of the actors. Actors themselves have nothing to do with primitives except that they can hold a collection of them.
so I've checked and the point light doesn't seem to have cull distance on it either
I spose I can put in my own thing where theres a sphere and when player overlaps with it I do the optimising stuff maybe
That would make sens I will try at home
Character doesn’t have to know the input 🙂
Yes it does. You just said you're calling inputs in it through the PlayerController. You're just adding indirection by not allowing the character to handle it's own inputs. And you're forcing the Controller to have an extra job it doesn't need.
Controller manage the input not the function of the input
What do you do when you add a boat to your game? More inputs in the Controller?
How about a plane? A new set of inputs?
Are you just going to switch on pawn type to delegate these out?
You're adding unnecessary complexity.
Sounds like it's going in the wrong order from an architectural pov
Can someone help me turn my blueprints into c++? I really don’t know how but my deadline is in 3 days
It's really not that simple, but why do you need to convert to c++ ?
Making a school project and the person helping me made logic in blueprints
I now need to convert that into c++
I don’t have to use the c++
I just need the c++ equivalent
(They give no credit for visual based programming)
Are you already familiar with C++ in Unreal ?
Ya I know the basics
It’s just confusing
Like
I was trying to make
This
Hmmm UPROPERTY inside a function sounds off, it should be in the header
Oh I was told this recently I just haven’t changed it yet
But tldr I just need code equivalents of blueprints even if they’re dumbed down
Or just a little guidance really
Not asking anyone to do it for me
Perhaps you should ask in the "cpp" channel
Alr
That's not really the equivalent, since you're not creating the widget(?)
if(WidgetInstance = CreateWidget<CharacterGUI>(GetWorld(),WidgetTemplate)) WidgetInstance->AddToViewport();
Hey guys and good morning! If anybody would help me out here, I would really appreciate it. I am making a widget that allows you to select your voice output and input devices. I am struggling how to "store" two strings at once while using a combo box. I don't wanna use the ID to display the device itself in the combo box (as seen in the fourth screenshot). Since the selected item is the string that shows the display name, I can't use it to change the device itself. I can only use the ID to change the device itself as seen in the second screenshot. How can I have it where I select the Display Name in the combo box while having the ID stored somewhere when selected?
Oh okay tysm
so I have an issue where on game instance I create a loading screen widget when transitioning between Main Menu and Level but because the create widget required a owningobject and at the moment I'm passing in the current world when the main menu world unloads and main level loads the loading screen widget is destroyed in process
question is there any way to get around that or would I just have to recreate the loading screen widget on main level being loaded ??
Hi could someone please help me with this issue. have tried a few options but still quite lost
Don't use the SelectedItem.
For a start save those arrays from the GetAllEOS things.
Get your ComboBox and pull SelectedIndex from it and use that to get the index from your cached array of that type and pull it's ID
Then you can feed the DisplayName to the Combo Box's options.
No the boat have the function he needs for the input he needs. The controller doesn’t need to know which fonction to call, he juste provide the data to the concerned classe and the other will manage the input provided
Do you read C++ by chance?
i can read c++, why?
It was that indeed !!
If you check out APlayerController::ProcessPlayerInput. You can see how the controller already delegates input to other classes when you place input in them. Like the Pawn or anything else.
It runs APlayerController::BuildInputStack which builds a list of UInputComponents to process in that order. The last thing added is the first thing process. So the order of preferred processing is anything that has been explicitly had EnableInput on it. Then the Controller itself. Then the Level Blueprints, and then the Pawn you currently possess.
This is all native and done already. Your PlayerController is already doing this. And you're narrowing all of that down into just the Controller and negating all of this structure that has already been done for you generically.
That's kinda the point of the input actions though. That is the function/event.
It means you can have different characters that use the same input action but handle it differently.
The controller is more for logic that all characters would have. The thing that pops into my head is for thing like opening a pause menu. It doesn't matter what you're controlling, it should function the same.
Technicality. But I'd argue this too. "The controller is more for logic that all characters would have."
It should be for input REGARDLESS of whether you have a pawn possessed or not.
If all characters can have it, then it should live in their parent class.
yes, the controller doesn't needs to know what he his controlling
it's inside the controller, you said that the left part is done directly by the character
Thanks for responding, I appreciate it. But how do I save those arrays in the first place? A variable?
so we can avoid all the right part
hmm so seems issue is when the Main Level is loaded the player is spawned delayed and it seems this remove loading screen widget from screen which I don't want
Yea, this is probably a better way to word it.
Correct. Just right click on them both and PromoteToVariable and hook it up.
Does anyone know why I don't have any root shake patterns?
That BPI is just adding an unnecessary middle man. Just add the IA_Move to the character.
Am I supposed to create them on bp¿?
Yes but when you build an UI controlled by the controller
if you want your UI to be controlled as well by the controller
you have to code that inside the controller
Yes there's a class you can create a child of for it. If you search shake when you go to create a new blueprint it should pop up.
I'm still not sure what you mean.
for example
i press pause menu. How do you controlle the menu with the controller?
you also put the event into the Widget?
i did that last year so i don't remember everything but i think it didn't work
UI uses a different input system. If you set the input mode to UI only input actions don't even fire.
Widgets has its own nav system where it traverses the focus tree. (Granted theres more to it than that) You can also setup nav rules for what widgets it should navigate to when you press the various directions.
Widgets also need to be focusable and hit testable and it works out the box. (sort of)
CommonUI actions. ❤️
I still don't understand how that works. 😅
Like in Atre. Our pause menus have nothing to do with PlayerController. The HUD widget itself listens for escape as a CommonUI action and puts it up. Then the escape menu itself listens for escape as a dismiss key like all other menus do. None of it from the adding of the widget or the dismissal is PlayerController routed.
You have CommonUI for that, it doesn't even use a controller (on the high level atleast)
I'd check Lyra for their implementation. But you can do this with invisible zero size CommonButtonBase buttons in that menu too. Set a TriggeringInputAction or whatever it is on the button and it'll run it's OnClick which you can do stuff off of.
I assume that's the back handler thing?
For the dismissal, yeah.
Don't you just bind input actions manually when the menu pops up? Instead of having a controller and IMC
CommonUI input actions, yeah. Not UInputAction Input Actions.
I tryied multiple time CommonUI and it was not working as good as espected.
So to be able to easily manage screen without CommonUI the things was to put the management into the Controller
Yes, FUIInputAction (IIRC).
It's a learning curve above simple UMG's, worth it though.
would you kindly tell me which one it is?
Hey, Thank you! It worked for me. I was able to get it working after thinking for a bit how to pull the index from the get selected index.
Oh my bad, I was thinking of the camera shake base. 😅
What you need is the 'UCameraShakePattern' class. You should have 4 by default though.
It doesn't look like it's exposed to BP.
Is this something you have to do in C++ or is it exposed to BP?
I'm almost positive it's C++ only, i was mistaken though. It's FUIActionBinding.
However, it's just one class you have to make with 2 functions for add and remove (in order to make it usable in blueprints).
Maybe its one of the pieces I've been missing. I've not done much with commonUI from the C++ side of things.
What are you struggling with?
@white parrot@dark drum This is what I meant by the invisible 0 size button. You can use them to fake triggering actions in BP only without doing manual C++ binds.
anyone able to help at all, I'm trying to have a loading screen widget be peristent across level transitions at the moment main menu into main level. issue at moment is when the main level loads and the game mode calls the temp pawn to be spawned it's removing the loading screen widget before I've had chance to manually call for it to be removed
Just wrapping my head around the whole input actions in commonUI in general. I can never seem to actually get anything to work.
It's not something you can do in BP only land as far as im aware.
I guess that's one way for a Designer/BP-Purist, didn't really take a look at how Lyra does it in-game yet. Also I'm trying to avoid BP's like the plague.
so my loading screen widget is a cpp class and its being created and removed on Cpp side
I'll ask in cpp
IIRC, you could use a manager, which is a GameInstanceSubsystem (which is kept alive during level streaming) and would control the widget.
If I was to take a guess it's most likely because the player controller that owns the widget gets destroyed (during the transition) which means the widget would get removed as well.
I never thought about creating a widget with the GI as it's owner. I might have to give it a test.
Edit: Owner requires a player controller. 😅
so it's the game mode causing it cause when it creates spectator pawn it's clearing all widgets from what I can tell
even is widget owner is the game instance
arr so even though it's not moaning about the GI being put in as owner it's not gonna accept it
I think Lyra has a decent example of adding those.. trying to recall where
Pretty sure the owner can be GameInstance
issue is though how would I keep it from being destroyed. Only idea I can think of is I get GM to call GI to create the widget
@dark drum
static_assert(TIsDerivedFrom<TPointedToType<OwnerType>, UWidget>::IsDerived
|| TIsDerivedFrom<TPointedToType<OwnerType>, UWidgetTree>::IsDerived
|| TIsDerivedFrom<TPointedToType<OwnerType>, APlayerController>::IsDerived
|| TIsDerivedFrom<TPointedToType<OwnerType>, UGameInstance>::IsDerived
|| TIsDerivedFrom<TPointedToType<OwnerType>, UWorld>::IsDerived, "The given OwningObject is not of a supported type for use with CreateWidget.");
might have found the solution on google and it might stem from the function AddToViewport Function
hmm no still having the issue, i really think issue here is the GM is removing all widgets or something like that
Yea, I was having a poke around myself. The create widget BP node only has a player controller input and if one isn't provided it tries to get the implied player controller so i'm not sure there's a way from BP.
Although Ryan has states its defined in C++ so a none issue.
let me query in cpp channel as its starting to feel like it's a thing that can only happen with cpp stuff
Using the PC will get your the GameInstance anyway afaik
hello, I have an issue with my conde handling damage.
My NPC is supposed to chase the player when he receive damages. It work when I press W ( for debug purpose ) but not when I fire with my weapon. The generated event are the same.
when I fire with the weapon, the code goes to onFail on the AI Move to . I checked the Pawn and Target Actor and they are correct
so i've done a callstack thing on cpp to see if it's points to anything useful, the attached file is what I got
i found the issue
I forgot I put that on my game mode ages ago and well it turns out it was being called all along
I know many people use the Async Loading Screen plugin for this. Do you mean you managed to make a level transition loading screen in blueprint? Does it also animate without stalling while levels load in background?
yeah it's working how it should now
it was all down to the face my GM was running a 5 second delay on begin play and then calling the loading screen remove function. I forgot I added this so weren't until dumping stack I can see the load screen unload function was being called by GM
Usually. Under normal circumstances.
Widgets can be owned by the GameInstance or a World.
90% of cases a widget will be owned by GameInstance. ONLY the cases where you pass it an invalid controller or a non local player, or a world where there is no GameInstance(editor utilities), will it be owned by a world.
This has nothing to do with the owner.
There's an override in...
it's fine I managed to sort the issue
it was me forgotting the function to remove loading screen was being called elsewhere
Still. If you haven't I would make sure to add it to the viewport client directly. Using AddToViewport or other UUserWidget calls makes it managed by the subsystem.
This is from the CommonLoadingScreen plugin as a small example.
// Create the loading screen widget
TSubclassOf<UUserWidget> LoadingScreenWidgetClass = Settings->LoadingScreenWidget.TryLoadClass<UUserWidget>();
if (UUserWidget* UserWidget = UUserWidget::CreateWidgetInstance(*LocalGameInstance, LoadingScreenWidgetClass, NAME_None))
{
LoadingScreenWidget = UserWidget->TakeWidget();
}
// Add to the viewport at a high ZOrder to make sure it is on top of most things
UGameViewportClient* GameViewportClient = LocalGameInstance->GetGameViewportClient();
GameViewportClient->AddViewportWidgetContent(LoadingScreenWidget.ToSharedRef(), Settings->LoadingScreenZOrder);```
yeah I changed stuff to use the one above after I did some googling and thought that was causing my issue and turned out it weren't i've left it in though cause it don't do anything bad so
This plugin is actually not the answer to that. It can also cause crashes on some systems because it uses the movieplayer.
The real answer to this is to learn to initialize your gameplay smoother over more frames and not hitch your gramethread.
How would you guys delay a function by 0.1? I cannot use delay inside functions and set timer even does not allow input / output to be passed
i mean i could save the result to a variable and use that but eh thats not the cleanest
its currently in my event graph which work fine but just wondering if theres a way thats more tidy
As long as you're only calling it once and you don't expect it to be re-entered, you can add an event to the main graph and have the function trigger that event. That event has a delay which then triggers another function after the delay.
It's a bit meh, but workable.
Ty, that sounds very clean actually
Also just on a side note. why don't functions allow delay inside them
even abilities allow delay nodes
I can't remember if I ever actually tried this btw.
I hope it works!
Might be because it doesn't want to save the scope of the function. All the local vars and such. On a potentially "infinite" amount of function calls.
They are synchronous, have to return instantly
Strange question, but has anybody experienced a large frame drop (120+ normal, 80-90 with drop) if they hold down their left gamepad joystick when pressing play for PIE? When I trace, I see an extra 4 ms taken by a GameThreadWaitForTask, which only shows connections back to FDeferredShadingSceneRenderer_InitViews.
My joystick has a pretty bad deadzone so it was happening without me realizing it. I've found if I stop, reset the joystick, and play again, my frames go back to normal. I can't correct it in PIE though, once it's started it doesn't seem to recover until I exit PIE.
Huh, if I detach/reattach from the player I can trigger it as well.
I'm guessing that the view is still being moved in the editor (even though that window is replaced by PIE), which is slowing everything down.
For components on the same actor is it generally considered better to communicate by interfaces or by references if necessary with casting? Or is it still a case by case basis? As far as I'm aware since they are on the same actor they are loaded into memory with it so the casting memory penalty does not apply but interfaces might still be more modular, maintainable, and I#m not sure which is more perfromant.
An interface is for when you have different classes that don't share a common parent but need to have/implement the same set of functions.
I see. One thing that I was considering was that using interfaces seems to be more maintainable/modular. In the example below using the interface the actor can have any number of movement dependent components (could even get them by just getting all actor components if that is cheaper since message can silently fail) and removing or replacing one wont break anything while with the references if you remove one component the code breaks and when you add/replace them you also need to update the code manually. But I'm assuming the reference example is still common practice due to it being more performant?
Use components
these are components
From experience over using interfaces will turn your project into a mess. Making changes can become a nightmare, sometimes making it difficult to find bugs.
You need to lean more into hierarchy and have a base class for your movement component. This would have the core functionality that all movement components should have.
Just to add, you can still use the 'Get Component By Class' from the owner to get a specific component.
Also in your interface example, the interface is pointless as the node you use to get all the components already returns it as that specific class type. That class should have a function that all children can override.
Use them instaed of casts and interfaces
If something depends on something else, it 'should' have the dependency. Trying to mask it will come back to bite you eventually.
Or proper hirarchy i guess, but these whole inheritance isnt all that great anyways
Inheritance is great. You can't build a scalable system without.
The unreal engine version of that atleast in bp are components
I dont understand what you mean by "Using them". How do you "use them" if one is depenndent on another without communicating between the two?
Get owner - get component by class - select new component
i see, though wouldnt that just internally cast to the component then anyways?
Yes but casting to the component is fine
they are not heavy
Casting to a actor is aslo perfectly fine btw
So proper inheritance can be used for that too like pattym said
If you make a really lightweight base class with a few important buttons and only cast to that - thats perfectly valid
but the cast like you have it in your picture is kinda problematic
You are casting to a specific class of something down the chain, usually that has funny stuff attached to it like animation vfx and whatnot
so a lightweight base class for the actor that would always have those componets?
If the thing your casting to is very light the cast isnt too bad
just try to decouple what you can
Cause the movement component in the actual project is provided by a plugin that handles movement replication and predictionn so I cannot really modify it but it has some events that need to call other components evennts like that of the shooting component.
I tend to use an actor component and custom uobject combo.
The actor component manages custom uobjects which I normally create a base class for and then create children from. This would have the core functions that the actor component would call.
The interface on the movement component makes no sense to me. Unless you plan to implement it on multiple classes it's just sticking a middle man in between the function call.
Considering you can't change it, the first option where you just get the actor component would be the better option.
So if I understand correctly you'd have a single actor component let's call it "SystemsManager" and then some UObject that has some basic implementation of what a System needs to do from which you would inherit more UObjects that then implement each system like Movement/Shooting/Abilities etc? Or am I getting it wrong?
I was just speaking generally. Id need to know more about what these 3 things are to know if it would be a good fit.
If it's like an abilities system then yea, it might fit. It's pretty much how GAS works.
Alright, thanks for the advice!! I definitely see the unneeded middleman aspect. I was mainly considering since it would allow you compeltely swap out say the shooting compoent for one that works differently and still function while the references would break if you did that but I see now that inheritance is the better way to go about it by having a base shooting class that you call to and then creating a new child if you want different logic
As another example, 'DialougeManager' would be a component, then it would manage a custom uobject 'Dialogue'. You can then easily change the dialogue how you like by just creating a new child of the dialogue class.
I've done an interaction system where the component had a 'focus response' object that I can swap out to change whether it should do an outline or change the material etc... and then an 'interaction event' object. The main interaction system comp knows about these base classes and manages them by calling the core functions.
makes sense, thanks for the detailed explanation!
Hey is there a node to do that but with custom enumeration?
It's just called 'select' and has wildcard pins.
ha but not based on the boolean
It can be.
yes?
Yea, you should be able to connect the enum to the selector pin and it'll automatically create an option for each enum entry.
thanks
Hey wait, why can't I override GetOwner in an ActorComponent?
Because you can’t?
You can’t override everything in BP
That means there's a way to set variables as Final, how do I do that?
More info?
Set as final?
In C++ and other languages, final is a keyword that means an entity cannot be subclassed
sealed in C# I think?
They made a language that was supposed to split the diff between C++ and Java, and then ignored both and made a new keyword lol
I believe you’re thinking of “private”?
Doesn’t let child’s overwrite it IIRC
But honestly never done that in my BO.
So BP may simply not have access to to do.
Wait what. That's not what private means at all but the tooltip agrees with you!?
"Private" is supposed to mean that the variable isn't visible outside the class
Pretty sure it’s offset by 1
Private is locked to that class.
Protected is child’s can mess with.
Public is everything can mess with?
final is supposed to be "Subclasses can see it, but not override it" where private is "subclasses can't even see it"
Oh, ok.
Then, yeah.
I don't think BP supports that in anyway from my understanding.
Its either read only, write only, or both, or neither.
From a quick lookup C++ does support that.
But, given BP is an extensions of C++, it doesn't seem like it would be of much help, if you can't ever actually change it in BP to begin with.
Since, C++, and BP specifiers are unique.
C++ final doesn't stop BP, and BP's version of "final" doesn't stop C++
True but SOMETHING is putting that final in a BP class such that I can CALL "GetOwner" but can't subclass it.
Thats a BP specific specifier.
Preventing implementation (thus can't override), and only being marked as callable
Looks like C++ is the same, but not with the final keyword.
Its just not marked as virtual
I also think overriding it, would confuse the hell out of the engine.
Since, code owner, and function ower would differ, and probably have a stroke.
can somebody help me
im new to game dev and idk how to code an ai that chases you while music is playing
i dont wanna do patroling because im gonna use my ai for chase sequences and stuff
Hey all, looking for some advice or help. I'm new to using Blueprints and am having issues accessing a variable from a component tied to a character from within my widget blueprint. I added a screenshot of current implementation, this works just fine when I hard code a variable (Num Slots) and attach my Event Pre Construct to that and then to the loop but this new way doesn't work as expected. Any thoughts?
Hey, does anyone know how to set up a Combobox(string) to Anti-Aliasing? Ive tried currently for 2 days straight and cant seem to get it to work. i can either get it to be off or on, but i haven't managed to set up a sequence where you can toggle between AA methods and have it work.
Execution is stopping at that first cast
Also you don't need the first cast anyway.
Get owning player returns a playercontroller, you can just get pawn from it.
so basically you're saying do something more like this?
Alright for those that care, I found a different solution. Instead of messing with blueprints I made a new base widget class for my Inventory system and just created a BlueprintImplementableEvent that takes the variable I needed and is called in my Player Controller class when inventory is toggled. So I'm left with this in my blueprints instead now. Feel free to tell me this is good or bad , always learning.
Not fully following the question. Are you changing the engine's AA settings using a combobox or are you trying to add AA to the text in the combobox?
I think its best to either let the player controller or a own Ui manager component handle control over ui's
What you should not do however is put any code into widgets that is not directly needed to display or control anything in the widget
The combobox contains 4 buttons, one is Off, the other 3 are the types of Anti-Aliasing methods such as TAA. By clicking one of them it changes the method that the engine uses, if you select Off then the jaggies come back, if you select TSR the jaggies go away. I can get the combobox to show the list and I can select them and press apply with my settings apply button, but it doesn’t work because the blueprint sequence isn’t correct as I can’t figure it out.
Can you show what your current logic is atm?
How is it possible to open a level over more frames? I thought we just had the "open level" node and not much more control over that
As far as I'm aware opening the level isn't async. (hence why the game stalls if its a big level) However, you can change how you load its contents via level streaming, level partition, etc...
The idea is you keep the core level as small as possible so it loads very quickly and then let the other stuff do its thing. Depending on which above techniques you're using, one thing I've seen is using different maps/levels like layers that get level streamed in, leaving the core map pretty empty. They have the main stuff like terrain, large buildings and big features load first and then stream smaller stuff in.
Adding to this, you can frame slice your own logic, so if you need to spawn 1000 actors as soon as the level loads, do 100 over 10 frames instead. (arbitrary numbers)
Just because the level has loaded, it doesn't mean everything is done. You'd be surprised with what you can hide with a half a second fade from black. 😅
So much in gamedev is just smoke and mirrors haha
Ohhh what a cool cinematic fade in effect when you start the game - in reallity you need a bit to load all the stuff
Or these sequences where running is disabled while your character is walking and talking in a long corridor
Don't forget about tight spaces you need to slowly squeeze through. They carry AAA level loading all by themselves
out of interest if I have a static mesh inside of an actor and I disable tick of said actor, will that mess with the optimisation stuff the UE will do ??
or will that all still happen and would it purly just be stuff I put into the actor on tick event won't fire
Why would anything else be running on tick besides your own code?
The code from the actor class
Essentially just wanna make sure all the optimisaion stuff still happens even with tick disabled on the derived actor object
What optimization stuff?
Does the parent class have code it runs on tick? Or is it just an empty Actor
Like actor not being rendered when player cant see it and being out of range of it etc
So essenitally i have a master wall derived actor
Which is empty and then i have my various wall meshes in a derived master wall actor etc
On master wall actor i have tick disabled
And just wanted to check by doing so it wont mess with the stuff UE put in place like actors not being rendered etc when not in view and player not in range of them etc
I assume its only local tick that would be affected by disabling tick on the actor
Pretty sure, just none of that stuff is handled on the tick you can mess with.
There in different render ticks, and networking ticks sorta shit
can someone give me 5 beginner projects to make over the course of 1 month
guys how do you" clean" an array? Say we got an array that returns
1, Invalid value
2, Invalid value
3, valid value -> this is what we want to use
4, Invalid value
The completed pin in a for each loops fires all times even if we have a valid value
the completed pin fires once youve looked trough the entire array
Copy correct values into temporary array and set old=Temp
If you know what you're looking for.. use a break?
No, since the first item is invalid it jumps ot the completed pin straight up
What do you mean by invalid value?
a value that is not valid
Just make proper logic to check validity in loop body
What do you mean increase it by one?
For each loop with break -> array element -> isValid(value you want) -> break?
He can't break if he want to clean array
Just is valid>add array element to temporary array
Its just odd that the loop returns when it hits a invalid value
why is it odd?
how do yo ucheck which value is valid?
Because i dont think thats how its supposed to work, but i cant remember for sure
IsValid
Because it doesn't, it just loops through all of the items
yes, on the loop body pin
so it doesnt fire completed .....
Untill it looked trough all array elements
No matter if they are valid or not
I just tested it with a empty array / 3 invalid elements
Let me guess, it's inside function and return node connect to loop body
No
its in a plain event graph
Screenshot it please
no external factors, just the array has invalid elements
its just a plain and simple for each loop node
But how your validation logic works?
And what object? Actors?
Do you get console error for access none?
thats what im trying to figrue out, i dont have validation logic yet
how would you remove the invalid eleements
Use IsValid node
from the array
Told you earlier
If you know their indexes, remove in place. Else, copy only the valid ones to a new array.
Use temp array to cycle old array, Validate and set old with temp array values
Are these pointers to objects? Is that what the array is holding?
ok how you would valid check a float, ignore the struct for now?
the float can be any number
What do you mean verify float?:D
I'm not sure where the issue is screen-shotting your logic, but if it goes straight to completed means your array is not initialized
That depends on your system. What is the float for?
it prints out the values though? How is it not initialized
What?
why does it matter?
Ok, I ask simply. HOW do You know it's not valid?
because it jumps straight to on completed
Hey peeps, I need a little support if possible. I've made my UI Widgets, and all of them work fine in PIE and Standalone play. But as soon as I package the game there are two widgets which refuse to work.
- Crosshair
- Interaction Prompt
Is there anything special that I need to do to get these to package and work properly?
All of my widgets are added the same way in the PlayerController, and then the crosshair is updated in the FPSPlayer at BeginPlay. But this does not seem to actually change the crosshair at all in the packaged build.
Same with the Interact prompt, this is updated to visible/hidden whenever the player looks or looks away from something that is interactable, but this doesn't work in the packaged build.
I've been racking my brain for a couple days so any help is super appreciated...
because the very first item is an invalid value
if it would be valid, it would fire on loop body pin
How invalid? How do you know? It will jump only if there's no array value, for example you remove value or index while looping
yea there is no arra yvalue essentially in the very first item
then theres my valid value in between
the invaldi values
But you said it prints the values, and also jumps straight to completed?
Yes
If your float is used for alphas, it can be defaulted to something like -5.0. So your IsValid can be as simple as an IsInRange check for -1.0 to 1.0
If you float is meant for world coordinates, you set it to a max float value and check if it's that.
It's just a number, and the use case of the number determines how you create a validity check for it.
there you go
IsValid doesn't work for structs
homie that is an object
What happens when you print the array? how many members?
So you are looping trough a array of structs ?
He does
Wtf ....
4-5
idk exactly
This conversation becomes more and more confusing by the minute.
You have to break struct and verify by your criteria
it doesnt matter
because it will jump straight to on completed pin
which is not the proper behaviour
Need more information on this. How do you pick your crosshair image, and how is that text set in your logic?
If it prints 4-5 of them, that means it does not go into completed straight away, but loops over all of them..like it's suppose to, I'm not sure what you're struggling with, instanced structs do have IsValid (unsure if BP-reflected)
Do you use anything that's engines? Assets
its not bp reflected
Crosshair image is controlled by a function called at BeginPlay and whenever the weapon is swapped
The text, I'm guessing you mean the interact prompt is updated based on a line trace, if it hits something that has the "Interactable" tag
Nothing used from the engine as far as I can tell
Can i make like a new array from the original "flawed" array and only save valid values?
Mm, cast on tick. Anyway maybe just try to switch cross hair on demand and pass struct with images that's inside weapon class
And I'm understanding correctly that the image you're seeing in packaged is a default or different image you intended to use and isn't updated correctly for the weapon you have?
Casting on tick is fine. Don't do that.
The crosshair WBP is just two images that are exposed as a variable, and used in the ChangeCrosshair function
The images aren't different, but they are both being shown at the same time. I have no reason to assume that the code is broken as it works in PIE/Standalone, but the images visibility is not being updated properly in the packaged build
I'm not certain for the interaction widget. But the crosshair makes me assume order of operations.
It is fine? How so?
Better question. How is it bad?
Are you aware of what it's actually doing? Why is doing it on tick bad versus doing it at beginplay?
becasue it casts each frame thats useless overhead
Instead you could just cast once then do a validated get
And are you aware of what casting actually does?
Yes???
it wont cast it again if its loaded into memory already
No, you're not. You're repeating things you've read somewhere and it's wrong. There is no overhead to casting.
So much you know about me from 2 messages
Awesome you must be a great mind reader
once you cast additiona lcasts of the same csat will cost 0
Hmm, order of operations. Okay, I can try to initialise the crosshair first by delaying everything else hahaha
my problem is,i want to trigger a different logic on completed, but not always
So branch off from the completed pin based on the logic
Casting, like ANY other pointer type causes linkers. This is not a runtime cost, this is a memory linker cost that keeps thing's classes loaded. This has NOTHING to do with runtime calls to a cast node. You can cause this without a cast at all where there is just an empty pointer to that type and ZERO cast nodes in the entire blueprint.
Cast nodes just also cause this because they have that output type.
A cast nodes EXECUTION is literally nothing but a pointer conversion and an if (Object) afterwards.
The act of casting a pointer is essentially free. The if statement costs more at runtime than a cast does because again it costs nothing.
Lets just do a typecheck every frame, why go for the better practice and do it once? Nah lets shove useless overhead in
Yeah, but if it jumpst to on completed all times, then it isnt really a branch
You're aware that a validated get or IsValid node is actually slower at runtime than a cast node, right? Because it checks more things?
Could you show your code at what you're doing that goes straight to completed, it feels like a guessing game honestly.
😆
I know how the node looks, i mean in general what's going on.
how about IsValidLowLevelFast
but the tricky thing is, sometimes 0 can be valid
so i cannot elimintate 0 all together
What is the whole purpose of this bro god damn
Show the entire graph my guy
Loop body?
yeah it will also trigger loop body
A cast does a NULL check, then a typecheck
A validated get does a null check
Why it's not connected?
a validated get does an isvalid check, which is different and more costly than a null check
I believe
entire graph is irrelevant here its just this array is screwed up that i want to clean up
But not more than a typecheck
I'd be very surprised if validated get does a simple if object
Ah guess in both cases it doesnt matter and the difference is probably negligible
It jumps because it do the loop which is NOTHING
yeah
You don't think it's a problem?
i definetly think its a problem
thats why im here
So... Why don't you have anything in your Loop Body then?
Order of operations worked for the crosshairs btw, thank you kindly
because it will jump to on completed
even if i have loop body connected
since the first value is nothing
Can you just show us the whole graph so we can understand better what is happening?
It might act weirdly if you set for example index 2 skipping 0 and 1 in empty array
How do you initialize an array
Buy still it shouldn't and should contain default values inside struct
I fixed the interaction thing too
Authaer solved both things with one stone without even realising
I moved the interact widget initialisation to the beginPlay of the player and somehow that worked
I really have no idea
genuinely
PIE and Standalone was just gaslighting me into thinking it was all happening at the right time I guess
The OnTick update wasn't the real problem I suppose 
But thank you again, I can now carry on getting this game jam finished 
Oo. Game jams. I should do one of those again sometime.
It's been really fun actually, I love rapid prototyping things
This is the one I'm doing in my downtime from Work and Uni: https://itch.io/jam/cybrpunk-jam-012
Although my deadline is tomorrow because I'm travelling away for the Christmas period
Sorry for the late reply, I was asleep and had to do a few things this morning.
I'm very new to blueprints, but I badly want to learn to be good at this stuff. this is what i managed to throw together after doing some research from any sources i could find, but i fear that ill have to sit down and memorize every thing else before I'm able to make this work. I know they are wrong, which is why im here hoping someone can tell me whats wrong and how to fix it. if its all wrong then id like to know the proper nodes to use.
the left is the Settings widget variables and event dispatcher and the right is the graphics widget variables and event dispatcher focusing on the Anti-Aliasing.
Wheres the part where you actually do anything to change the AA method?
I dont know, thats why im asking of anyone knows the correct way of doing this. i dont know what im missing. I know im missing the part that actually changes things, but i dont know what that is called/what im meant to grab. Its like knowing i need to grab a rock but not knowing what type of rock, is it granite, or basalt, etc.
Isn't changing the AA just a CVar?
sg.AntiAliasingQuality <num> if i recall
so this node? are there any sources you know of that i can read to tell me what to use this with? such as telling me what to inject into target or the return value?
Its a CVar, you can get it's value, or set it's value
There are 3/4 levels of AA, excluding 0 which is off, that's all there is to it
Yeah i know about the Off, FXAA, TAA, TSR. I just didnt know about how to make it all toggleable in a combobox. ill go do some more reading regarding CVar and then tinker around and ill get back to you on my progress. Thanks for helping.
Well, in theory, user presses/toggles from off to AA1 -> SetAntiAliasingQuality(1) (or call the CVar directly)
Btw is there any Udemy courses any of you would recommend i get? This is currently what i have.
@slim lotus
yeah?
example
these hard coded values, but you can simply use it once and use your variable
Thank you thank you. i will go off and memorize this.
eee
#nvm this select xDDD
i just asume if you text values
but you can simply just set int inside dispatcher and just pass int instead of text
How do i link this up with a combobox? do i do a switch on string? then branch off into the low, medium, high?
Although it's better to broadcast all of the settings change into one place, valid yeah
if you have child widget of main setting UI just use its dispatcher to get event on click. then pass what to do depending on button, there's many ways to do, try to make it work, I wouldn't focus on cleanses of code now, not too much at least
Okie, im trying to trial and error this so i can both make it work and understand this all. ill let you know if i make it work. 🤞
you have 2 dispatchers there, but you really need only 1, inside widget with button
i have one in the settings widget and one in the graphics widget, the graphics is the "OnPendingAAMethodChanged", the settings is the "RecievePendingAAMethod" since the Settings widget is the parent to the graphics widget as im using a widgetswitcher in the settings panel.
this receivepending.... is not necesary i think, but you might want to use it somehow later
How do you get the angular blueprint wires btw? Is it a plugin of some sort? :o
yes, electric nodes
electronic
Okie, ill refrain from using it until it is needed later.
Are there any plugins youd recommend i get?
and AGR V if you deal with animation blueprint etc, but its not necesary, its just good and speed up things if you already know how to setup certain things with blueprints
just dont spend too much time on tutorials, try yourself, if you want to do something just try searching for node and connect things
What does the node graph assistant do
auto connect pins, quic cut all links, wait, ill show you docs
Sounds useful, thought it was the 5.7 AI shit
I got em all
Hello everybody ! I'm trying to make an object that reacts to light when being cast on it (a puzzle game with a moon and the moon light activates some pieces of a puzzle) and I can't quite find some ways to do it, does anyone has an idea ? Thanks in advance !
Actual light in engine? Very hard to do
A trace from the thing to the light source to see if there's nothing in the way is much simpler.
You basically have no access to the actual lighting information for gameplay purposes so you'll have to effectively make your own system.
Make overlap sphere that collide with light actors. If detected ray cast towards light actors with custom trace channel, use visibility as blocker
Can anyone tell me why does "ai move to" give out a fail pin when i click my unit to move to the center of top side of a square mesh, but when i click anywhere else on the cube, it goes to it normaly?
Any ideas why activating physics on begin play or construct isn't working?
its for an item pickup, so I want it to physics interact with the environment but not the player, but still overlap with the player. Thats why ive got a physics collision with a player overlap collision as a child, I had trouble doing both with one collision
actually it works on construct but only for the server, afaik you dont need to replicate physics?
Seems like it isnt
looks like collision enabled is overriden when I run the contruction script?
its enabled by defualt
As an FYI, if you want physics items, you'd normally need to have the thing that simulates as the root of the actor. If it's not, it'll simulate in local space which can give undesired results.
ah that probably explains why it spawns in the wrong place when i spawn it via the client
Also, make sure you update collision before enabling physics. If it has no collision, enabling physics will fail. (Normally logs an error)
If you're doing multiplayer, you need to make sure the component is set to replicate as well.
thats what I did. Only issue ive got now is the actor always spawns with an offset on the client, no matter if its the client that calls the spawn rpc or the server
Is there a way to override the scene root in child classes?
if I turn off component replicates it spawns in the right place but without physics
make the root component of that actor the thing that's simulating physics
physics replication relies on the root component being the thing
yeah i just tried that myself and it worked, problem is this is a child class so i cant set it as the root component
then change it in the parent
What's your goal here, why do GatherPoints have physics?
setting it as root in the construction script doesnt work right? or did i do it wrong?
don't do an RPC on begin play
What's your goal here, that the thing just starts simulating physics asap when it spawns or the map is loaded?
i got this part working, the defualt collision was set wrong
nope
you shouldn't have to do anything in construction script and CERTAINLY not an RPC
begin play happens everywhere. If the goal is that it just starts simulating physics just do that
begin play -> set simulate physics
goal is to be able to toggle if its enabled or not. Items on the map I most often wont want to have physics, items dropped by players I do want physics
the act of dropping should be when it's set
is a dropped thing a new actor spawn or the same actor but just detached and dropped?
new actor
just expose a bool or have the dropping code in the char set simulate physics.
its enough to just set actor replicates?
spawning a replicated actor on server will spawn it on clients
Dropping an item should be like this:
Drop input -> run on server event
run on server event -> look at HeldItem or whatever -> spawn the item
inside your character or pawn
right but when a client spawns it wont spawn on server
yeah thats what i was doing
Inside Pawn:
Client:
input -> run on server event
Server:
run on server event -> ??? -> spawn thing
Inside Thing:
Begin play -> set simulate physics based on bShouldSimulate or whatever
I need a bit of help again. So i understand the AA quality, however im trying to set up the combobox(String) for the AA Method. i believe i need to use a "Execute console command" node, but im struggling to understand if i use a "switch on string" or "select string" node, or if i need to have multiple "Execute console command" nodes.
can't you combine strings together?
begin play doesnt trigger on spawn though does it? only on begin play
it does
spawning is when play begins
begin play runs on begin play, on spawning, and on becoming relevent
oh nice
if you need to gate something by server or not just branch on HasAuthority
could you elaborate on what that means? do you mean like in a chain? having one after the other? do you mean like this? but what does that do?
you can combine "r.AntiAliasingMethod " and "3" into "r.AntiAliasingMethod 3"
Posted here a few days ago but managed to fix my combo, not the best fix though since there's a half second between attacking and dodging where i can't do neither. But it's my first time making this. Ive heard from someone I can do gameplay tags or make an array but im not sure how to implement either of this
don't use a delay, use the montage itself
nvm, delay might be fine for the combo reset
show what dodging does
That's certainly cleaner
you could also just have a notify that represents when to reset attackcount
Does that mean using more than 1 notify on montage?
Any advice for profiling the performance of a particular blueprint? I've gotten as far as I can with insights in C++.
Im using one that'll make me do another attack before that montage ends
Short of putting scoped events on every C++ function it calls.
WHat's the BP do? This is in tick most likely, right?
Not really sure how to and also the attack count doesn't work at all with the cleaner version
coming from multiplayer if i change a blueprint's logic, but i have that item class maybe loaded from a past save game, and i load into the game witht hat blueprint that i just changed, will it's logic be updated to the blueprnt changes that i've made? im almost 100 percent sure that it SHOULD be changed, but im baffled at what is happening rn
Yes the logic will be updated, however, depending on the changes, the data itself (stored in variables) might not be compatible which might result in unstable results.
ok , might just reload this particular item to check. but yea i changed an "ammo" variable and somehow it is using a completely different varaible that is not hooked up at all (this was the previous logic), and there is nothing connected to that old logic, so makes zero sense why it would be giving me the value it is
Now im stuck on scalability...
Scalability is the same thing. It just has specific functions for each of them in the GameUserSettings.
is this not it?
I would also recommend not going with a switch on string. But uh... sec
Do something like this. Much easier to repeat.
And when you get to localization, your stuff won't break because your strings change to Korean.
EG
For your AA
okie, but i got 3 graphics quality levels (scalability), low, medium, high. hence the switch on string so i can toggle whatever i want from the combobox.
Right but you don't need the string. It's an integer level. And there are 5 settings total. 4 if you want to leave out the overbearing Cinematic.
The FXAA and TAA work but the TSR doesnt.
Ah right cause..
Yeah. MSAA is in between them. You'd need an integer converter map to do that. You can also do a switch on int instead though.
Primary point is just to avoid the string switch that localization would break later.
- AAM_None UMETA(DisplayName = "None"),
- AAM_FXAA UMETA(DisplayName = "Fast Approximate Anti-Aliasing (FXAA)"),
- AAM_TemporalAA UMETA(DisplayName = "Temporal Anti-Aliasing (TAA)"),
- AAM_MSAA UMETA(DisplayName = "Multisample Anti-Aliasing (MSAA)"),
- AAM_TSR UMETA(DisplayName = "Temporal Super-Resolution (TSR)"),
- AAM_SMAA UMETA(DisplayName = "Subpixel Morphological Anti-Aliasing (SMAA)"),
This doesnt work. i dont see any visual change in graphics quality.
unless it wasnt meant to be for that...?
I can't recall if that needs uhh.. What was the GUS thing. ApplySettings?
ApplyNonResolutionSettings, or something like that.
No, that should do the same thing as the scalability console command.
this requires a target, but i dont know what target should be inserted?
GameuserSettings, same as your ApplySettings you're already calling.
I just checked that and it 100% applies those scalability settings.
oh... yeah i should have known that.
ApplySettings internally calls the ApplyNonResolutionSettings though. So it shouldn't change anything.
yeah i dont see any visual change. the shadows are all still high.
So for some reason this code is returning false even though the hit actor does have the tag
I have a vague memory of having problems with this in Atre a while back with scalability stuff, checking through what I'm running at the moment.
Nothing else would cause that. Get your HitActor's Tags array and maybe print them to make certain. May have tagged the wrong instance or is that class defaults?
class defaults is where I've done it
I'm not sure then. :/ Our code in Atre just sets the overall quality setting. The Scalability console command may work too if it saves it to the settings somehow. Could test with a cooked game. Editor does some weirdness with settings sometimes.
Guess ill just have to power on and tinker for a while.
If i have a selected actor in debug dropdown box and set the tag array with the tag would it only do it on that one instance ? Thats all i can think would be reason for my issue cause i defo set it on class defaults
I don't believe so. That is just for debugging stuff if I'm not mistaken.
The only way you should be able to set one actor instance's tags is through the world outliner, playing in viewport and ejecting to select them.
At runtime anyhow. Or doing it in the world details panel while not playing with them selected, either way.
You're 100% sure you're hitting that class with the trace?
Pretty sure i am yeah, ill do what you suggestes tommorow though printing the tags and hit actor to make sure
Hello everyone again ! I'm trying to setup states for my Moon (via Booleans for now) but it doesn't work.. When I rotate the whole object, it stays at "no state on" despite having a Y rotation of 90 and then 180
does anyone has an idea ? thanks in advance !
the only time it really detects and tells me its state is on state 1 with 0 degrees
I mean I don't know what your goal overall is or the implementation or anything...
but something that may make your life easier is setting all the state bools to false at the start of the state check
but really you gotta investigate why your stuff isn't working
what have you tried, debugging wise?
@maiden wadi I figured it out.
How can i achieve this? i Think I need to use geometry scripting, but I am unsure where to start. I have been trying to figure out how to make a twisting hallway for ages.
Just visual or does it actually need to have that geometry for gameplay?
I found it, just some booleans not linked to branch nodes so not verification, automatically false and then not working 🙃
The gif of it shows the hallway as a normal hallway and then it twists.
Right. But is it just for display, or do you actually need it to twist the real geometry?
Like are we talking cinematic or gameplay?
Gameplay.
This is all they said about it, but its confusing. So I need some clarification
""Create a DynamicMeshActor blueprint (Geometry Script plug-in required);
Construct > Copy Mesh from Static Mesh (or you can create a mesh from scratch, you will need quite some vertices for smooth bend/twist);
Apply Twist Warp to Mesh. This one is tricky as you need to multiply alpha from timeline (with a sin curve here) to 1 or so deg added through transform API, and aim at the duration needed (6 seconds for a 180-degree spin in my case);
For the gravity part, it's a bit more complex to share but look at the free Directional & Planet Gravity plugin + GetDistanceAlongSplineAtLocation to change the gravity vector with a spline at runtime."
So I am confused if I need to create a blueprint actor for this or what?
Yeah. you'd need a new BP from that DynamicMeshActor class. I'm assuming you need to copy that hallway mesh or meshes into a dynamic mesh. Then you can affect it with the twists.
Presumably you could put the spline in the same BP and twist it and use that to alter the character's gravity direction
I think I understand it. I am trying it now
This is really my first time dealing with splines like this. When I add a spline, how do I apply the twisting?
Spline points all have a transform that applies as a lerp between each set of points. So you'd probably want a few points that are rolled as they go down the hallway.
so should I add a spline mesh to the BP or just a spline
I don't think you need a spline mesh? I'm not sure on that though. If you're using the geometry stuff you can copy your meshes to that and twist that instead of morphing spline meshes with tangents. But either way might work.
wth, BP in BP editor, all meshs can be selected individually, but putting BP into world from CB, and one selects all, is there a way to fix , and why is it different in BP editor ???
5.6
That sounds kind of normal. In the world you care more about the actor. You can still affect it's components in it's Details panel though.
That is on purpose
ok thx
FYI, changing overall scalability settings changes AA, so its a little redundant.
You could set it to 'Epic' on scalability and then off on AA, then it's no longer epic (or any of the options) or changing the AA and then scalability and then AA is overwritten.
im just wanting to change the graphics settings. but im putting that on a pause until i have my pause menu sorted so i can see it change without having to constantly reload the game.
Hey people, I'm using Gameplay Ability System and I would like to have a character broadcast that his tag has changed to everyone around. It's for instance when an enemy dies, its stops your character from targetting it. Any ideas on a clean way to do it ?
It's been a while since i've used GAS but I believe there's an event dispatcher that gets called when the tags update. Have the thing that locks on bind to it. (unbinding when the lock on is cancelled)
When its triggered, the thing that create the binding can then check the tags when its triggered.
I'll see into that thanks
Ok I did it kind of "backward" by binding to an event related to the enemy when the lock on ability is activated. Works but I don't really like the look of it
It's not to bad, however, I would avoid calling the 'Unbind All Events' from outside the class that holds the event dispatcher (unless its from some sort of manager class) as it will also unbind all the events other classes might have made.
I've ran into a few issues where I unbind everything. 😅 Took me a while to track it down.
Wait, this mean it can unbind the events that are being bound in other, external characters ?
I'm going to replace this by a "global event bus" message dispatch anyway, for even looser coupling
thanks for the heads-up, I wanted to avoid "floating unbound events"
Pretty much. An event dispatcher is just an array of delegates which specifies the object and function name. So when you call the event dispatcher it loops through the array, calling the desired function on the specified object.
Unbind all just clears the array.
Makes sense now that you explain it this way. I'll just unbind this specific event then. Thanks !
I guess in the array it will be something like ThisCharacter->ThisCallback
BP really needs C++'s RemoveAll version for delegates.
Yea, it would be nice if BP just got more support for delegates in general as well. Being able to create and store an array of delegates would be nice.
better ?
Hey, 🙂
Is it possible to create a game :
- made out of blocks like in Minecraft where you can break and place blocks but
- the level is limited to a 256x64x256 (width,height, depth)
- there's no procedural generation as the level will be built block by block by hand
- in BP
- Without it being laggy
please ? Because i received 2 different answers :
- 1 saying it will be laggy because of the amount of blocks, so you need to go through c++ for optimization (when I tried with static meshes, indeed it lagged alot with less than that (I think I tried with 100x100x100)
- 1 saying the 256x64x256 size isn't really that big, so it's doable in BP (this answer came from one of the creator / dev of the Voxel Plugin on their own discord)
So if that's possible to do in BP, what approach and things should I go for / know about to do my game please ?
Perhaps instanced static meshes should work, at such a small scale.
You could also use the voxel plugin. 😛
Short answer is yes. The biggest hit is actually the calculations for procedural generation which you've stated you don't want.
- Are there limitations to instanced static meshes ?
- So for instance, if I fill the whole grid of 256x64x256, it won't lag ? Even with the faces overlapping each other that shouldn't be rendered ?
- I want to use the voxel plugin but the issue I have with it is it's doesn't support custom blocks such as stairs (I asked that 1 year ago, so I don't know if they finally added that option or not) 😬
I shouldn’t lag.
Instanced meshes is what games use for trees.
And there’s a shit ton of those, with a ton more quality in comparison
At that size, it would be over 4 million blocks. The issue with ISM's is they can cause lag when trying to add/remove an instance when it has a ton already.
However, if you chunk the area and then frame slice updates, you should be fine.
You could even add addition checks to not add instances for blocks that are blocked on all sides.
By how much could I increase that size and still not being laggy ?
That would depend on your implementation. You'd have to build it and test.
Hard to say.
I didn’t even realize in my head, 256 would mean 16 million…
No, not 16 million, I'm not using 256 in height, I'm only using 64
Oh
Still 4 million. lol
Yeah
What should I look for on youtube to learn how to do the frame slide update thing, because I have no idea what that is 😬 ?
Lets say you have 16 chunks and they all need updating. Doing so all at once would most likely stall the game thread. So what we can do is update 1 or 2 chunks each frame (like a queue) until all updates have been completed.
You effectively slice up what needs to be done into smaller batches and handling them over several frames.
I'm not sure of any specific tutorials.
Placing 4 million blocks by hand? sounds fun
I see, but to create this kind of chunk system, we need a kind of tree data structure, isn't it ?
Its a speed run type game. 😉
No but like 4 millions is my canvas, I don't have to place blocks in every one of them 🤣
Yea, you'll need some sort of manager class.
Is there a prebuilt type in BP for tree data structures ?
Data is data, how you choice to store it is up to you.
You just need to make sure the manager class is able to work with what ever structure you go for. (Get and set data within it)
Personally, i'd probably go for an actor component for the manager class (placed on the game state) and then use a custom uobject for the chunks. This would store the blocks that should be in the chunk with their relative locations.
Hello, I'm trying to make 3 drones spawn in the box collision that's acting as a bounds, but I just cant seem to get it to work, I'd, appreciate any help thanks 🙂
Oh so I have to design the tree structure myself, I thought there was a tree data structure by default in Unreal that I can use like there's an array structure type, map structure type, etc...
I've used a TMap<IntPoint, ChunkObj> before which wasn't to bad.
Then you could have a 'PendingUpdates' list of IntPoints that need updating.
But yea, there's no one size fits all approach, you need think about what data you need and the best place for it to be stored.