[NPC] Blink Problem
#1

Well we got our NPCs to login on our test server ( LARP EDIT ).

First step:

We Created a user ini for example:

NPC_BOT.ini

containing:

Quote:

Key=password //---- this is the login password for our NPC
Level=1
AdminLevel=0
DonateRank=0
UpgradePoints=0
ConnectedTime=21
Registered=1 //-----this u need to set to 1 then ur NPC will not be asked for tutorial or something =)
Sex=0
Age=0
Origin=0
CK=0
Muted=0
Respect=14
Money=1000300
Bank=8446
Crimes=0
Kills=0
Deaths=0
Arrested=0
WantedDeaths=0
Phonebook=0
LottoNr=0
Fishes=0
BiggestFish=0
Job=0
Paycheck=2716
HeadValue=0
Jailed=0
JailTime=0
Materials=0
Drugs=0
Leader=0
Member=0
FMember=0
Rank=0
Char=162 // ---- this is the skin ID u want that the NPC uses if he spawns.
ContractTime=0
DetSkill=0
SexSkill=0
BoxSkill=0
LawSkill=0
MechSkill=0
JackSkill=0
CarSkill=0
NewsSkill=0
DrugsSkill=0
CookSkill=0
FishSkill=0
pSHealth=0.0
pHealth=100.0
Int=0
Local=0
Team=3
Model=7
PhoneNr=273332
Car=999
Car2=999
Car3=999
House=255
Bizz=255
Pos_x=-906.4
Pos_y=-1096.9
Pos_z=98.3
CarLic=0
FlyLic=0
BoatLic=0
FishLic=0
GunLic=0
Gun1=0
Gun2=0
Gun3=0
Gun4=0
Ammo1=0
Ammo2=0
Ammo3=0
Ammo4=0
CarTime=0
PayDay=3
PayDayHad=0
Watch=0
Crashed=0
Wins=0
Loses=0
AlcoholPerk=0
DrugPerk=0
MiserPerk=0
PainPerk=0
TraderPerk=0
Tutorial=0
Mission=0
Warnings=0
VirWorld=0
Fuel=0
Married=0
MarriedTo=
FishTool=0
Note1=
Note1s=0
Note2=
Note2s=0
Note3=
Note3s=0
Note4=
Note4s=0
Note5=
Note5s=0
InvWeapon=0
InvAmmo=0
Lighter=0
Cigarettes=0
Locked=0

* we edited this with "pawno"

2nd Step:

We opened our Gamemode and editet the line(s) where it asks what it should do if a player conbnects:

Quote:

public OnPlayerConnect(playerid) //--- gamemode asks what to do when:...
{
if (IsPlayerNPC(playerid)) //-- a player is an NPC ...
{
OnPlayerCommandText(playerid,"/login password"); //-- the NPC types in "/login password " without the "" becuz we...
SendClientMessageToAll(0x00000000,"An NPC connected!"); //configured the password for our NPC to passwordin our NPC_BOT.ini after this the NPC logs in.
return 1;
}
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(Security != 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "text text.");
Kick(playerid);
return 1;
}
new namestring = strfind(plname, "_", true);
if(namestring == -1)
{
SendClientMessage(playerid, COLOR_YELLOW2, "text text text.");
SendClientMessage(playerid, COLOR_YELLOW2, "more text more text more text.");
Kick(playerid);
return 1;
}

3rd step

after this we logged in with our admin account and recorded a *.rec file

/rcon login RCONPW

/rcon loadfs npc_record

/ofrecord NPC1 ( ofrecord= on foot record , NPC1 is the name or rthe rcord file )

after u recorded what u want to do with the npc we typed:

/stoprecord

ok now we copied and compiled our files like the nice tutorial said it:

http://forum.sa-mp.com/index.php?topic=119947.0 //--- we edited the names mynpc,dave ect. with our own file names so dont be confused ^^

after all we stared our server and the NPCs did what we recorded ^^

but now...

we have the next 2 problems

1: the NPCs are "blinking"

look at the video at minute 1:48 ...
http://www.youtube.com/watch?v=wq745By4x0g
it looks like they respawn again and again -.-


at this point i will thanks to all who worked on the NPC function on samp and for the nice tutorial.

we have shared the info how we got our NPCs to login on a LARP / GF edit =)
and now maybe someone can help us fix the "blink" bug on our npcs?



the 2nd problem is that we cant kill the NPCS oO

someone told me that it works but he didnt told me how =(

Reply
#2

For your second question: I think its impossible to kill npc's, unless you script some advanced code to check if a player is attacking them.
To your first question: I cant answer it. I dont have any experience with GF or GF edits. sorry!
Reply
#3

Killable NPCs have to be scripted, and I don't like it because you don't actually have to HIT them, you can actually shoot OVER them and still kill them.

Your blink bug might be caused by lag inbetween recordings, try using SetMyPos once the recording is done or before the recording begins.
Reply
#4

i would like to ask you how does this work if you have an Dialog login system..
Reply
#5

Quote:
Originally Posted by SmithyCool
i would like to ask you how does this work if you have an Dialog login system..
Just make it so that the dialog wont appear under onplayerconnect if(isplayerNPC)
Reply
#6

Problem fixed!!!After 2 weks of working day and night on those NPC's i finally did it!!Thanks soooo much to r9x and [ST]Рυтўнвαѕ

EDIT: now i have the same problem,they blink :S
Reply
#7

nice to hear that it works =)

well we still have the blink problem and work on it oO
Reply
#8

I had a similar problem with normal players on my server. I found out that the spectating system caused it. Not sure if that's your case though.
Reply
#9

uhm you mean we should try to desable the spectate system to stop NPCs blinken =)?

we will try that and report back here ^^
Reply
#10

i think i am gonna try some downloaded NPC scripts and see if they blink too,if yes then we know it's the gamemode,if no then we none it's because of the .rec

EDIT: yeah,i noticed it,when the NPC's are walking they don't blink and when they stand on a place they start blinking,this is veery bad because the NPC's on my server have only one function,and that is to stand on one place and do nothing
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)