SA-MP Forums Archive
Applying an animation to an idle npc? - 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: Applying an animation to an idle npc? (/showthread.php?tid=490219)



Applying an animation to an idle npc? - arko123 - 25.01.2014

How do I apply an animation to an npc with this code so far?
pawn Код:
public OnGameModeInit()
{
    ConnectNPC("[BOT]BigSmoke", "npcidle");
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        if(!strcmp(playerName(playerid), "[BOT]BigSmoke", true))
        {
            SetPlayerSkin(playerid, 269);
            SetPlayerInterior(playerid, 3);
            SetPlayerPos(playerid, 512.8655, -17.4405, 1001.5653);
            SetPlayerFacingAngle(playerid, 342.9513);
        }
}
    return 1;
}



Re: Applying an animation to an idle npc? - CyNiC - 25.01.2014

Move the code for your OnPlayerSpawn but fix the open braces first.


Re: Applying an animation to an idle npc? - arko123 - 25.01.2014

Quote:
Originally Posted by CyNiC
Посмотреть сообщение
Move the code for your OnPlayerSpawn but fix the open braces first.
Moved it to OnPlayerSpawn but even when I ApplyAnimation to the NPC is doesn't apply


Re: Applying an animation to an idle npc? - arko123 - 25.01.2014

BUMP


Re: Applying an animation to an idle npc? - CyNiC - 28.01.2014

Your bot spawns? If yes, try to preload the anim(applyanimation) before apply to him.

Not spawns? check if the file names are right, check your gamemode restrictions, or read tutorials of how to create a NPC.


Re: Applying an animation to an idle npc? - Vince - 28.01.2014

Set the animation in OnPlayerStreamIn.


Re: Applying an animation to an idle npc? - [KHK]Khalid - 28.01.2014

Use this to preload it or as mentioned above apply it OnStream.
pawn Код:
stock PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0);
}