SA-MP Forums Archive
NPC help please. - 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: NPC help please. (/showthread.php?tid=183925)



NPC help please. - RedFusion - 17.10.2010

Hello!

I've built a house, with some strippers in it, it's nice.
But sometimes, One or two of them are just standing still (annoying), and sometimes, all of them dance and it all works fine.
I don't know what's causing this, but i have tried to figure it out for a while now, but i cant fix it!
And there's also a bartender but he's supposed to stand still, and he does.

when they connect...
Код:
public OnFilterScriptInit()
{
	SetTimer("bot1",2000,false);
	return 1;
}
Код:
public bot1(playerid)
{
    ConnectNPC("Bartender","barbot");
    SetTimer("bot2",2000,false);
    return 1;
}
public bot2(playerid)
{
    ConnectNPC("Stripper1","stripbot1");
    SetTimer("bot3",2000,false);
    return 1;
}
public bot3(playerid)
{
    ConnectNPC("Stripper2","stripbot2");
    SetTimer("bot4",2000,false);
    return 1;
}
public bot4(playerid)
{
    ConnectNPC("Stripper3","stripbot3");
    return 1;
}
...And when the bots join..
Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(!IsPlayerNPC(playerid)) return 0; // We only deal with NPC players in this script
    new playername[64];
    GetPlayerName(playerid,playername,64);
     if(!strcmp(playername,"Bartender",true))
    {
        SetPlayerSkin(playerid,188);
        SpawnPlayer(playerid);
        return 1;
    }
    if(!strcmp(playername,"Stripper1",true))
    {
        SetPlayerSkin(playerid,246);
        SpawnPlayer(playerid);
        return 1;
    }
     if(!strcmp(playername,"Stripper2",true))
    {
        SetPlayerSkin(playerid,152);
        SpawnPlayer(playerid);
        return 1;
    }
     if(!strcmp(playername,"Stripper3",true))
    {
        SetPlayerSkin(playerid,256);
        SpawnPlayer(playerid);
        return 1;
    }
    return 1;
}



Re: NPC help please. - Jeffry - 17.10.2010

OnPlayerSpawn callback? I guess there is the problem.


Re: NPC help please. - boelie - 17.10.2010

what does the timer do? and is the dancing 'recorded' or did you add dancing animations later?
If you added them later then try to initiate the animations under OnPlayerStreamedin


Re: NPC help please. - RedFusion - 17.10.2010

That timer connects the bots with 2 seconds between every bot.
I recorded their dances.

Can you please tell me how to add animations later? do i record a bot standing still and then add animation?


Re: NPC help please. - Jeffry - 17.10.2010

I guess it is not possible.
If you have recorded it with the animation, it is strange, that sometimes it is working and sometimes not.
No idea.


Re: NPC help please. - RedFusion - 17.10.2010

is there any good include file for NPC's?


Re: NPC help please. - Jeffry - 17.10.2010

What you mean with "include file" ?


Re: NPC help please. - RedFusion - 17.10.2010

.inc file

With good callbacks & Functions


Re: NPC help please. - Jeffry - 17.10.2010

For NPC's?
I can't think of a useful include for a NPC, it's just a recorded path.

But you can check out this: https://sampforum.blast.hk/showthread.php?tid=174671


Re: NPC help please. - RedFusion - 17.10.2010

Seems very good! Thanks!