#blueprint
1 messages · Page 173 of 1
multidimensional arrays not a thing in blueprints i'm pretty sure
Multidimensional arrays are unnecessary anyway
Yes, The more I dig into it, the clearer that becomes. I'm currently looking into whether to just handle the data within the blueprint itself, which seems doable, or whether a structure is more appropriate. I haven't dealt with structs much yet though.
What do you mean?
because array of arrays, i suppose
Hey, does anyone know if there is a more cost effective alternative to 2D Scene Capture Components? And if not best practices to using them performance wise? I have one in my scene that I would like to use but it tanks the fps
all actors seem to have a checkbox to disable/enable whether they are visible in captures, try turning off the most expensive stuff you can get away with
also perhaps dont draw it every frame, or maybe just once even
I guess the idea would then be to use the positional data to determine the exact location it lays out given the array size, etc, and then just use an array/structure to hold the bottom level data? That makes sense.
I'm just trying to store various types of data (ints/enum/etc) at a given row/col number. This looks pretty straightforward to do then.
well you could do it either as a flat array and doing math to convert from x,y based indexer into i (x + y*dim_x_len). but i was saying actually make it an array of arrays, then get element x, from x get element y
alternately just use a dictionary/map
Array of arrays seems like it might be a bit less math I have to do, which is always a benefit. lol. So, for my purposes... An array, within an array, that holds a struct of data that I call for the element I'm looking for?
yea, i mean makes sense to me, i have not done it in UE blueprints personally
what is array of arrays ?
Something you can’t do in bp
you cant do that either?
Afaik no, cpp thing
that doesn't make sense
TArray<TArray<smt>>
Notice the T in front of array
for template
It also indicates cpp code being relayed
this is valid afaik, not sure what people saying isnt
i bet you make that a UPROPERTY with BlueprintReadWrite and it works fine
probably lol
Probably yeah
But out of the box it’s not pure bp
Just like TArray::Sort doesn’t exist in bp
i mean, you can have a random bp and add a node 'make array' and for the type choose array? i guess thats the part the ui doesn't let you do?
I suppose? I haven’t tried
How many entries are you talking about?
and is it dense or sparse?
Like say you had to cover a 100 x 100 grid, would EVERY spot have something important or just some of them?
So far, I'm testing it with a 15x30 grid. Each tile in that grid will have associated data, such as tile type, whether it's occupied, whether there are any other conditions affecting that tile, etc. So -every- tile has that information all the time. Not sure what you mean by dense or sparse beyond that though?
Your best bet will be to use an array and some helper functions to convert coords to index and back, or a map/dictionary
Key = coords
Value = Data at that coords
I think I get what you mean. Kind of like, a single flat array that I can add to the element of based on the row and columns to find the right entry, and then that array is a specific structure holding all my data.
Right now I'm working on filling out my struct with the data I need each tile to hold, then I'll have to figure out that part.
@harsh comet New legend of the server confirmed. This wouldn't have been fixed without a very attentive and patient person like him. Thank you! 💜
Happy to help!
Probably gimbal lock.
you are probably doing yaw (turning left/right) in object space and meant to do it in world space
Pitch can only go from 90 to -90. It doesn't do a full 360.
When you go beyond these values, it adds in roll and yaw to allow you to continue moving.
its about the rotation you are setting though
one style is like a flight sim
make yaw and pitch bp variables (not just local ones)
mouse delta = yaw/pitch ++ --
build rotation from specific yaw, pitch values
you are trying to apply a new rotation, on top of its current rotations
dont do that unless its a flight sim
dont get world rotation
your building a brand new rotation
and setting it, not multiplying it on top
it is the world rotation
set the world rotation, to the result of "make fquat from yaw pitch roll"
except idk the actual bp node name
you have 'compose rotators' but you dont want a previous rotation
yea quaternion
no
because a quaternions x,y,z,w does not equal yaw, pitch roll
yaw pitch roll is also called a euler
hold on. ill have to build and actually run editor
a euler angle, or euler for short, is a vector3 where x,y,z is yaw pitch roll
a quat is a 3d rotation, and can be constructed from or decomposed into a euler
and idk what a 'rotator' is in unreal engine really, im just talking about actual (math) computer graphics terms
you might even be able to just break the 'input' pin on your blueprint as you had it before, if that is valid for a rotator node
yea, if its unconstrained rotation applied relative to its current rotation, its impossible to ever get it back level or not upsidedown ;D becomes like solving a rubix cube
Hey folks. QQ. Let's say I have my PCG graph sorted out. How do I connect it to a BP that upon a game start or some other event, the PCG gets triggered with a random seed.
whats a pcg?
Yes
Is this roughly right?
I can figure out the rest if gpt is not hallucinating
BeginPlay
if its a component, it should have a begin play you can overload to do stuff
a keybinding conflict?
i had to rebind so that escape key is not stop simulation
in the editor prefs
Hello, Does anyone know if it is possible to find a spline components point by collision?(See image) I want to find the spline point nearest an input vector, but searching all the thousands of spline components and then all of their spline points will eventually get very performance intensive. They are all bound to the same actor, and the function to find the points would be in the same actor as well.
orange is the landscape
does spline component not support collision?
it would, presumably, now that I think of it theres more than one type of collision isnt there?
I might be able to make it work with that info, thank you
if you make each component its own child actor
that will allow them to be binned or whatever the world does for fast overlap testing
if I have a text widget component placed in BP_MasterCharacter and I have a reference to the maincharacter, but during gameplay it changes to child reference , how do I gain access to the child Character BP without casting , so I can manipulate the child's text widget not the Master's text widget?
assuming that spline component at least has a bounding box
i could probably add one, that sounds like a way better idea than what I'm doing, thank you very much!
idk what master character is .. just the base bp class for you?
sorry I didnt clarify. Its a master character bp. at runtime it gets changed to the child reference
I can access the widget component
it gets "changed"?
but I dont know how I can access exactly the child's widget
ok so it isnt being changed, it is allocated and includes everything about master, and is a master
there is only one property for your widget
example: MasterCharacter -> ZombieEnemy1 (derives from MasterCharacter, so inherits Widget component)
I get access to ZombieEnemy1 while the game is running even though the base variable is MasterCharacter inside the blueprint
does zombieenemy1 define its own property that is a textwidget? no, right?
so Im accessing the widget component, but its targeting the MasterCharacter component
there is no problem, because the mastercharacter being targetted IS the zombie
ZombieEnemy1 is getting its widget from Master but it should be instance editable
how can I target specific zombie child class via blueprints to trigger for an example widget component's visibility...?
what is the error
Its obviously not plugged in but even when plugged in the visibility is still hidden, and I think its because its targeting the Master zombie class but not the child class specifically itself
current target is ZombieEnemy1 while the lock on is running
but what is the error
...?
I just said in my text
its not plugged in
but even if plugged in
read
how can it target specifically this zombie child BP while the lock on is engaged but it cannot find whos the author of the component
there must be a way to set the component author
the component is always owned by the actor it is on
even if inherited?
yes
so it must be instance editable
no
because inherited components are not, usually
or you cant like remove them
unless you mean just that each actor that is a zombie has its own component with its own personal values
so what im getting is that I have to setup the widget component for each enemy class (child classes) separately?
are you not already? where is your widget component now
it being in the base class gives every actor one
like there literally is no problem
thats why i asked what your error message was
oh by the way i just had to implement some widgetcomponent based reticules and hovor indicators for my own project
and i did it via a base bp class that is used for every that is unit in the game
but thats because i need it per unit, some other ones there can only ever be one of onscreen like a drag selection rectangle, so i did that on the character controller
as an example ZombieEnemy1 is placed on the level and when using lock-on then it can find the enemy because its looking for all actors of class "MasterCharacter" and the lock-on works. Now, only the MasteerCharacter has the text widget. Its visibility is set to hidden on the Master. since ZombieEnemy1 child class gets the widget inherited, I want to set its own visibility to visible so it would be shown at same time
but its literally not setting its visibility to visible
its still hidden
maybe try debugging (simulate button) the blueprint and adding a print text node at the end, after the widget visibility call, and make sure its really occurring
also make sure it like .. has text assigned not just visibility ;D
if you need to get the widget on a different actor that isn't 'self' then you have to at least have the actor
GetWidgetComponent->GetVisibility->EnumToString->Print string -> returns Visible, interesting
The child is the owner of the component->GetOwner->GetDisplayName->print
I will do some debugging.. weird day 😕
Hey guys, I have been trying to set up the camera in the third person bp, to return to its origina position (behind the player) after a certain amount of inactivity.
It works, but I have run into two issues, a) if i move the camera while it rotates to its original position, i stop the rotation but cant controll the camera, b) i cant control the camera after its rotated back to its original position.
Do you have any recommendations or tips, towards what I should do ?
add print text nodes and try debugging the blueprint by toggling on the simulate button (and choosing a debug object, if necessary)
this would tell you if the input action is actually firing or not
seems to me like the timeline could be hogging the execution pin so its stuck in that loop in the end maybe. perhaps try on the timeline plugging finished into stop to break the loop? idk
I added a print string now after EnhancedInputAction, and while the camera rotates to the original position, when i hover the mouse, it prints Input Working, yet the camera remains in the same position
put a breakpoint in the tick event
you might consider writing it as "time of last input" and then "if current time >= last time + X"
also
you are retriggering that timeline repeatedly i think
looks like you need a little state machine
You are right, the timeline keeps retriggering (I added a print string to check, and it prints non stop)
cool, sounds like your getting the hang of debugging issues then, core programmer skills ;D
Haha, thank you, I totally forgot about debugging xD
I am moving my player character using force because I want to do things like add an impulse to it however I don't want the collision to be this accurate. How can I disable all the added rotation from collisions yet still have the player character not phase through walls? thanks!
looks kinda cool though with the wobble
lmao yeah its like some go pro footage of an accident
Bumping this, no idea how to setup a filter to see all blueprints under a subfolder...
clear filter, click and enable blueprints, select the folder in content drawer's treeview, look at them all to right?
I don't follow sorry, what are you referring to? I'm wanting to do it dynamically so the logic will find any assets I add going forward without me having to modify an array...
Might need a screenshot it's not clear what you mean
All good, basically I want the system to scan for any metahumans I've downloaded in the metahumans subfolder and return an array of them all
So I can download 10 metahumans and not have to manually add references in code to the new ones I downloaded
ok I have a actor that spawns projectiles to kill targets, when the target dies I want it to inform the actor it got a kill, how would I do that?
I would recommend using an event dispatcher for that
Like class references? Idk if you can do that without editing engine
I was under the impression that's what the Get Blueprint Assets node is for though?
There could be idk not familiar with that node
yeah it's tricky, I haven't come across any references for it
There's a class paths but that's an input
where's that?
What type Is the get bp assets returning?
On the node
actor class
Couldn't you just set that array then?
Idk what this node does so not very helpful lol
Well the whole idea is it'll find any actors underneath the subfolder recursively and return them so I don't have to manually edit anything as I download more metahumans
yeah it's returning an empty array atm
What's interesting is if I remove the package path array, and leave that input empty, it seems to find a ton of blueprints:
Make try / instead of \
Yeah just tried, same result unfortunately
Seems to just search in engine folder maybe
Change the path to your content folder maybe
Yeah that's what I'm doing currently, still not fidning it
That's not a name tho
Probably just doesn't work that way and Probably not for this
Welll I'm plugging it into the package paths array, not the package names
Yeah you're probably right, can you think of any other ways I could get the references?
ok yeah I'm at a complete loss, idk how to do this
Was just with the intention of making the process as simple as possible
not sure how to figure out how to let the killer of a actor know that its killed something
I'd start with the built in damage system, I think it makes that stuff pretty easy
The take damage event has info on who damaged the actor
Right, but how does that let the killing actor know that the killed actor is killed?
Well if you trigger the kill functionality in the OnTakeDamage event you have a reference to the killing actor, so you can call whatever functionality you want at that stage with the Damage Causer reference
kill functionality??
whatever code you're using to make your actor die. Just wire up the death system into the OnTakeDamage event and you'll have a reference to the killing actor when you want your actor to die
I.e. OnTakeDamage -> set health =health-damage -> if health <=0 -> cast to Killing Actor on Damage Causer parameter and fire KilledEnemy
Seems like this is more complicated
Kinda, but it's a project I'm wanting to share with non-ue people so it's helpful for them if there's less config
I see.
Cast or use interface
can't cast
you could also write a C++ function marked as blueprint callable
when i get this bogged down trying to do something specific in blueprints, thats what i do
Gotcha, yeah I've managed to not get into C++ so unfortunately that'll be a bit of a process for me to setup I think
plus you probably dont really want to reallocate an array of them all each time, just to loop through them
Someone mentioned using python though, does that sound possible/
I have a question about blueprints and components. I'm looking for a way to determine the classes of any components that are configured in a blueprint class that isn't actually spawned in the world. I can use a CDO to get most information contained in a class, but there doesn't seem to be a way of finding the classes of components. Is there any way around this?
I don't fully follow what you mean sorry?
Why
oh my god, interface works lol idk why I didn't think of that
the output of that node is an array, so each time you execute it its allocating an array, but the actual returned results is the same every time, unless new assets can appear in-game
anyway thats not a big deal unless we're talking hundred of them
and it being called continuously
Gotcha, yeah it's something I'd just be calling at the start
I have heard python is semi-officially supported or something.
But imo dont give yourself more work by trying to do that.
When you haven't even done regular C++ before.
That is to say, if you want to ease into code beyond bps, making a single function in C++ is a good place.
Understood, yeah that makes sense
But really, that node looked to me like it would work
So long as meta humans have a base class of some type
Same here 😆, but it won't even find any actors under the main content folder
They're all just subclassing the actor class
Ah.
Maybe you can change the folder it downloads/installs metahumans to.
Give them their own location. Problem bypassed.
But I still can't work out how to get the node to find any blueprints under a specific subfolder...
really? specify the path in the subfolder
When I enable Incolude Only on Disk assets it finds my game assets now, but it's saying the path is under a Game folder, not the content folder:
does it matter? what are you about to do with them all anyway
if you have the blueprint asset, thats all you need to allocate one
Ahh never mind, think I've got it
problem was I was searching under Content/Metahumans, but searching under Game/Metahumans allowed it to find the assets only under that subfolder
nice
Perfect, thanks for the help 👍
Nice I might play around with this myself didn't know about this node
ok I think one major flaw I have in my actor is that component begin overlaps are called on all clients and the server for said actor
not sure how to go about just making that run on the server only
I suppose, just seems weird
has authority means this is the true version of the actor on the device under network control of it
Did you read the compendium in #multiplayer yet?
Hey all! I have a fishing game, and all of my casting/reeling etc stuff is in my BP player character.. but I also want to be able to fish in the boat too..
is there anyway I can maintain possession of my player character and still drive my boat? or how would any of you approach this?
Hi, I have packaged my profit and it when open it started at a login screen, once I pressed the login button the game crashed, where it should change to another level. Attached is the log file, where do I look in the log file to find the cause of the crash?
Does a human fish while actually holding the steering wheel?
i'm sure some people do
sorry. wrong error
thank you
and hold a beer can in the other hand
ah got it
that's how i drive the car, too
checks out
im trying to get the player character to auto follow another actor just before possessing. Once possessed i have it following no problems, but the same won't work from the first player for some reason, any suggestions ?
other than to actually debug the blueprint and add tons of print text nodes, not really
I tried disabling sunposition plugin and set the package setting to shipping. It did not crash the game when the login button is pressed, but it did not change the level, I can press the login button many times and nothing happen
probably add print text nodes all over the bp that is handling the click
uh whats the call you are using to load the level?
if its like LoadSomeLevelByPath("Content/MyLevel") then thats probably the issue
alright I'll try printing it
well, or the signed in event isnot firing
i dont actually know if you can debug bps running in a packaged/shipping build
somehow
so i've tried this, a slightly different approach which mirrors the other version i have already working. when playing it, i can see the rotation values change, the change actor rotation says true, but the camera doesn't rotate
looks like the problem is not with the login screen, my project use ue5 collaborative game mode, I tried packaging it where when open it straight away go to the main level, and once I open it, it crash immediately
Can you define vectors to only use integers, instead of floats?
Not a normal vector, no. Not unless you more or less always round them when applying them. But there is IntPoint and IntVector
I realized that Vector 2D is just a struct, so I made my own Struct called IntegerVector2D. Haven't tested it yet, but it looks like it should do exactly what I want now.
I'm not sure if it makes any more or less sense than having a nested array of my tile data struct, but if I can just plug numbers in and get what I want, it should be fine.
I had no idea these variable types existed. Neat stuff!
IMO I would recommend just using IntPoint or IntVector. Less effort.
Yeah so far it looks the same, actually
I'm digging into the operators and seeing what happens
It's getting late, but yeah the IntPoint is literally what I was looking for. Thank you!
I'm not sure how sound the logic is, but I'm using the IntPoint as a key for a map container, with the values within being the struct of my tile data. So far, so good. Gotta build it all in next.
If we use a break for each loop, and we execute the Break execution pin, does the array element output stop at the index where we hit the break execution?
Yeah. As soon as the break triggers, the return node executes.
Sorry. An hour later I probably should have pinged you.
No worries. I realised quickly that I could just test the theory as well, and it does indeed work as you mentioned 😄
Thanks for the help 🤩
Ha ha no problem. : )
Why is my Enemies not moving
They have the controller
and its the same skeletal mesh as my character (that moves)
there must be something obvious that im missing
Do you have a nav mesh in your level?
Visual logger helps you troubleshoot #gameplay-ai
yes. p shows floor green 🟩
never heard of it. just opened mathew wadstein to enlighten me 🍅
Tools -> Debug , although idk where it is in UE4
One issue that you might have based on that screenshot is you’re trying to path above the mesh
If that Z location is not on the mesh you need to either adjust the vector or increase the projection to mesh range
Also the acceptance radius is a little small
Try 50 or so
yeah i tried different Z's before
i increased now the scale of the nav mesh
still didnt work
Not nav mesh scale
That doesn’t do anything in this case
Either way, the Visual Debugger is the best way to find out for sure, taking guesses as to what it might be is not optimal
I also noticed you are executing AI move to in both the enemy grunt pawn and in the controller. Is there a particular reason for that?
no, its because both failed individually.
here we can see that they kind want to move
What if you set your player character as the Target Actor? Can you check what happens then?
Also, does the On request Failed execution pin ever fire? Can you check that with a print string
thats what i did just now
they kind of try to move
they rotate a little
yes it fires
Okay I am just double checking this for you now, but it essentially means that the location you have provided for it to move to, it cannot move to within the paths provided by the nav mesh.
What is NavArea_Obstacle? in your enemy grunt?
Idk. Isnt that the standard navigation?
its the same as my TopDownCharacter
my TopDownCharacter moves and is also NavArea_Obstacle
Right, in that case I am really not sure what the issue is besides the fact that the location you are providing is unreachable by the controllers, which is why On Request Failed is firing.
oh i found an hint of the problem
i disabled simulate physics
and now it moves
so this is something
Ah yea, physics movement and nav movement aren't compatible at the same time
ohhh
because i have an ability that throws the enemies into the air
so that ability must go?
No, you just need to enable and disable simulate physics at run time when that ability is active.
Done. Thanks a lot.
Switch has authority
If I'm specifing here that I want this to be BP_Unit, is it like putting hard reference? If I used Actor then it would be more light?
You need to understand that every player are running their own instance of the game. And each instance have their own version/copies of the actor
Overlap code will execute when something overlap in your machine.
If u don't want client to overlap, use switch has authority
Well it wouldn't load bp unit
It is a hard ref
If u can get away using the base class do that instead
Same thing with blueprint casting
Always cast to base class when possible
base class, like Actor in this case, and then only if I needed I would cast to it, if not then it's more light?
It wouldn't auto load the derived class
got it, ok thanks
If u have bp unit there, bp unit will be loaded when Ur player state is loaded regardless if u gonna add bp unit or not to the array
i was wondering because I checked some references in my things and there was a lot of hard references even though I didn't use casting, must be because of how I'm sending some variables and already putting BP_Unit instead of actor for example
Blueprint cast produce hard ref (those blue pins)
in case if there is already BP Unit in the game from the start, does it make any difference? It's still only 1 BP_Unit that is loaded?
No difference
so in this particual case I shouldn't worry
If something is loaded anyway, eg your character
Then just hard ref away
U want to soft ref and load things that you plan to load later on.
Something like items , icons, etc
Like u don't need to load the entire items in the game. Just load what the player own for example
if I want to call FPS_AimBP why can't I just call getFPS_AimBP directly ? Instead of relying on casting ? Don't they have some funtion like that ? Casting is everywhere in ue5 and I don't even know why the hell do I even need it for ? Is is some kind of short cut for checking data type ??
I don't even know what will cause the casting to to " failed " What is the condition for failing ?????
I can get casting from child cast to parent class, but will casting from parent class to child class work ? how does that possible ?
You can, you just have to use the right type
Casting is just a type check
Take an actor for example, that could be an item it could be my player it could be anything that is placed in the world.
So if you want to check if that actor is a player character, u will cast to player character.
If the actor is indeed a player character then you will get successfull. Fail otherwise
You shouldn't need to cast from a parent to a child for any reason. You make events and functions in the parent to call which the child can override. Or make properties in the parent that the child can set.
Which would be better.
Get Player State > Cast to Player State > Event On Server
Get Player State > Interface Event > Event On Server
Considering Player State is already loaded anyway. For cleanliness in the code I like interface more, but I'm just adding 1 step too much or it's actually equall?
Eww to the interface imo
You should exhaust every other option before ever considering an interface.
Can it be simply cast? Then cast it.
Can it be pulled from a component? Then use composition and do that.
Can it be broadcast from somewhere globally? Then put a delegate there and bind it.
If all other options fail because some condition prevents them. Such as needing the same function on both an actor and a component and not being able to use a delegate for it, then you should consider an interface.
In case of speed it's almost the same or casting here is faster, since it's already loaded from the game start
Interfaces are slower. They run a lot of extra code before the function call, mostly to check that the object can even run the function.
One more thing. If I'm calling like this from Actor (Unit) to Player State, and the event in Player State is Run On Server, so it will actually get the Player State updated. A little multiplayer question, but if it wasn't run on the server then nothing would actually happen, right?
what is the difference between object ref and class reference ?? what does class reference do, what does it used for ?
If it wasn't RunOnServer, then it would just do this locally where ever this code is ran. If this code is only run on the server, then nothing would change. Which it should be ran on the server, so either way you mark that function it should run the same.
how does refence to class work ? does class reference mean ref to the text file that contain the code ?
I mean ref to the content ( the text ) that made that class
So if I'm sending calling event from anyewhere else that is on Player State, basically everything in the Player State is already run on server? So anything that wants to communicate to Player State and calls event that is inside, it is Ran On Server? In other words? 😄
Class reference is which class to use. Object reference referencing some that exists in the world. So like take the spawn actor node you select the class and spawns an object
A class references is like the set of instructions on how to build something in the world and how it should function. An object is the thing that has been created using the instructions in the class.
When you create a blueprint in the editor, you're creating the class. When you then place it in the level, you create an object of that class.
^ better worded
question. if Get Class Defaults exists, is there a way to also set these variables that you get returned from class default?
You can't set variables in the class at runtime (as far as i know), you can only set the vars in the object/actor that has been created from the class.
Not quite. You can easily run functions on the playerstate from a client. I just meant that something that is assigning a unit to a player should already be server authoritive and not run on a client. So whatever is calling that function should already be on the server.
so its not possible to manipulate child class's variables given that these blueprint nodes exist in the main parent class?
(its character blueprint for both of them)
i can only 'get' the variable value but not set it for the child?
You can set them at runtime. Not in BP. That said. You should not set them at runtime even in C++.
What are you trying to do exactly?
I have main enemy parent class which derives from Character class. I also have enemy child class which derives from the main parent class.
the health variables exist in the main parent. I want to manipulate child health variables from the parent class
basically have a 'decrease damage' function in the parent class but it would target each child individually
Where does GetClassDefaults come in?
in the parent class
parent blueprint
I also did 'call parent event anydamage' on child class
But why? They're the same object. Why do you need the defaults? You already have the variable.
If you have the following hierarchy.
-Parent
--Child1
--Child2
oh okay so it doesnt need it for the variables. my mistake
maybe you need to click Show Variables
Parent has CurrentHealth. Which means both children do as well. Parent sets this to 100. In Child1's BP you set this to 80. In Child2's BP you set this to 120.
Back in the parent's code. If you get the CurrentHealth on an instance of Child2, you'll see 120
i got that inherited filter already
Having said this all. I strongly recommend ditching inheritance for this and using a data driven approach. A data asset for each enemy type with all of it's static data is a lot more scalable and easy to maintain and balance.
yo, so basically what I am trying to do is an opening drawer
It fully works and moves but the issue is that if I copy and paste the same drawer actor somewhere else and then try to open any drawer, all of them are getting opened instead of that single one.
Yes, I copied and pasted the same actor with the same blueprint.
Is there a way to fix it by making each actor act separately?
I am kinda new to unreal
and idk if this is the correct channel to ask that, sorry
Show your code
yep, gimmie a sec
it's basically a crosshair and when I interact with a drawer 100 units away, it's going to open
but instead of that one drawer actor opening, it opens in all of the same actors in the level
You don't really want to interact by comparing object names. Instead, try using an interface. Call the interface on whatever you hit, if it implements it, then in the drawer BP, implement the interface and do your opening logic
hm I will try to implement that if I understood correctly
and if I implement that, it's going to work individually instead of all of them at once?
alright, I will try that, thanks
Can someone confirm if this is correct? In case of Player State, that is already loaded in the memory from the game start, it's actually better to cast to Playerstate and set that as variable to use it everyhere in that blueprint, instead of using PlayerState and sending interface there. Same would go in all other blueprints that I will need to get any information from PlayerState.
What I'm trying to understand, if I cast to the PlayerState in 5 different blueprints, I'm not loading more, the PlayerState is loaded already, and casting is just a way for these blueprints to communicate to the existing PlayerState. Basically in communication x to 1 it's better for everything to cast to that 1 thing that is loaded anyway, in opposite to if it's 1 to x, where interface would be king.
There are 2 approaches 1 with inteface and 1 with casting. I shoudn't use interface in this case, right?
Casting does not load anything. Casting is nothing but a pointer conversion.
Linkers load things. But this is only valid for the default instance of the class. And linkers are only related to casting in the sense that the cast node has an output of that type. The same linking happens if you have a class property, or any other function inputs or outputs that class.
Casting is a function that outputs the type. So casting causes a linker.
Linkers are only important for memory management. If the classes casting to this playerstate are always going to be used in a map where this playerstate exists, there's no point to avoid casting. In the case where they would be, you don't use an interface to solve the problem, you make a parent class or a component with the functionality you need and you cast to that parent or generically GetComponentByClass.
Kind of a moot point for a playerstate though. Playerstates don't really have much in them as far as assets. So there shouldn't be a large sizemap there anyway.
Ok, thank you.
hey how would i check or rather get the array element with the highest value :/ ?
or if two values or more are the same pick "the lowest one"
HighestNumber = 0
for (int i = 0; i < array.Num(); i++)
if array [i] > HighestNumber
HighestNumber = array[i]
hym
do the same in BP lol
playing whutering waves, you can translate that to bp
aye just swapped them
lawl
but if all values are 0 then it will take the lowest one ofc
hmm
this formula was really taht simple
'formula' 🥲
aye llol
Is it normal that Player Controller BeginPlay is getting called when a new level is opened? I thought it should be called only once.
Sure, all actors from previous level gets destroyed
only thing that never gets destroyed and exists all the time is gameinstance
you can preserve actors if you use server travel
but for hard travel, all actors get destroyed
well not Game Instance, it is not an actor
I have this floating bar above my player to indicate life, how can I add an image (the red exagone (I know my paint is awesome)) but keep the player floating bar center in relation to the bar only and not the bar and the image
I see. Well I'm looking for a place to create widget ui objects only once (initialize them and store as variables). Player Controller seemed like a good place (the game is suppose to be multiplayer), but if BeginPlay is called every time a new level is loaded (since actors are recreated), then new widgets will create each time as well. Should I use GameInstance then?
you should read the compedium in the multiplayer channel first
Thanks, I'll read it more thoroughly when I get to the multiplayer part. But for now I just want to create some UI logic. Specifically I don't understand where do I create widget objects and store them to a global variable so I can use them on any level.
Player Controller fits perfectly except that it's recreated when a new level is opened. Game Mode is the same. Game Instance might work, but I'm afraid it only might work correctly in single player.
For example this Main Menu. Where would I create it?
understanding begin play in multiplayer context is important. In fact a lot of people have their multiplayer game broken because they mis used begin play
just create it in your Main Menu map?
can do it thru Game Mode
GM_MainMenu
Ye it makes sense that BeginPlay is different than what I assume it is. I'm kinda looking for an Initialization event. I see that GameInstance have Init event so thats probably called only once on game launch.
Game Mode is recreated as well when a new level is loaded
and how will that load your main menu UI?
Yes, that's the point
That would work, but I want this UI to exist outside of Main Menu level as well
I'm gonna show what I have right now and what my problem is
do it where it make sense
HUD is one place
just Open the option when you press esc or w/e
Open is not the problem, its creating Widget objects.
what's the issue
Open -> If widget not valid, create one if already valid, show it
this is my Initialize UI function
I need it to be called only once on game launch and never again, basically on game Initialization
then I can add to viewport/remove wherever I want, just by accessing the variables
Why would you keep widgets around that might never be used? Just release them and let them get collected.
In blueprint, you can't and like Authaer says no point
only widget I kept alive is my loading screen
and that's not possible in blueprint
hm
What ever function you want to call (Input or Event) to summon the widget . Check if it's valid. If not create one, if already valid, add it to viewport
you say a better aproach would be to create/destroy (or release? thats what its called in EU) widget objects specifically when I need them rather than creating them on game init and keeping in the memory forever?
yes don't overcomplicate it
you are actually making it worse on your self, not to mention you can't anyway
So what happend with the widget you point in the game instance
on Level Load, they get destroyed
so u will end up with null pointer
If you want pooling, their containers should do that.
IMO, I don't think I'd enjoy UI handling much anymore after using CommonUI and CommonGame.
@maiden wadi I'm using Async Open Level, can I somehow retreive the precentage of the load?
Ok with Main Menu it should be easy. I just create a widget object when I need and destroy when I don't. But what to do with lets say Character UI? Its suppose to exist permanently throughout gameplay. So if I were to open a new level, will Character UI widgets get destroyed automatically or do I need to destroy them manually before I open a new level?
they get destroyed automatically on opening another world
I mean memory wise
so you will have to re-create them in the new world
Objects get garbage collected when there is nothing else referencing it
C++ doesn't have garbage collector, but perhaps its built in UE level change logic?
Or so I heard it doesn't, idk maybe in new version it does 😄
I see, thats good. I guess that allows some level of sloppy programming
not sure how
it only collects object that are unreachable afaik
so if u dereference an object and nothing else points to it
the object will get GCed and memory will be freed
That will do nothing at all
you create widget, then you open level. your widget get destroyed
Hi all, this is a more refined follow-up to a question I had asked last week. Has anyone here ever dealt with trying to export data out of Unreal Engine to another format to be used in a data analysis program (like R, for instance)? I was able to successfully create a save game file that gets exported properly and contains all of the variables of interest I would want to analyze, but I am not sure how to proceed from here (save game variables pictured below). I have a bunch of different types of data; my goal is to get this into a .CSV, a JSON, or anything else that's not an Unreal Engine proprietary format so I can use these data later. From what I can find, it seems like JSON might be an option, and .CSV is potentially an option but is a lot more complicated. Not looking for anyone to give me a concrete solution but more so a direction to look into for how I can get these variables "out" of Unreal so I can load their values into some other program. Thank you!
So basically when a new level is opened, all of these actors get destroyed and new ones are created?
hard travel, yes
and so the only way to pass any data between levels (if I need to) is Game Instance?
in multiplayer, there is Server Travel
where it's possible to preserve actors
and also there is a way to copy player state afaik
not far into those yet
I see, thanks!
I don't know what that is?
nvm, Im too tired 😄
Anyone know a good system or tutorial that I can use to guide me into making a tracker for the player's achievements? I'm trying to make a sticker book for the player that rewards them with items sometimes whenever they have completed a specific thing. Would I just have a event dispatcher that goes off in the gamemode whenever the player does something that relates to one of the stickers and make a function that does a check for everything each time??
i think there is a json plugin
no idea about any tutorial, but i image there a list of achievements (somewhere) that when a player meets the conditions says to a method add me to the list, and for that achievment the player is added.
I wonder if this is being checked on tick or if the value changes, then it updates its progress? ig i'll have to do more research
it would be more efficient and probably easier to just call an event when you want to check
you could also do on tick but having only run on check would be best imo
i like to update things when necessary to get rid of overhead
that all kind of depends too, say you want to count enemies slayed, you would only want to update when you killed something and just call an event. but if you wanted to do something more time sensitive like a multikill maybe a check on tick would be better. (im not sure you would use tick for a multikill either, just trying to give an example)
Event tick isn't really good for time based stuff since the tick will be different from machine to machine
but what is it good for? ;p
"Using tick groups and tick dependency can be vital to ensuring that your game works properly with regard to physics-dependent behaviors, or sequential gameplay behaviors that involve multiple actors or components." ~Unreal
i just googled it
Yeah the only time I've used it was for a physics grab system
i might use it one day ;p
Hey guys. I have a bummer here. I have a platform and when character jumps on it it has to go 5 units down and then instantly go 5 units up. Just to show that the player has some weight and the platform goes down once the player lands on it.
I trying to manage it with timeline node. But for some reason the platform just once go 5 units down and never goes back. How can i fix it? Here is the line of code which goes from "begin overlap".
Here is how time the track looks like
here is a short video
the curve goes from 0 to 1 and then goes back to 0. Shouldnt the platform go 5 units lower and 5 units higher back?
maybe cache the location in a variable instead of pulling from the location live
hmm
I thought about it, but decided it wasn't the best idea to implement a variable. I thought it could be solved simply on a timeline.
just create a vector and get actor location, then use the vector to the lerp
most likely will solve the problem
get actor location before timeline save it to a vector use that instead
i believe because your pulling live the location a is becomming the location so zero would be a
which is where it's at
i would of used a vector and split it at the end, less wires going all across
I always forget that timeline works as event tick
Like this?
ya something like that, but either way works
Hey guys, I have an idea for a system where there would be a number of "organizations" in the game world, trying to accomplish their goals and managing property and resources etc. I think a few of these would be AI controlled, which leaves me unsure how best to implement them. If I understand correctly, actors are intended to be placed in the scene, so I am not certain that fits my case here as these organizations are more non-physical abstractions. Does anyone have any suggestions? I believe I'd want them to be able to receive events so that they can be flexible.
One more thing. I finished tutorial series you recommended me here guys. It was dedicated object-oriented programming. So in my game i have 5 types of platforms. They have very different behavior, but still those are platforms. I have 5 different blueprints for each of them. And as i understand its not good at all. Somehow I should keep it all in one blueprint?
For example this is just static platform
This one is dynamic
i mean it's fine to have them all in there own bp
especially if they have different code, you can use one but you would probably end up with a bunch of code on that one thing
and add/removing others would just be a hassle
yep
i would atleast have them children of a common parent
Ok, got it. Thank you so much!
parent classes are nice if you need to loop through all the platforms you can get the parent class actors and there you go
also you can cast to the parent, which would work for any one of them
from a surface level understanding, this does sound like a good use case for inheritance, since they are all platforms, they just do things slightly different
if you can pull out common fields or functionality, that would be great, but its also ideal to not try to have the parent do everything, especially if not every child would want a given functionality
i mean even if it's just a blank actor with some variables
just having that parent can be real useful
ye
maybe a manager actor ?
that has all the events functions you need to handle it since it doesn't need to be displayed
run it on tick or some timers
yea that seems to make sense
reading more in the documentation, it seems fine if it is just an actor without a physical representation
StateGraph might help with that unless you want actual BTs
is there another name for that, I cant seem to find anything in the documentation
ohh StateTree?
Er, maybe that one. Can never remember the name.
oh interesting
It's similar to a BT in some ways, but doesn't require an AI Controller. It can be run on any actor as long as it has that component.
nice, that sounds good, and I like the layout
I do like being able to control things differently than a fail up, I will have to think a bit on this for what different "states" of these organizations will look like
it might be as simple as a "generate x resource" or "prioritize growth" kind of thing
ive got a component class which is added into an actor class. any way to hide certain variables from component class in the actor class. ive got some values that are defualt at zero and wont need ajusting ever. rather "hide" it if possible
oh, im assuming the values I dont want editing ever can be set to private right?
Hey ya'll 🙂 Need some help with regards to Camera movement and rotation playing together. Below is a simple mechanism for Right (+1) and Left (-1) movement of the camera pawn. I also added rotation which works. Problem is that when, let's say, I rotate to 180 degrees, the right/left become inverted and move in opposite directions, how can I compensate for that? Thanks a bunch!
you may want to set control rotation, or use the rotation of the actor instead of control rotation
i'm guessing your rotating the actor, but the control rotation is staying the same, by inverted do you mean the values actually change ? or you just go in the direction of control rotation, for instance what happens if your at a 45 and you try to move right
you may be able to use rotation in the details as well
Also don't put these controls in the player controller. Put them in the pawn where they belong.
i put some controls on the player controller so that i could use different characters and keep common controls, is this wrong ?
i thought it was fine to put in player controller
What are the common controls?
movement left/right
so they all move the same, i have not tried another character yet but i'm trying to make it easy to swap characters
It’s not wrong to have input in the PC if it’s used for more than one thing but if they’re the same parent class might as well just inherit them
Generally better in the pawn. Pawn's should define their movements, not the controller. General reasoning is that non mech vehicles don't strafe. People do. If they all have the same movement and you don't want to repeat it, make a simple parent class.
Can anyone tell me why I am unable to Cast to BP_ThirdPersonCharacter?
BP_ThirdPersonCharacter definitely exists in my project.
I can see BP_ThirdPersonGameMode but no BP_ThirdPersonCharacter when I cast.
what are you trying to cast ?
i mean what from ?
How do you guys get realistic camera bob? Do you play around with it or do you watch tutorials?
But mine are camera controls. Put camera and springarm into pawn object and then Controller rotates it around, etc.
ping me if anyone replies
Still the same idea. That's a pawn possessed by the controller with a specific set of movements. You can define the controls in the pawn too and when it's possessed, they run the same as if they were in a player controller. And then you also don't need to do GetControlledPawn
I was hoping I was missing something simple. Thank you very much. It worked.
But it's not an actual pawn right. It's a camera object. It's for an RTS-like game right. so you it makes sense Controller (BP_Controller) controls the Camera (BP_PlayerCamera)
reffing names from here
hello guys is there an short key in unreal to see the print string log when im play the level?
Look at the top right of the blueprint. At it's parent class.
i don't think so those messages are set on a timer
idk if you can log in bp might be what your after
hmm ok thanks im trying to debug...
But I think I understand what you mean with Get Controlled pawn
you can check print to log in the print strings, idk where you see that but it's somewhere
is checked
I just looked but whre can i find the log than in the screen is just for seconds
probably window, output log ?
here it shows you can filter it
How I can get parent actor/pawn of child ? when I do get owner I get controller
ok let me check thanks CHAMP!
from this damage causer I am getting child of actor I am using but I need get his parent so I can cast in it
Because I want cast inside parent and get his team so i can compare if its team shooting or enemy shooting, i dont want do it via child as this parent have 7 children which all are different enemies then I would need cast all 7 and get their team
but when I have parent I just need cast that one
its easier
less code
Child as in a child class?
hm?
I'm not following why you don't just cast DamageCauser to the parent class type to get the team?
Hey folks, i could use some Controls help. I'm trying to make my characters spring arm raise and lower when moving my mouse vertically, as opposed to rotating around the spring arms focus point.
Any help?
I feel like the Crane Pitch may be it but i'm not finding much in my subjective google
hi guys ,I have a blueprint with a spline component,when I delect one single point and I revoke(ctrl+Z),the spline points UI will disappear into the editor, I cant find it anymore and manipulate them.The spline will be a purple colour.So how to refind the ui?
I want the mouse movement for my controller to be frame rate independent but even when I have it set up like this it still doesn't work as intended
Shouldn't mouse movement not change depending on the frame rate?
If I lower the frame rate in game its a lot faster and if its higher its the opposite
hmm, maybe try ((mouse sensitivity * axis value) * delta)
but i would think your code would work
from what i understand about it it would be different value depending on delta
alright thanks ill try that out! I'll lyk if that doesnt work
guys how I can load blueprints in editor in folder? if they are in folder in windows but not in editor :/
@undone sequoia , blueprint in the file explorer are known as a .uasset, do you have these files types?
Next make sure that the uassets are in the content folder.
yea I coppied uasset just in folders in windows but they are not loaded in content browser
😄
Anyone know how to fix this? Im new to uneal and have no idea how to make my character change flipbook when I press left shift and when I am moving.
you may be able to check your velocity length, you want when you hit shift do that stuff, but only if your moving ?
You can use an method called Variable Time Step. @undone sequoia
I didn't fully get what you meant yesterday, but you were 100% right about this. I hadn't looked into Map containers yet, and after some learning this is a really really helpful tool for exactly what I'm doing.
I have my map data now tied to a key that is an IntPoint where the X is rows and Y is columns, and I have a struct that holds all of the various tile data parts I need. Looks pretty neat, has a ton of flexiblity, and is way way way easier to understand. And it's pretty much literally the multidimensional array I was looking for, if only different under the hood and with some call differences. Thanks a ton on this one!
Can you explain in more detail I have no idea what you mean sorry.
your velocity is basically how much your moving, you can get the velocity of your character, then check it's vector length is greater than zero
@undone sequoia peak unreal engine.
why would the playercontroller be moving?
Just tried it, for some reason it doesn't work. At higher frame rates the value is way smaller comapred to lower frame rates
Which ends up just making low fps mouse movement to be super fast
Thanks! No worries. Was missing some element from ThirdPerson Character map. Just reimported
hey i have my fps cam set up as a bodycam but i wanna go for more of a handheld look, and how it is rn the walk speed has to be slow for it to not look super bouncy, how would i make my fps camera animations look more like someones just holding the camera
I started with eu5 not long ago. I wanted to make two characters, a tank and a plane, and I wanted to give them attack and defense, but when, for example, I created the life variable in a tank, everything worked until I transferred this variable to the plane, because then instead of a variable, a block with a target(self) was created. Does anyone know what to connect this target(self) with to make it work? because, for example, in C++ it would be possible to extern or import the file and these variables would be transferred, and in blueprint it would be some kind of target(self)
show the code ? you copied something from one bp to another ?
you wouldn't extern those in C++ though. You aren't importing from some library or assembly, you're accessing a member on another thing
the target is essentially specifying what to use -> on
On another note, i'm attempting to have my field of view change slowly to mimic lag when adjusting via a slider. However i can't get it to be slow regardless of what alpha and exponent settings i use. Any help?
Hey guys, I have this system that lets my player draw on a canvas. I added an extra thing to make it have a set amount that can be drawn and it replaces the oldest drawn thing, basically if the player continuously draws it would look like a snake. I achieved this by having an array and saving the different draw locations and then drawing all of them again (exluding the oldest one in the array). My issue is that this is a costly way of doing it and it's making the game lag. Anyone know of a more efficient way of achieving this effect?
I'm a friggen noob, but can you prevent excessive overlaps to reduce some drawings - and also change the frequency juuuuust enough to help again lessen how much and how quickly that amount it being spawned?
That's true and is something I thought of. Though I am hoping for a different cause when I draw it's just a circle and if it isn't frequent enough then a continuous line will start looking jittery. Will try it out though!
Blueprint communication is typically a choice between direct, event dispatchers and interfaces.
But is it either or are there times when it makes sense to combine more than one method?
im a newbie and cant seem to figure out how to get an interaction system working, does anyone know a good way how
you can just use events or an interface ig
Anybody know why I can't use breakpoints? - No clue why they don't show up by default, but after hitting F9 (hotkey to add a breakpoint to a node) they now show up in the context menu.
Check out the Blueprint Communication tutorial to learn about interfaces, specifically. That should set you up for success.
oki
IMO interaction is better done on a component than an interface.
And if it's a scene component, voila, you have a place to do the interaction. Like for buttons or door knobs or whatever
For a complete beginner, interfaces can be pretty simple to grasp. Then you can experiment with components and other options. I just think an interface is a good starting point, which is why I usually recommend it.
Interfaces complicate things. You have to implement them on everything and copy a lot of code.
Super Noob here. Which discord channel would be proper for asking about updating a UI text field?? I'm trying to understand/use event dispatchers for this.
Not much different than adding a component to everything.
hey guys I am looking at tutorial and I need "Move Component To" but can't find it in my UE5.4. Did this changed in this version or am I missing something?
The most annoying part of interfaces is adding all the functions whenever you need something new.
But you'd still have to do the same thing with a component... You just have more freedom to run events on the component, which is nice.
¯_(ツ)_/¯
Except the code copying. Delegates in the component and placing the interaction handling in it allows you stateful interaction. Such as holding on a lever to open a gate over three seconds, and the same component can have immediate callbacks for instant interactions. The same component can have a setting to allow one or multiple people to interact with it to make it faster or not.
And all of this can be easily housed in a single component where to use it you simply add it to an actor, implement it's delegate to handle whatnever needs done when it's interaction completes. Other components on the same actor can also even bind the interaction complete delegate for even more reusable code.
To do this on an interface. You start copying code from the very beginning because all you get for reuse is the function call and implementation. As a beginner, composition should be the first idea taught because it's the core of Unreal. Actors house Components and components house logic. Learning to not copy code is a critical skill early on to learn to abstract things correctly so that your project stays cleaner and easier to work with.
Those are all excellent use cases for a component. I 100% agree. I've honestly never used a component for interaction like that, but it sounds like I will be going forward.
But how beginner friendly is it? Because when it's day 1 in Unreal and you just want to press E to see a door open, I feel like small wins with simple to understand logic is always the best choice.
follow up on my previous question, how would i get this blueprint with a sphere collision to check whether or not i press a key, and do something (like play a sound) when i do press it while inside of it, then remove the ability to do that again? ive tried adding a variable in my player blueprint but i dont know how to grab that variable inside this blueprint.
Even then I'd say just cast to the actor off of the line trace or whatever. IMO, interfaces are just a bad habit to teach. In a scaling project they have a few niche actual use cases. Core classes and composition take up most of the cases where you'll need to do something with an entity. Largely because of the reusability of it. Interfaces only really work in minor parts to give some systems functionality. UMG's Listview comes to mind. You can't always know the class to be used there, and when it was conceived, UMG had no concepts of composition. So interface filled tha gap. If it was made today it could probably use the new UMG extensions.
Day 1 Unreal? Learn casting. It's crucial to know. More crucial to understand that it's not a bad thing despite a lot of criticism around it from people who don't understand how linkers work. Can't even really say day 1. Took me a month before I could vaguely grasp what it was doing. My first couple weeks were following the same set of tutorials multiple times to get used to concepts.
And more so on the note of avoiding interfaces, it's really difficult to follow. I work with UI a lot. I'm usually the person who has to expose API for UI. Which really sucks, because that also means my job requires me to follow along and understand the gameplay systems because most times I have to add that logic myself. So I not only do my job, but clean up systems after gameplay programmers. And having had to follow both interface and composition in a scaling project, I'd choose composition any day.
EG say I need to add a progress bar for interacting with an actor. To do this with an interface. I need to add a new function to the interface. I need to go through every single thing that uses this interface and manage to implement that function in every one of them to pass back the interaction time and requirement for finishing interaction. I need to care about the objects using this component because these objects needs to store the state of interaction themselves. I have to add multiple interface functions here. GetCurrentInteractPercent, GetMaxInteractTime, GetInteractUserCount, etc. Then each interactable thing has to have properties put on it. InteractionTimeRequired, MaxInteractionUsers, CurrentInteractionProgress. Could be one base class. Could be ten different classes. Could be fifty. Then after all of that work I can finally go to the widget that has to display it. Use the object passed in to call those functions.
On the other hand with composition. If someone made a component with nothing exposed. I don't need to do anything extra. They're already tracking time required, might need a percentage getter. There's already a delegate that the actors are probably using for completed/interrupted. I literally just need to look at the one component. Maybe make a couple minor function updates, and set up the widget. I don't have to care in the slightest about what is using it, because the logic is generically in the component.
And making it is just as easy. Make the line trace hit an actor. Cast to the actor and do logic there. Get your stuff working. Then when you want a second type for interaction you simple make a new component. Add a completed delegate and call it immediately on interaction started. Make the line trace find the component on the hit actor and call start interaction. Then drop the component on the actor and implement the delegate and replace the original function call. You're now using composition on that one actor. To set up a second you simply add the component to a new actor class and implement the delegate. Then you can start putting in more complex interaction logic. Hold times, or more users if you're doing singleplayer. Nothing really changes on the actors, they just run logic when it's completed. Can maybe make a new delegate that broadcasts percent changes for the hold times, etc.
You're looking to just be near it, or be looking at it?
just be near it
Your F key can do a sphere overlaps actors call. For each loop over them and cast to the class and call a custom event. That custom event can play the sound.
ill see if i can do that, thanks
it worked, thanks
So I have platforms that spawn automatically, but it looks very boring. I want it to start as white then fade to the texture. Help?
What are you struggling with?
Look up dynamic material instance
And lerp mode for material
Okey Dokie
Hey I'm struggling to update a text field in my UI using an event dispatcher.. I've created the 'call' to the dispatcher within an actor (there are about 25 of them within the level). Once they get a collision, the event gets called and I want to update a count field in the UI. Within the UI widget I'm struggling to listen for it. The bind event wants a reference to the actor and I don't know how to create that. or even why I would need it. Once the collision occurs, I just want to increment a text string on the UI by 1. Who cares which specific actor was creating the event. Is there a work around I'm missing or another way to figure out how to update the text field in the UI?
You need to understand references and how to set an object ref to the instance of the world
You want to set the text according to info of some actor in the world. But which actor? You have to set the object ref to point at the instance you want.
hey man, I started to do that but now I am stuck at the "call interface on whatever you hit..." (and to the end of the sentence).
It's just structured weirdly, sorry for misunderstanding but like I said I am new to unreal and idrk how to implement it correctly
Hi,
I'm working on a ground slam animation and need help positioning the damage area near the tip of the weapon. The weapon is its own actor, attached to the player/AI, so I can't directly get the socket location.
I thought about creating an interface to return the equipped weapon's position. Any suggestions or alternative solutions?
you are amazing
Why can't you get the socket?
I would need a reference to the weapon mesh to get the socket, from the anim notify
Why is the socket on the weapon and not the character?
How are you handling your weapons? Do you have an inventory system that's used to equip them?
The Player /AI spawns the weapon actor but they can have different weapons.
How is that handled? Through an actor component?
No just an player actor spawning the weapon actor and attaching to the player
And the weapon actor is not attached to a socket on the character?
Ok, I would first suggest you rework how that is handled. It sounds like the player and AI would end up handling the same thing differently.
As an overview, it would be beneficial having an actor component that handles equipping items (and storing a ref to the currently equipped item) that you can place on your characters. (Both player and AI) That way from the anim notify you can get the owner of the skeletal mesh then get component by class to get the 'equipment handler'. From this you can then get the current weapon being used.
The weapon is attached but i thought i cant get a socket on the weapon actor if i do not have a reference to the weapon
If the socket is on the character then it's not on the weapon actor, it's on the character's mesh and rig. So you'd need a reference to the character if you don't already have one but referencing the weapon itself shouldn't be necessary.
The socket they're after is on the mesh in the weapon. 😉
Ahh okay I see what you mean here
Then why not just make a reference to the weapon then? If that's really the case, it shouldn't be any harder than referencing the character.
I was just wondering what are some ways to get the reference without assuming it was player or AI
Is the weapon actor not a parent class that can then be used to make individual unique weapons later?
You could but that makes it class specific but something like getting the weapon should be more generic so it can be handled for both player and AI characters.
Alright, I'll let you two hash this out then.
Anyway thanks guys will try this out
Actor components and 'Get component by class' are game changes. 🙂
Not sure why clicking on a unit doesn't fire an event, have this set up:
Configured trace channel and controller is using it
Hey everyone, i'm really struggling to make a daynight cycle and then have the day/hour/minutes show up in an in game clock, can anyone point me to the right direction? Maybe a good guide or tutorial?
appreciate more a guide/tutorial that actually explains how things work so i can learn
Blueprint communication by matthew in youtube
Or the 2 hours one by epic for more comprehensive guide
You don't need a tutorial for this, it's simple.
GameState:
Tick/Timer -> has authority? -> update CurrentTime(replicated, repnotify if you want)
Clock Widget -> bind to GameState.CurrentTime
That's the simplest
the widget will check the time every frame
the time will be updated everywhere when it's updated on the server
Of course the whole setup can get vastly more involved than this but it'll get you started
Thank you! I'll try these 🙏 where can i find the epic one? Youtube?
Yeah i'm definetly still too much of a noobie to understand everything you've described here, but i'll try anyways! Thank you🙏
The serverside gamestate updates WhatTimeItIs at some interval, either on tick or on a timer if you want it to not happen every frame
Since WhatTimeItIs is a replicated variable, everyone else can just get it and know what time it is
and do whatever they want with it
I assume i need to have a daynight cycle already up and working before doing this?
Are you doing multiplayer?
nop, singleplayer
You don't have to worry about replication then 😅
Your widget job is simply to read
You typically want to make an actor that is responsible to hold the day and night system data.
The actor will hold are the variable. Time, day, weather, etc. Your widget can then get a ref to the actor and grab the information
And that actor should be the gamestate or a component on the gamestate
since a part of the state of the game is what time it is
presumably
I think i understand now, thank you both 🙏
Any ideas guys? Tried everything. 1.5h on something simple as this.. Checked with CHat GPT too.. Global click events are working. It's just either on capsuel or on mesh are not firing.
do they block the Cursor channel?
you get an actor reference as part of the hit result. Using that reference, check if it implements the interface, then call the interface on it.
If you're confussed I reccomend MathewW's video on interfaces
yessir.
That was Mesh btw. This is for capsule:
Okay, this may be it. haven't tried that
just reduced spring arm length. still not firing 😦
What's crazy is that I made this work in this other tutorial I've done and I redone all the steps the same way, and it's not firing. Although using Manny instead of other mesh but shouldn't matter maybe?
I'd ignore mesh for now and make it hit the capsule
maybe something is in the way and blocking it
line trace on tick along that channel and make sure it's hitting
Sorry,, I'm new can you elaborate pls
do some line traces or try get hit result under cursor to make sure the hit is happening
you gotta figure out if the hit isn't happening, or if the rest of the click stuff isn't happening
if you have the capability to line the camera up with the pawn try a line trace along the camera aim direction and make sure the capsule is blocking it
make sure the channel is Cursor
Is this what you mean?
whatever has your camera
just line trace from cameracomponent.location to cameracomponent.location + SomeLargeNumber x Cameracomponent.ForwardVector
Sorry, Do I draw a line trace on game start or on click? or draw and try to click it? or draw it over the pawn/char to see the trace is over or under it? I'm not sure I'm following
on tick
every frame
Tick -> line trace by channel with debug turned on
you'll see if it's hitting the thing or not
I'm trying to set an alternate camera as the player cam when possesses an actor, i seem to have it working, but there is a visible glitch as it swaps using SetTargetViewwithBlend.
Is there any way to stop it defaulting to the player character cam (on possess) ?
you spawning camera at runtime?
The player cam is standard, the additional camera I want used is spawned on an event
spawned when? show code
theres about 30 nodes in between this and the event, but this is the spawn
is that before or after possession?
before
multiplayer?
its partially replicated .. but doesn't need to be. The possess is
thanks. Like this in camera right:
sounds like a race condition
honestly if you're doing fancy camera stuff why not just manually drive the camera around and get rid of camera components?
Getting loads of False printed
your start and end are both zero ? you may need to get the cursor position ?
might as well call that a point trace 😄
😄 yeha realized that as soon as shared scr.. changin now
draw debug
also you're starting and ending the trace at 0,0,0
probably not what you want
start at camera location
Probably not yes
end at camera location + camera forward vector * somelargenumber
are you trying to get what your looking at ?
I'm trying to see why clicks on capsule are not working when global click events are fine
i have a lot tied to the 2nd entity camera so need it, its an odd scenario i guess. I use the standard character camera up until the 2 entity is spawned, then possess that second entity but want to remain in the 1st entity camera which follows the 2nd. But, I also can swap over to the 2nd entity camera lol
Nearly all of this is working, its just the transitions between the views
I think that'd def be easiest just driving one camera component around or manually driving camera location through PlayerCameraManager
getting bunch of trues now but no drawings
yea, if i didn't have so much attached to the 2nd entity cam i'd go back and do this, but its a huge amount tbh
and probably do a single line trace not multi
i would also multiply the forward vector by a float
yeah or at least 100k in all axes either one
thx
that looks goofy, show current code
in BP_PlayerCamera:
well for one thing you didn't plug your end in
ugh!
i don't know how this is supposed to help you with clicked capsule
I'm not sure either. I'm going where Adriel points me and hoping for the best
Trust the process
🙂
Tried everything else. The checkboxes, the collisions
none of these will print
this does though
do you have click events enabled in your controller ?
I don't see any hits on the capsule
show current code
and how far is camera?
target arm length: 2000.0 (from springarm)
1000 is nothing
that's 10 meters
convert that pin to a float too btw
and do a single line trace
we're trying to see if the traces are hitting at all or if there's something in the way
do a 100k trace
single line trace by channel
character ignores visibility trace, set the collision to custom and block visibility trace
or change the trace for the click events
That's what I did
Eeeccck, you're right :/
Could you add a flat bottom to the circle (like mixing a box and circle) and have it face away from where you're drawing toward?
May then look odd on turns though....
here
turn that upper pin on the multiply into a float
right click it, convert to float
plug 100k into it
Hello! How would it be best to keep a 10 slot inventory in a save game? Just a class array?
depends on what your items are
if all you care about is the class for an item then that can work
just realized you can't use set timer by event on events that require an input 😅
i think you changed the wrong one, the multiply forward vector you want to change that
Ye, I guess that's what I'll have to do. Thank you!
or just type 100000 in all 3 coordinates
right now you're multiply your forward vector in a way that skews it
z is 10k make it 100k
done
and lose the green stuff
still error
i think you're hitting something instantly
click the arrow on the bottom of line trace by channel to see what the colors mean
yeah you're hitting something right in front of the camera
print hit actor
from hit result
It's hitting my PCG component that I have disabled for now
as in it's not showing but still gets hit
Print hit component
Doesn't make any sense. I have disabled the PCG generation
but obv is still placed I guess there (yellow)
I move it away, then it's another PCG (one for buildings..)
Seems like those PCG placements are the problem..?
Put your man out in the open with nothing around him
you want hits vs his capsule
That's exactly what I'm doing now
then check if clicking works
hell yeah
so just make pcg not block it
That was... something 🙂
is cursor a custom channel?
yes
why do that instead of visibility?
is the default response block?
First off, how many things do you want to be able to click?
Default response is not block for visibility
like, everything? or just some things
You might have better luck using Visibility since most premade assets will have sane responses to it
or you can default Cursor to ignore, then opt in to blocking it in the things you want to block it
I'm guessing the default response to cursor is Block, meaning anything that doesn't indicate otherwise (your pcg volumes, literally anything) will block it
I think typically Visibility is what's used for clicking and such
might be a lot easier
I'd just use Visibility for click stuff
unless you have some reason not to?
trying to recall why I did that
this is on Capsule component
with just visibility it didnt' work
btw I think you can change collision presets
so you can set Pawn to block whatever and other things to not block or whatever you want
Custom right
anyway, problem solved, your clicking was blocked.
no you can change what Pawn means
as a collision preset
so you could have Cursor default to Ignore but Pawn preset blccks it
I'll probably reconsider using special channel
Thanks. This was v useful and illuminating
yeah there are uses for it but I think visibility might be best. Depends on the design and other things. I think visibility is what AI uses for sensing etc
Spent 3.5h but Learned other adjacent stuff
thats probably why it doesnt block it
otherwise AI couldn't look past other AI pawns
Hey Unreal Gang!
I have a project in which i have a player controlled train moving along a track/spline.
I want it to have controllable real world speed, but have noticed all the tutorials i find are based on a timeline to move the object along the spline.
So my speed is always depended on how long the spline is, which is not what i want.
Any ideas or resources to set up realistic speed in blueprints?
Tick -> PositionAlongSpline += Speed x DeltaTime -> update position
Hey can you help me with this? I have this system that lets my player draw on a canvas. I added an extra thing to make it have a set amount that can be drawn and it replaces the oldest drawn thing, basically if the player continuously draws it would look like a snake. I achieved this by having an array and saving the different draw locations and then drawing all of them again (exluding the oldest one in the array). My issue is that this is a costly way of doing it and it's making the game lag. Anyone know of a more efficient way of achieving this effect?
show the result you're after
I doubt you have to clear and then loop and draw every frame
why not just not clear then draw on top
Basically I have the system so it replaces the oldest drawn thing (the water pools), making it so there is a set amount in the world at a time
Anyone ever package their game and when you play it an entire blueprint is missing? I have an actor BP for ammo boxes all throughout my level, but when I package my game thet're not there. First thing I thought was if the "is editor only" in the cooking tab of my actors details was ticked but it nor any of it's components were. I don't know if I'm setting the mesh incorrectly, or if something funky is going on with my saves/loads. The last package I did had the ammo BPs fully functional and I hadn't made any changes. Anyone experience this?
Thinking I could just be assigning a mesh that isn't getting loaded in correctly?
Can anyone help me? I made a BTTask and defined a key in the blackboard, and it's not letting me set it here