automatic movement of an object
#1

Please help people, have long been trying to create an object that would, without a team, moving from one point to another, and then moved back to the beginning and repeat the cycle. Please write one example of who can ....
Reply
#2

For example set a timer for some time..
or check the positions of object and end position using some function for example GetDistanceBetweenPoints or ST like that..
Reply
#3

as an example can be? I'm all mixed up with them ....
Reply
#4

pawn Код:
MoveObject(objectid, X, Y, Z, speed);
SetTimerEx("CheckTimer", 250, true, "ifff", objectid, X, Y, Z);
and timer

pawn Код:
public CheckTimer(objectid, Float:X, Float:Y, Float:Z)
{
new ox, oy, oz; //they are all float
GetObjectPos(objectid, ox ,oy, oz);
if(GetDistanceBetweenPoints(X, Y, Z, ox, oy, oz) < 4.0) MoveObject(objectid, otherX, otherY, otherZ
}
or ST like that
Reply
#5

you dont need a timer for that

pawn Код:
//Somewhere you want to start the movement
MoveObject(THE_OBJECTID, Destination_X, Destination_Y, Destination_Z, speed);
pawn Код:
public OnObjectMoved(objectid)
{
    static bool:O1_Position;
    if((O1_Position = !O1_Position))
        MoveObject(objectid, Start_X, Start_Y, Start_Z, speed);
    else    MoveObject(objectid, Destination_X, Destination_Y, Destination_Z, speed);
}
thats all
Reply
#6

But for me OnObjectMoved didnt work. So I have to use timer. :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)