21.05.2013, 00:01
(
Последний раз редактировалось Apprentice; 21.05.2013 в 21:52.
)
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:
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.
|