How to apply animation to NPC?
#1

Hey guys, how can i apply an animation to a NPC?

i tried to following but it didnt work:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
    PreloadAnimLib(playerid,"BOMBER");
    PreloadAnimLib(playerid,"RAPPING");
        PreloadAnimLib(playerid,"SHOP");
    PreloadAnimLib(playerid,"BEACH");
    PreloadAnimLib(playerid,"SMOKING");
        PreloadAnimLib(playerid,"FOOD");
        PreloadAnimLib(playerid,"ON_LOOKERS");
        PreloadAnimLib(playerid,"DEALER");
    PreloadAnimLib(playerid,"CRACK");
    PreloadAnimLib(playerid,"CARRY");
    PreloadAnimLib(playerid,"COP_AMBIENT");
    PreloadAnimLib(playerid,"PARK");
    PreloadAnimLib(playerid,"INT_HOUSE");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"PED");
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "NPC", true))
    {
      SetPlayerSkin(playerid,104);
      SetPlayerPos(playerid,221.448440,1241.429443,1082.140625);
      SetPlayerFacingAngle(playerid,245);
      GivePlayerWeapon(playerid,22,1000);
      ApplyAnimation(playerid,"PED","gang_gunstand",4.0,1,1,1,1,1);
    }
}
Reply
#2

Just record your animation ingame.
Reply
#3

I want to know too..
Reply
#4

i know its possible with recording the npc, but isnt there just a simple function to apply an animation on him? because you can set the position of an NPC too etc :S (i also needa know how to give the NPC a weapon without recording), i also know its possible to set an animation for an NPC cuz i have seen it on some servers.
Reply
#5

btw, i tried it with the record npc, the give weapons did work but the animation wasnt visible :S
Reply
#6

Quote:

btw, i tried it with the record npc, the give weapons did work but the animation wasnt visible :S

Wich weapon is the npc using? cuz i found out an npc that shoots with Rocketlauncher wont animate and you cant even see the rocket going.
Anyway you could use SendCommand("/animatesomething") ; in the npc script
and then all you have to do is make a command in a normal script FS or GM that executes your anim


EDIT: you can also do it the way you are showing us but the anim wont load when you go towards the npc when your ingame.
You need OnplayerStreamIn for that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)