small help in moveobject
#1

hello all !

this object's:

pawn Код:
CreateObject(2905,-2131.82617188,152.00000000,35.00876617,270.00000000,0.00000000,180.00000000); //object(kmb_deadleg) (3)
CreateObject(2905,-2131.82617188,152.17556763,35.00876617,270.00000000,0.00000000,179.99450684); //object(kmb_deadleg) (4)
CreateObject(2907,-2131.86035156,152.11634827,35.31094360,270.00000000,0.00000000,270.00000000); //object(kmb_deadtorso) (3)
CreateObject(2906,-2131.67358398,151.92774963,35.46328735,0.00000000,0.00000000,270.00000000); //object(kmb_deadarm) (3)
CreateObject(2906,-2131.70556641,152.26000977,35.46328735,0.00000000,180.00000000,270.00000000); //object(kmb_deadarm) (4)
CreateObject(2908,-2131.81958008,152.08401489,35.85238647,270.00000000,0.00000000,180.00000000); //object(kmb_deadhead) (2)
components of a zombie.
i try to do it will attack a particular player. But all these objects move toward the player at the same time. And without being separated from each other.

any idea / method of how I do it?

thanks in advance helpers
Reply
#2

settimer to 500 mili-seconds, and move object..
Reply
#3

Really helped me here ...

If I do just MoveObject the player's position, then it goes to separate objects from each other in the end ..
Reply
#4

I wrote a simple system for you incase you want to use it, i haven't tested it but i cant see a problem with it. You can use this code in your own i left the include lines for testing for errors.

pawn Код:
#include <a_samp>

#define ZOMBIE_RANGE                    (2.0)
#define ZOMBIE_UPDATE_TIME              (535)

new gZombieObjects[6];
new gZombieTimerID;

forward ZombieUpdate(playerid, Float:speed);

public OnGameModeInit()//or put this in OnFilerScriptInit if it is a filterscript.
{
    gZombieObjects[0] = CreateObject(2905,-2131.82617188,152.00000000,35.00876617,270.00000000,0.00000000,180.00000000); //object(kmb_deadleg) (3)
    gZombieObjects[1] = CreateObject(2905,-2131.82617188,152.17556763,35.00876617,270.00000000,0.00000000,179.99450684); //object(kmb_deadleg) (4)
    gZombieObjects[2] = CreateObject(2907,-2131.86035156,152.11634827,35.31094360,270.00000000,0.00000000,270.00000000); //object(kmb_deadtorso) (3)
    gZombieObjects[3] = CreateObject(2906,-2131.67358398,151.92774963,35.46328735,0.00000000,0.00000000,270.00000000); //object(kmb_deadarm) (3)
    gZombieObjects[4] = CreateObject(2906,-2131.70556641,152.26000977,35.46328735,0.00000000,180.00000000,270.00000000); //object(kmb_deadarm) (4)
    gZombieObjects[5] = CreateObject(2908,-2131.81958008,152.08401489,35.85238647,270.00000000,0.00000000,180.00000000); //object(kmb_deadhead) (2)
}

public ZombieUpdate(playerid, Float:speed)
{
    static
        Float:fOx, Float:fOy, Float:fOz;
       
    GetObjectPos(gZombieObjects[0], fOx, fOy, fOz);

    if(IsPlayerInRangeOfPoint(playerid, ZOMBIE_RANGE, fOx, fOy, fOz))
    {
        //take health/kill? Make zombie dissapear?
        KillTimer(gZombieTimerID);
    }
    else
    {
        static
            Float:fPx, Float:fPy, Float:fPz;
        GetPlayerPos(playerid, fPx, fPy, fPz);
        MoveObject(gZombieObjects[0], fPx, fPy, fPz, speed);
        MoveObject(gZombieObjects[1], fPx, fPy, fPz, speed);
        MoveObject(gZombieObjects[2], fPx, fPy, fPz, speed);
        MoveObject(gZombieObjects[3], fPx, fPy, fPz, speed);
        MoveObject(gZombieObjects[4], fPx, fPy, fPz, speed);
        MoveObject(gZombieObjects[5], fPx, fPy, fPz, speed);
    }

}

MoveZombieToPlayer(playerid, Float:speed)
{
    new
        Float:fPx, Float:fPy, Float:fPz;
    GetPlayerPos(playerid, fPx, fPy, fPz);
    MoveObject(gZombieObjects[0], fPx, fPy, fPz, speed);
    MoveObject(gZombieObjects[1], fPx, fPy, fPz, speed);
    MoveObject(gZombieObjects[2], fPx, fPy, fPz, speed);
    MoveObject(gZombieObjects[3], fPx, fPy, fPz, speed);
    MoveObject(gZombieObjects[4], fPx, fPy, fPz, speed);
    MoveObject(gZombieObjects[5], fPx, fPy, fPz, speed);
    gZombieTimerID = SetTimerEx("ZombieUpdate", ZOMBIE_UPDATE_TIME, true, "df", playerid, speed);
}
If you use it let me know if it works
Reply
#5

ok i try this .
thank you
Reply
#6

not work.
the parts are breaking down while the zombie is moving..
help please.
Reply
#7

UP...
Please help
Reply
#8

please help...
this very importent..
Reply
#9

UP..............
Reply
#10

More up...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)