Guard Spawner SpawnAt() Function

Has anyone been able to get the new Guard Spawner SpawnAt() function (introduced in the 39.0 update) to work yet?

When I try to use it, I get the error:

This function parameter expects a value of type tuple(vector3,?Rotation:?rotation = …), but this argument is an incompatible value of type tuple(vector3,?rotation)

This is the code that I was trying to run:

    NewPosition : vector3 = vector3{X := 32600.0, Y := -34500.0, Z := 1450.0}

    NewRotation : ?rotation = option{MakeRotationFromYawPitchRollDegrees(90.0, 0.0, 0.0)}

    SpawnedAgent := Guard1.SpawnAt(Position := NewPosition, Rotation := NewRotation)

Any help anyone could provide would be greatly appreciated. :grinning_face:

You were using the UnrealEngine spatial math module, meanwhile the SpawnAt uses the Verse SpatialMath module, Here’s a compilable version of your code

using { /Verse.org/SpatialMath }

Test(Guard1:guard_spawner_device)<suspends>:void=
    NewPosition : vector3 = vector3{Left := 32600.0, Up := -34500.0, Forward := 1450.0}

    NewRotation : ?rotation = option{MakeRotationFromYawPitchRollDegrees(90.0, 0.0, 0.0)}

    SpawnedAgent := Guard1.SpawnAt(NewPosition,?Rotation:=NewRotation)
1 Like

Thank you! I greatly appreciate your timely response. :smile:

1 Like

Happy as always to help when I can <3

Hey,

I copied it exactly.

    SpawnFiendT1()<suspends>:void=
        Transform:=FiendCreatureSpawnerT1.GetTransform()
        Position:=Transform.Translation
        BaseRotation:?rotation= option{MakeRotationFromYawPitchRollDegrees(0.0,0.0,0.0)}
        FiendCreatureSpawnerT1.SpawnAt(Position,?Rotation:=BaseRotation)

But I still get the error

This function parameter expects a value of type tuple(vector3,?Rotation:?rotation = …), but this argument is an incompatible value of type tuple(vector3,?Rotation:?rotation).

1 Like

Here you go, this should result in 0 errors just make sure to have the Unreal Engine spatial math module at the top of your verse file, I changed it so It uses the FromVector3 and FromRotation so they convert to the required type.

using { /UnrealEngine.com/Temporary/SpatialMath }
SpawnFiendT1()<suspends>:void=
    Transform:=FiendCreatureSpawnerT1.GetTransform()
    Position:=FromVector3(Transform.Translation)
    BaseRotation:rotation= MakeRotationFromYawPitchRollDegrees(0.0,0.0,0.0)
    FiendCreatureSpawnerT1.SpawnAt(Position,?Rotation:=option. FromRotation(BaseRotation))
2 Likes

That seemed to have worked thanks! Although I will say this has to be the least optionable parameter I have ever seen to the point it seems like a bug.

1 Like

But it is optional? You can remove the Rotation part and code will compile just fine and it will instead use the rotation of the creature spawner device.

The main problem was that you were using the outdated unreal engine spatial math (transform/vector3/rotation) module instead of the new LUF Verse Spatial Math Module

So when I use the /Verse.org/SpatialMath it requires the rotation parameter. But when I just use the /UnrealEnging.com/Temporary/SpatialMath it does not require the rotation parameter. Which is odd because the function is defined as using the verse spatial math.

–edit

Using the top version that compiles does not actually spawn the creatures

Nope that is not true, Rotation is optional, YOU CAN NOT use /UnrealEnging.com/Temporary/SpatialMath as the SpawnAt parameter.
It strictly requires a vector3 from the /Verse.org/SpatialMath module.

Epic has kindly provided the FromVector3 utility function inside the /UnrealEnging.com/Temporary/SpatialMath module that when run

Converts
/UnrealEnging.com/Temporary/SpatialMath Vector3 to /Verse.org/SpatialMath Vector3

/Verse.org/SpatialMath Vector3 to /UnrealEnging.com/Temporary/SpatialMath Vector3

Essentially FromVector3 converts the value to the other module

1 Like