How to login Unity's execute as NPC user??????

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

wakawa2003
Posts: 14
Joined: 03 May 2019, 15:04

How to login Unity's execute as NPC user??????

Postby wakawa2003 » 10 Aug 2020, 08:05

I'm reading the post: https://smartfoxserver.com/blog/ways-of-working-with-npcs-in-a-multiplayer-game-p-2/
i'm try to login in Unity execute with same user name with NPC user i'm creat in extension. but it always creat new user is not NPC User????
How to login Unity's execute as NPC user?????? :?: :?:
thank you!!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How to login Unity's execute as NPC user??????

Postby Lapo » 10 Aug 2020, 09:24

Hi,
your question is not very clear.
First of all NPCs are created server side, so they don't need to "login in Unity". When a real User logs from client side to the server he will be able to interact with the NPCs once they are in the same Room.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
wakawa2003
Posts: 14
Joined: 03 May 2019, 15:04

Re: How to login Unity's execute as NPC user??????

Postby wakawa2003 » 10 Aug 2020, 13:46

In this blog has image:
Image
What exactly "NPC client"?? It is NPC creat by extension and controlled by extension code???
Why NPC client is in different app with Smartfox Server?? :?: :?:
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How to login Unity's execute as NPC user??????

Postby Lapo » 11 Aug 2020, 06:47

In the article you have mentioned we explain two different ways to manage NPCs.
1) Create NPCs and manage their logic on the server side
2) Create NPCs and manage their logic using a client application that runs on a different machine running in the local network

So it seems you want to use the 2nd approach.
How to login an NPC using this system? The same exact way you would login any other client. Send a LoginRequest from your NPC client.

If you're not familiar with the basics take some time reviewing the first tutorials from the documentation:
http://docs2x.smartfoxserver.com/Exampl ... troduction

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
wakawa2003
Posts: 14
Joined: 03 May 2019, 15:04

Re: How to login Unity's execute as NPC user??????

Postby wakawa2003 » 12 Aug 2020, 07:52

i'm did it, but have problem!
i creatNPC in server extension, and then login with same name in unity, but flag isNPC always false in Zone Monitor???
what is wrong?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How to login Unity's execute as NPC user??????

Postby Lapo » 12 Aug 2020, 08:04

If the NPC is created from server side, then it already exists as a User on the server and therefore you don't need to create another one from client side.
In other words, you have to choose one of the two approaches outlined in the article, not use both at the same time.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor, Thomasea and 64 guests