SA-MP Forums Archive
How can I set up bots inside any interior? - 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 can I set up bots inside any interior? (/showthread.php?tid=104404)



How can I set up bots inside any interior? - tomnidi - 24.10.2009

Hey! I got a few problems, hope you can help me :
1) - How can i set a virtual world for a specific bot?
2) - How can i set an interior for a specific bot?
3) - I recorder my self walking as a skin num 111, but when I test it on my server, I see a CJ walking. Why?
4) - I can't see the animations I recorded for my bots, why?

Can anyone help me please? thank you.


Re: How can I set up bots inside any interior? - MadeMan - 24.10.2009

Use the same functions as with other players: SetPlayerSkin, SetPlayerInterior etc.


Re: How can I set up bots inside any interior? - Cedimedi - 24.10.2009

Quote:
Originally Posted by tomnidi
Hey! I got a few problems, hope you can help me :
1) - How can i set a virtual world for a specific bot?
2) - How can i set an interior for a specific bot?
3) - I recorder my self walking as a skin num 111, but when I test it on my server, I see a CJ walking. Why?
4) - I can't see the animations I recorded for my bots, why?

Can anyone help me please? thank you.
1) SetPlayerVirtualWorld
2) SetPlayerInterior
3)SetPlayerSkin
4)Leave your server and go in again, if it don't work reload the bot


Re: How can I set up bots inside any interior? - tomnidi - 24.10.2009

Quote:
Originally Posted by (ed!med!
Quote:
Originally Posted by tomnidi
Hey! I got a few problems, hope you can help me :
1) - How can i set a virtual world for a specific bot?
2) - How can i set an interior for a specific bot?
3) - I recorder my self walking as a skin num 111, but when I test it on my server, I see a CJ walking. Why?
4) - I can't see the animations I recorded for my bots, why?

Can anyone help me please? thank you.
1) SetPlayerVirtualWorld
2) SetPlayerInterior
3)SetPlayerSkin
4)Leave your server and go in again, if it don't work reload the bot
So I can code that OnFilterScriptInit will be (SetPlayerSkin(0,111) ??
And It still doesn' show the bots animations..
Someone?


Re: How can I set up bots inside any interior? - MadeMan - 24.10.2009

Quote:
Originally Posted by tomnidi
So I can code that OnFilterScriptInit will be (SetPlayerSkin(0,111) ??
No. Like this:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        SetPlayerSkin(playerid, 111);
    }
    return 1;
}



Re: How can I set up bots inside any interior? - Cedimedi - 24.10.2009

Meh, you do that in the "OnPlayerSpawn"

Here an example:

pawn Код:
public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Bot1337", true)) // Name of your bot
    {
      SetPlayerSkin(playerid, 111);
      SetPlayerVirtualWorld(playerid, 2);
      SetPlayerInterior(playerid, 45353241);
    }
    return 1;
  }

  return 1;
Edit: Aww, MadeMan was faster^^


Re: How can I set up bots inside any interior? - tomnidi - 24.10.2009

Quote:
Originally Posted by (ed!med!
Meh, you do that in the "OnPlayerSpawn"

Here an example:

pawn Код:
public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Bot1337", true)) // Name of your bot
    {
      SetPlayerSkin(playerid, 111);
      SetPlayerVirtualWorld(playerid, 2);
      SetPlayerInterior(playerid, 45353241);
    }
    return 1;
  }

  return 1;
Edit: Aww, MadeMan was faster^^
Alright, thx I'll try it..
But there is no names for my bots IG, is that matter?
And what about the bot's animations? Why doesn't it work?


Re: How can I set up bots inside any interior? - Cedimedi - 24.10.2009

Ehm i don't know what "IG" means but anyway. Your bot have a name.
Example:

(Under OnFilterScriptInt)
ConnectNPC("Speedy_Gonzales","Bot1337record"); // Speedy_Gonzales is the Botname, Bot1337record is the record(under npcrecords)

That is the name from the bot if i understood what you mean.

_______

I had the same problem with the animations... i did nothing about it, it should work after some time. I don't know what the problem was, it could be restart or whatever.


Re: How can I set up bots inside any interior? - tomnidi - 24.10.2009

Alright, I tried it but it still doesn't work:

Under my OnGameModeInit:
ConnectNPC("FirstBot_FirstBot","JailGuy");
ConnectNPC("SecondBot_SecondBot","Test");

And:


Код:
public OnPlayerSpawn(playerid)
{
  //if(IsPlayerNPC(playerid)) return 1;
  if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "FirstBot_FirstBot", true)) // Name of your bot
    {
      SetPlayerSkin(playerid, 62);
      SetPlayerVirtualWorld(playerid, 2);
      SetPlayerInterior(playerid, 6);
    }
    else if(!strcmp(npcname, "SecondBot_SecondBot", true)) // Name of your bot
    {
      SetPlayerSkin(playerid, 111);
      SetPlayerVirtualWorld(playerid, 0);
      SetPlayerInterior(playerid, 0);
    }
    return 1;
  }
	if(gPlayerLogged[playerid])
	{
		  SetPlayerSpawn(playerid);
		  Spawned[playerid] = 1;
	}
	return 1;
}
Still doesn't work for me, Do you know why?


Re: How can I set up bots inside any interior? - CracK - 24.10.2009

ConnectNPC(name[], script[]);
Quote:

name[] The NPC name.
script[] The NPC scriptname that is located in the npcmodes folder.

NPC script, not record.