GetPlayspace() cannot be used within <concrete> class for instantiation

I want to get the Playspace and AllPlayers constants to get information about all players in the class for instantiation, but the parentheses of GetPlayspace() turn into red wavy lines.

How I get all palyers information(player) in the class for instantiation?

    weapon_changer := class<concrete>:

    @editable
    Weapon_Select_Button : button_device = button_device{}

    @editable
    Weapon_Granter : item_granter_device = item_granter_device{}

        init():void=
            Weapon_Select_Button.InteractedWithEvent.Subscribe(fun_Grant_Weapon)

        fun_Grant_Weapon(Agent:agent):void=
            Playspace : fort_playspace = GetPlayspace()  <- Red wavy line at "()"
            AllPlayers : []player = Playspace.GetPlayers()
            for (Player : AllPlayers):
                Weapon_Granter.GrantItem(Player)

Error message:
This function parameter expects a value of type tuple(creative_object_interface,tuple(),tuple()),
but argument is an incompatible value of type tuple(weapon_changer,tuple(),tuple()).)

1 Like

Looks like you are using the wrong argument type in your function. With this type of error you may want to refer to epic’s definition of the function you are listening to. Not every function uses the actor parameter, though many do.

1 Like

GetPlayspace() is a function reserved for classes that implement creative_device / creative_object_interface, which your class does not. If do
weapon_changer := class(creative_device):
it should work

3 Likes

You might also be able to do creative_device{}.GetPlayspace()

If that causes an error it may only work on Creative objects instantiated by Fortnite (since Verse will be open to more than just Fortnite eventually), but in that case it should’ve probably been failable…

2 Likes

GetPlayspace is inherited from creative_device, so it can only be used within creative_device.
I would like to learn more about the definition of Fortnite.digest.verse.
thank you very much.

1 Like

This means that it cannot be used in the class.
I decided to respond by instantiating creative_device itself.
(I can’t believe I can instantiate creative_device itself!)

thank you very much.
When I tried it, I still got an error with just the parent device, so I was able to succeed by also placing the creative_device on the instantiation side!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.