Disconnect NPCs from room or zone

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

HamzehShabani
Posts: 5
Joined: 06 Sep 2019, 15:06

Disconnect NPCs from room or zone

Postby HamzehShabani » 06 Sep 2019, 15:19

hi, sometimes i have one npc in my room extension when opponent isn't available, game playing well and no problem on play time, but when i trying to disconnect NPC with this codes, sometimes it working well and sometimes not.

Code: Select all

getApi().disconnectUser(NpcPlayer);
getApi().removeRoom(getParentExtension().getParentRoom());

i found some codes like that in another APIs and i'm a little confused!
please help me if this codes should change, thank you
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Disconnect NPCs from room or zone

Postby Lapo » 06 Sep 2019, 15:46

Hi,
to remove and NPC you can use disconnectUser() as in your example.

What version of SFS2X are you using?
When you say that sometimes it doesn't work what do you mean? Do you see any errors?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
HamzehShabani
Posts: 5
Joined: 06 Sep 2019, 15:06

Re: Disconnect NPCs from room or zone

Postby HamzehShabani » 06 Sep 2019, 16:07

Lapo wrote:What version of SFS2X are you using?

i'm using from v2.13.4.

Lapo wrote:When you say that sometimes it doesn't work what do you mean? Do you see any errors?

most times it work well but sometimes extension keep npc alive in room, i don't know why it happening. :(
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Disconnect NPCs from room or zone

Postby Lapo » 06 Sep 2019, 19:05

Have you noticed any errors in the logs, related to removing the NPC?
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 21 guests