#๐Ÿ˜ญ

1 messages ยท Page 1 of 1 (latest)

open nymph
#

Balls. What is it you're trying to do? Might be another way around it

#

Just call the get actors of class function?

brave cosmos
proven pine
#

what you need world for ?

brave cosmos
#

I am trying to create like a component for level blueprint so it can stay isolated and filtered however level blueprint can't have components so I thought of using object but the object doesn't have access to the world freely

proven pine
#

why do you want a component on level blueprint ?

#

using level blueprint is usually not recommended

brave cosmos
#

I am basically trying to get a specific component from all the actors in the world and set them up. Since this acts as global variable which they all use to submit and receive orders from

open nymph
#

I think you want to look into a GameState class potentially?

brave cosmos
open nymph
#

Or, a world subsystem

brave cosmos
#

I will have to look into both of these things

proven pine
#

game mode, game state

#

hud, a manager actor

#

any actor you don't remove from the scene should be "persistent"

brave cosmos
#

I see I will look into those. I basically wanted this to work closely with the game saving system and I though something like this would seem better

open nymph
#

Ok yeah, you definitely want a GameInstance, GameMode or GameState class.

My game saving logic usually lives in the GameInstance as it's available from the moment your game starts

brave cosmos
#

I am basically creating a component that specifically stores the current progress of the game and its objective to the save system so I needed it to be somewhere from where it can be accessed easily and I only know about gameinstance and levelinstance to store things globally

brave cosmos
#

so it can only get called by the world and can't directly interact with the world

proven pine
#

what do you need to interact ?

#

the game instance is the only thing that persists through multiple levels

brave cosmos
#

like here when I try to get all the actors in the world

proven pine
#

so your pretty much stuck with it

proven pine
#

is all in the world

brave cosmos
proven pine
#

you can pass any actor

brave cosmos
#

I have to go for now. Thank you for the help so far

proven pine
#

this is a blueprint function library

#

you need to world context

#

and you just pass any actor in

brave cosmos
# proven pine and you just pass any actor in

Allow me to elaborate on what I am doing. I am creating a component(isolated part) whose only job is to store the progress of events that are currently waiting to be completed and the ones that are completed. So it basically saves the current state of the gameplay and not the player itself. Its only task is to load the level's state to what it was before quiting/saving the game. As just it needs to be binded to the level alone as it needs to only work when the level begins or when the player quits the level. And as this component is responsible for loading the state of the gameplay at runtime it needs to get the reference of the world to set it as per saved data and thats why it needs the world reference.

proven pine
#

"you cannot directly attach a component to the "world" in Unreal Engine because components are designed to be attached to other components or actors" -AI

brave cosmos
# proven pine

As for this I've already tried it but I guess its bug in unreal that function library's change doesn't get updated too quickly for now I am about the game state and world subsystem for now. and then I'll decide where exactly to attach this componenet

brave cosmos
proven pine
#

so ig you can have a save for each level

brave cosmos
#

and for where I should store it, in level blueprint, gamemode or if any other place is recommend please do tell.

proven pine
#

i don't understand what it's storing ?

#

what is thing even doing ?

#

wdym the levels state ?

brave cosmos
subtle widget
#

noob question. why we cant just put actor in level -> add component to this actor -> craete some dispatchers/interfaces to tell him when to do his saving stuff?

proven pine
#

yes a amanager actor you can defiantely use, but each level would require a custom one

proven pine
brave cosmos
# proven pine wdym the levels state ?

basically if player has a bunch of objectives. Its storing which ones have been completed and which ones are next as well as which subsequent areas has been unlocked a result of completing the old objectiv3es

proven pine
#

just an array of objectives would be fine

#

make an objective struct, make an array, flip a boolean on completed

brave cosmos
#

and they needs to be adjusted to the saved state when the saved file is loaded

proven pine
#

well idk about the saving/loading part that may need world

brave cosmos
proven pine
#

but it doesn't sound like you need world at all

brave cosmos
#

probably

#

for now I just want to know the best place to store this component

proven pine
#

it's not a component

#

it would just be some functions

#

unless you use a manager actor

#

like mentioned you can do that

brave cosmos
proven pine
#

at which point you would attach the component

subtle widget
#

hm. i have checkpoint. but they save rn only character/chest position. Just put it in world. and the contact my BP_SaveGame. thats all

brave cosmos
proven pine
#

it's very common to save stuff

proven pine
subtle widget
proven pine
#

it's up to you

#

but not the level blueprint lol

brave cosmos
#

For now I'll look into world subsystem and game state

proven pine
#

game state

#

would be the most fitting

brave cosmos
#

otherwise I'll store it in gamemode

proven pine
#

just literally "game state" the state of the game

brave cosmos
#

yes, let me look into them

#

Thanks for the insight!