SA-MP Forums Archive
NPC Wont Move :( - 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: NPC Wont Move :( (/showthread.php?tid=296150)



NPC Wont Move :( - misho1 - 10.11.2011

I Created My First NPC And IT Wont Move
And I Add The REC File In (ROOT FOLDER/npcmodes/recording)
pawn Код:
#define RECORDING "Dancer"
#define RECORDING_TYPE 2
 
#include <a_npc>
main() {}
 
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
 
#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
pawn Код:
public OnGameModeInit()
{
ConnectNPC("Bell","Dancer");
return 1;
}



Re: NPC Wont Move :( - jiwan - 10.11.2011

Hmm.... a onfoot NPC ?
if yes then use this
pawn Код:
#include <a_npc>

//------------------------------------------

main(){}

//------------------------------------------

NextPlayback()
{
  StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"your npc recording  name");
}

//------------------------------------------

public OnRecordingPlaybackEnd()
{
  NextPlayback();
}

//------------------------------------------

public OnNPCSpawn()
{
  NextPlayback();
}

//------------------------------------------

public OnNPCExitVehicle()
{
  StopRecordingPlayback();
}
and on your gamemode >>
pawn Код:
// under ongamemodeint()
ConnectNPC("NPC's name","recorded file name");



Re: NPC Wont Move :( - MP2 - 10.11.2011

Show your ConnectNPC line(s). Make sure you don't include the file extension '.rec' in ConnectNPC.


Re: NPC Wont Move :( - misho1 - 10.11.2011

what is the connect npc line?


Re: NPC Wont Move :( - iPLEOMAX - 10.11.2011

How do you record your NPC?

> You start recording
> type a command like: /dance
> then stop recording?

I don't think it will record your dance like that.

Just use ApplyAnimation in OnPlayerSpawn, if IsPlayerNPC, if strcmp Name "Bell"....


Re: NPC Wont Move :( - misho1 - 10.11.2011

I Did It And IT Wont Move
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {

  new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid,name,sizeof(name));
        if(!strcmp(name,"Bell",false))
        {
SetPlayerSkin(playerid,7);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
SetPlayerPos(playerid,2102.6191,-2638.7517,13.5469);
        }
        return 1;
    }
    return 1;
}



Re: NPC Wont Move :( - MP2 - 10.11.2011

Quote:
Originally Posted by misho1
Посмотреть сообщение
what is the connect npc line?
Use Ctrl+F and search the script for ConnectNPC. Post them ALL; not just the first you find.


Re: NPC Wont Move :( - iPLEOMAX - 10.11.2011

Special actions would require triggering I suppose. (Correct me if I'm wrong).

Like when you are smoking (special action), You need to press the Fire button to use it.
NPCs won't automatically do that.

That's why i said, you need to Apply an Animation (twice) to see it dance. Try it.


Re: NPC Wont Move :( - misho1 - 10.11.2011

I Did That And It Wont Dance And He Is Frozen In The SpawnPoint
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {

  new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid,name,sizeof(name));
        if(!strcmp(name,"Bell",false))
        {
SetPlayerSkin(playerid,7);
ApplyAnimation(playerid,"DANCING","dnce_M_a",10.0,1,1,1,1,1);
SetPlayerPos(playerid,2102.6191,-2638.7517,13.5469);
        }
        return 1;
    }
    return 1;
}



Re: NPC Wont Move :( - jiwan - 10.11.2011

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
Special actions would require triggering I suppose. (Correct me if I'm wrong).

Like when you are smoking (special action), You need to press the Fire button to use it.
NPCs won't automatically do that.

That's why i said, you need to Apply an Animation (twice) to see it dance. Try it.
i have a NPC with chat annimation !
i just applied animation and start recording and after 2-4 seconds i stopped it
it is working well !!