Hey Fellas,
I am somewhat new to unrealscript and have been trying to figure out how to get something done for a friend and am at a loss. I have looked throughout the forums and the internet and can't find anything about moving kactors so I guess this is my last hope.
The question is using a pre-defined script that has a "discoball" move in a square path, how can one edit that KActor so that it does a full 360 degree rotation?
The task is to get the Timer function to somehow increase the angle until a full circle is completed on the x and y axis.
Also this is through the Unreal Tournament 2004 engine if that makes a difference.
This is the code:
//======================================================================
// #1
class DiscoBallB extends KActor placeable;
var private int Next;
var private float TimerD;
enum SIDES{
TOP,
LEFT,
BOTTOM,
RIGHT
};
const PATHS = 4;
var Vector Square[PATHS];
// #2
function PreBeginPlay() {
// Called once to set initial values
SetTimeD(9.0);
// From the KActor class
SetTimer(TimerD, true);
// Set for this class
Next = 0;
}
// #3
private function CreatePaths(){
Square[SIDES.TOP] = vect(40.0 ,0, 0);
Square[SIDES.LEFT] = vect(0, 0, -40.0);
Square[SIDES.BOTTOM] = vect(-40.0 ,0, 0);
Square[SIDES.RIGHT] = vect(0, 0, 40.0);
}
// Accessor for the array
private function Vector GetPath(SIDES path){
return Square[path];
}
function PostBeginPlay() {
Velocity = vect(0 , 0, 0);
CreatePaths();
}
// #4
function Timer() {
ChangePath();
}
// #5
// Sets initial values for the time durations
// Call once to set the inital state of the class
private function SetTimeD(float dur){
if(dur < 0){
dur = 0;
}
TimerD = dur;
}
// #6
// Creates a "square" path for the object
private function ChangePath(){
if(Next == SIDES.TOP){
// positive x direction
Velocity = GetPath(SIDES.TOP);
Next++;
}else if(Next == SIDES.LEFT){
// negative z direction
Velocity = GetPath(SIDES.LEFT);
Next++;
}else if(Next == SIDES.BOTTOM){
// negative x direction
Velocity = GetPath(SIDES.BOTTOM);
Next++;
}else if (Next == SIDES.RIGHT){
// posivite z direction
Velocity = GetPath(SIDES.RIGHT);
Next = SIDES.TOP;
}else{
Next = SIDES.TOP;
}
}
I truly thank anyone who can help me with this. I have been slaving over it for a week now and can't figure it out whatsoever.
I am somewhat new to unrealscript and have been trying to figure out how to get something done for a friend and am at a loss. I have looked throughout the forums and the internet and can't find anything about moving kactors so I guess this is my last hope.
The question is using a pre-defined script that has a "discoball" move in a square path, how can one edit that KActor so that it does a full 360 degree rotation?
The task is to get the Timer function to somehow increase the angle until a full circle is completed on the x and y axis.
Also this is through the Unreal Tournament 2004 engine if that makes a difference.
This is the code:
//======================================================================
// #1
class DiscoBallB extends KActor placeable;
var private int Next;
var private float TimerD;
enum SIDES{
TOP,
LEFT,
BOTTOM,
RIGHT
};
const PATHS = 4;
var Vector Square[PATHS];
// #2
function PreBeginPlay() {
// Called once to set initial values
SetTimeD(9.0);
// From the KActor class
SetTimer(TimerD, true);
// Set for this class
Next = 0;
}
// #3
private function CreatePaths(){
Square[SIDES.TOP] = vect(40.0 ,0, 0);
Square[SIDES.LEFT] = vect(0, 0, -40.0);
Square[SIDES.BOTTOM] = vect(-40.0 ,0, 0);
Square[SIDES.RIGHT] = vect(0, 0, 40.0);
}
// Accessor for the array
private function Vector GetPath(SIDES path){
return Square[path];
}
function PostBeginPlay() {
Velocity = vect(0 , 0, 0);
CreatePaths();
}
// #4
function Timer() {
ChangePath();
}
// #5
// Sets initial values for the time durations
// Call once to set the inital state of the class
private function SetTimeD(float dur){
if(dur < 0){
dur = 0;
}
TimerD = dur;
}
// #6
// Creates a "square" path for the object
private function ChangePath(){
if(Next == SIDES.TOP){
// positive x direction
Velocity = GetPath(SIDES.TOP);
Next++;
}else if(Next == SIDES.LEFT){
// negative z direction
Velocity = GetPath(SIDES.LEFT);
Next++;
}else if(Next == SIDES.BOTTOM){
// negative x direction
Velocity = GetPath(SIDES.BOTTOM);
Next++;
}else if (Next == SIDES.RIGHT){
// posivite z direction
Velocity = GetPath(SIDES.RIGHT);
Next = SIDES.TOP;
}else{
Next = SIDES.TOP;
}
}
I truly thank anyone who can help me with this. I have been slaving over it for a week now and can't figure it out whatsoever.