NPC Glitch. Assistance required please! -
Apprentice - 21.05.2013
I found myself playing with the NPC features for the first time today. The tutorial by kc was most highly of assistance, I was able to get a bot driving across the server. It was rather strange at first, but amazingly cool & inspirational. A haze of new ideas flooding to my mind. But, I wish to expand on what the tutorial instructed. I found it worked great to get my bot driving around the server, but I'd like to hide him away in a closet until he's requested by means of a command.
So I check whether the player is a NPC during OnPlayerSpawn. It realizes it is & adds the rather eye pleasing 3D text, thus confirming it's recognized the check. During that same check though, it chooses to ignore SetPlayerPos. It just appears at so far, the same place everytime. Not the custom random spawns I'd set for him (to hide in the closet).
Why is this?
I tried changing the NPC playback record to 2 (on foot) instead. It still ignored it, plus surely playback doesn't need to start for the bot to be able to function basic things such as SetPlayerPos? My bot is refusing to hide into the closet. Just stands in the wrong place, unless I put him in his vehicle so he can go for a drive.
Could someone please show me where I'm going wrong? I find myself rather confused. Many kind regards.
Edit:
Quote:
Originally Posted by SA-MP Wiki
They use their own compiled scripts for this task, which have to stay inside the npcmodes directory. That is, if you want to have 20 different NPCs doing different things, you will most likely have to have 20 pawn compiled scripts inside the npcmodes directory. This doesn't mean that you can't use the normal player functions applied to your NPCs (like SetPlayerPos, for example) from inside a gamemode or filterscript.
|
Re: NPC Refuses To Hide In Closet, Loves Driving! -
Apprentice - 28.05.2013
Anyone?
Re: NPC Refuses To Hide In Closet, Loves Driving! -
DobbysGamertag - 28.05.2013
Are you using any login scripts? have you tried taking it out? I'm new to the whole NPC thing so i'm not too sure. I know my login screen stops gl_npc's from doing the required things.
Re: NPC Refuses To Hide In Closet, Loves Driving! -
Joshman543 - 28.05.2013
I believe that you should you use SetMyPos(X,Y,Z); instead of SetPlayerPos
here:
https://sampwiki.blast.hk/wiki/Category:NPC
Re: NPC Refuses To Hide In Closet, Loves Driving! -
SuperViper - 28.05.2013
Once it starts playing the recording, it will continue uninterrupted unless you use the function to stop it.
Re: NPC Refuses To Hide In Closet, Loves Driving! -
Apprentice - 28.05.2013
Quote:
Originally Posted by DobbysGamertag
Are you using any login scripts? have you tried taking it out? I'm new to the whole NPC thing so i'm not too sure. I know my login screen stops gl_npc's from doing the required things.
|
No login script.
Quote:
Originally Posted by Joshman543
|
SetMyPos is only for NPC scripts & SetPlayerPos should work in the gamemode (according to the Wiki). Hence my confusion.
Quote:
Originally Posted by SuperViper
Once it starts playing the recording, it will continue uninterrupted unless you use the function to stop it.
|
I'm trying to SetPlayerPos before the recording starts. The bot joins, but doesn't do anything until put in a vehicle (as I expected). At this point - I'm trying to SetPlayerPos. The recording is loaded etc but not working. As soon as he's put in his vehicle, he does as intended. But that space inbetween, is where I'm having the difficulty.
Thank you all for your suggestions!
Re: NPC Refuses To Hide In Closet, Loves Driving! -
Vince - 28.05.2013
Have you tried SetSpawnInfo?
Re: NPC Refuses To Hide In Closet, Loves Driving! -
Apprentice - 28.05.2013
Not in this script, it isn't used at all. Point is, according to the Wiki it should work. Hence my confusion for a solution.