SA-MP Forums Archive
How to make object moving step by step? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make object moving step by step? (/showthread.php?tid=291277)



How to make object moving step by step? - Artie_Scorpion - 19.10.2011

Hi i want to know how to make object moving step by step?
For ex. - object moving, then he making little step, then he turning to other side... (i hope you understood). But i want to move objects with only one command, for ex. /moveobject...


Re: How to make object moving step by step? - nilanjay - 19.10.2011

What type of object you want to move?


Re: How to make object moving step by step? - Dark_Kostas - 19.10.2011

I'm not sure if what you mean is what im going to say but anyway.

You can create a variable that will store the "step" of the object.
Then you can use OnObjectMoved having a "switch" in it for each step and moving it to the next location.

Example:
pawn Код:
new ObjectStep = 1;

//OnGameModeInit
Create your object and then move it to the 1st location

public OnObjectMoved(objectid)
{
    if(objectid == YOUR_OBJECT)
    {
        switch(ObjectStep)
        {
                case 0: //Move Object to the 1st location
                case 1: //Move Object to the 2nd location
                case 2: //Move Object to the 3rd location
        }
        ObjectStep ++;
        if(ObjectStep > YOUR_LAST_STEP) ObjectStep = 0;
    }
    return 1;
}



Re : How to make object moving step by step? - mehdi-jumper - 19.10.2011

You must use SetTimer:

If the player write /moveobject, we move to the step 1 the object. We launch a timer and after this timer, the object move to step 2 and you lauch a timer and after this timer, the object move to the step 3. Do you understand?


Re: Re : How to make object moving step by step? - Dark_Kostas - 19.10.2011

Quote:
Originally Posted by mehdi-jumper
Посмотреть сообщение
You must use SetTimer:
Why "must" use a timer when its possible and easier without it?