Lait
11-29-2009, 11:47 PM
Hey, I'm trying to create a way to make the Whizzle character teleport to a new location. This is my Tick() function:
simulated event Tick(float DT)
{
local vector destination;
super.Tick(DT);
//Create an arbitrary destination to teleport to
destination.X = 0;
destination.Y = 120;
destination.Z = 500;
//Teleport to the destination
TeleportTo(destination);
}
Basically, when Tick() is called, the Whizzle character should teleport to the destination. I know this code is kinda silly - once the Whizzle character teleports the first time it will keep teleporting to the same destination. Also recreating the same teleport destination every time Tick() is called is also silly.
This is my TeleportTo() function:
simulated function TeleportTo(vector destination)
{
//To teleport, just set our location to the destination?
//This doesn't seem to work, though.
SetLocation(destination);
}
The problem is that this function doesn't move the Whizzle character. The Whizzle character just stays in place. If I set a few log commands around TeleportTo(), though, I find that the location does, in fact, change. However, the location reverts back before Tick() is called again! Basically, the teleport works, but the location is reset each time, so the teleport has no effect. If you guys want, I can post the rest of my source code if you think the problem is unrelated to the code that I posted.
Basically, does anyone know of a way to teleport the Whizzle character to a new location?
simulated event Tick(float DT)
{
local vector destination;
super.Tick(DT);
//Create an arbitrary destination to teleport to
destination.X = 0;
destination.Y = 120;
destination.Z = 500;
//Teleport to the destination
TeleportTo(destination);
}
Basically, when Tick() is called, the Whizzle character should teleport to the destination. I know this code is kinda silly - once the Whizzle character teleports the first time it will keep teleporting to the same destination. Also recreating the same teleport destination every time Tick() is called is also silly.
This is my TeleportTo() function:
simulated function TeleportTo(vector destination)
{
//To teleport, just set our location to the destination?
//This doesn't seem to work, though.
SetLocation(destination);
}
The problem is that this function doesn't move the Whizzle character. The Whizzle character just stays in place. If I set a few log commands around TeleportTo(), though, I find that the location does, in fact, change. However, the location reverts back before Tick() is called again! Basically, the teleport works, but the location is reset each time, so the teleport has no effect. If you guys want, I can post the rest of my source code if you think the problem is unrelated to the code that I posted.
Basically, does anyone know of a way to teleport the Whizzle character to a new location?