How to teleport units (like GI does)?

Sorry, my English is poor. This is from automatic translation

I want to be a monster siege mod, need: getcoords () after conversion to {x, y, Z}

Add random changes and switch back to coords

I’ve noticed that GI can TeleportPlayer, and maybe you can help me transform coords and {x, y, Z} into each other

Unfortunatelly there is no way to get the actual coordinate values. All you can do is getting the coordinates of an entity and swapping it by another entitie’s coordinates.

local coords = Entity:GetCoords()
Entity2:SetCoords(coords)

So how does GI TeleportPlayer work

I’ve noticed that GI can be TeleportPlayer to previous record points when characters enter the world

If it’s a way to place entities, they can’t be placed without loading the map

Does he place an entity that follows the character SaveFile?

GI works via code injection / memory modification and is way outside what can be done with the official toolset.

1 Like

The way setcoords () works causes the monster to overlap

Game. Teleportplayer() does not overlap, but is nearby, but does not work properly for NPC

How to solve the problem of monster overlapping

I don’t know if this is useful for what you’re trying to achieve,
but GI uses the same routine that the console command “game.Teleport x y z” use.
You can use the “Character.LogData true” command to show the coordinates of the entities
(but the coordinates are only visible with GI; Grim Dawn removed the coords display some time ago).

If you’re looking for a Lua command to teleport your char, I don’t think there is one (but I’m not at home to verify it.)

Is there any way to solve the problem of monster overlapping

The monsters I refreshed with setcoords () are all overlapped

Can game.teleport X Y Z work correctly for entities other than player

What do you mean with “overlap”?
Can you provide a screenshot?

“game.teleport” works only for the player.

Sorry, my English is too bad. I can only use machine translation
I don’t know if this statement can be made clear

It means that monsters are all in one coordinate, and there are countless monsters in this coordinate at the same time. Just like ghosts, there is no collision volume of body

Probably the setcoords() routine is executed every time; set a variable to determine if it was already called.

My English knowledge is limited too :wink:
I don’t think I can help you with your issue.

Thank you for your help

Maybe we have to wait for the crate to open up more functions to realize these ideas

It sounds to me like you are setting all entity coords to the same value.
Eg. local coords = Entity.GetCoords()
Entity2.SetCoords(coords)
Entity3.SetCoords(coords)
Entity4.SetCoords(coords)

When you probably should be changing them in some way, whether by having something like this:
local coords1 = Entity1GetCoords()
local coords2 = Entity2.GetCoords()
local coords3 = Entity3.GetCoords()
Entity1.SetCoords(coords3)
Entity2.SetCoords(coords1)
Entity3.SetCoords(coords2)
As an example.

Or by somehow getting one entity’s coords (or just arbitarily assigning coordinates) and setting other entitiy coords by using that coords modifed by different amounts. I’m not familiar with the programming language grim dawn uses for this, so I can’t give a usable example.
Perhaps it might look something like this:
local Xpos = Entity1.Xcoordinate
local Ypos = Entity1.Ycoordinate
local Zpos = Entity1.Zcoordinate
Then
Entity2.Xcoordinate is Xpos +,-, or * random float
Entity2.Ycoordinate is Ypos +,-, or * random float
Entity2.Zcoordinate is Zpos +,-, or * random float
And then repeat for each other entity.

Entity2.GetCoords()
What you get is a LUA Userdate(or Light Userdate)
The problem is that now I don’t know the structure of this UserData. Naturally, it can’t make a new coordinate that conforms to the specification

And I know that the real coordinates are in entity.origin, which is also UserData

If you have a way to analyze Lua usedata, you can analyze the real coordinates from entity.origin

So that we can make coordinates that meet the specifications

The question is can Lua operate UserData? I don’t know if there is such a method