SA-MP Forums Archive
How to apply animation to 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to apply animation to NPC? (/showthread.php?tid=190543)



How to apply animation to NPC? - DaneAMattie - 15.11.2010

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



Re: How to apply animation to NPC? - [MWR]Blood - 15.11.2010

Just record your animation ingame.


Re: How to apply animation to NPC? - The_Moddler - 15.11.2010

I want to know too..


Re: How to apply animation to NPC? - DaneAMattie - 15.11.2010

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.


Re: How to apply animation to NPC? - DaneAMattie - 15.11.2010

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


Re: How to apply animation to NPC? - boelie - 15.11.2010

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