how can i make a teleporter moving along the map on a straight line with verse code because i cannot connect it with prop_mover
Here’s something super basic to get a prop to move to a point.
You can expand on this and add multiple points or just a point a and b and have a loop that constantly moves the tp from point a to b and back.
Simple Example would be
Device_Name := class(creative_device):
@editable TP : teleporter_device = teleporter_device{}
@editable Prop : creative_prop = creative_prop{}
OnBegin<override>()<suspends>:void=
spawn:
Move_TP_Device(TP, Prop)
Move_TP_Device(tp:teleporter_device, prop:creative_prop)<suspends>:void=
Prop1Transform := prop1.GetTransform()
tp.MoveTo(Prop1Transform, 10.0)
A loop would look something like this
Move_TP_Device(tp:teleporter_device, Prop_A:creative_prop, Prop_B:creative_prop)<suspends>:void=
var AtPointA : logic = true #used for tracking the state of where the TP is.
Move_Time := 20.0 # change this to however long you want it to take for the TP to move from point to point
Point_A := Prop_A.GetTransform()
Point_B := Prop_B.GetTransform()
if(tp.TeleportTo[Point_A]): #just to make sure the TP is actually at point a before the loop starts because it assumes that the starting point of the TP is point a since we initialize AtPointA as true
loop:
if(AtPointA = true):
tp.MoveTo(Point_B, Move_Time)
set AtPointA = false
else if(AtPointA = false):
tp.MoveTo(Point_A, Move_Time)
set AtPointA = true
Alternatively you can also have an array of props to move to this will work without having to set a logics value to true and false and should also work with just 2 props
Move_TP_Device(tp:teleporter_device, Props:[]creative_prop)<suspends>:void=
loop:
Sleep(0.01)
Move_Time := 20.0 #enter whatever you want here
for(Prop:Props):
TPLoc := tp.GetTransform().Translation
PropLoc := GetTransform().Translation
Dist := Distance(TPLoc, PropLoc)
if(Dist >= 5.0): # will only move to props if the distance between them is greater than whatever threshold you set
tp.MoveTo(PropLoc, rotation{}, Move_Time)