Applying an animation to an idle npc?
#1

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;
}
Reply
#2

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

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
Reply
#4

BUMP
Reply
#5

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.
Reply
#6

Set the animation in OnPlayerStreamIn.
Reply
#7

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);
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)