NPC user event

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

Moderators: Lapo, Bax

KrinalDhaduk
Posts: 22
Joined: 12 Nov 2019, 06:50
Location: Surat,Gujarat

NPC user event

Postby KrinalDhaduk » 16 Jan 2020, 10:49

Can we send event like real user send event?

There is one timer for game start. When it's completed then i have to trigger one event to all user for start game.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: NPC user event

Postby Lapo » 16 Jan 2020, 11:14

Hi,
Can we send event like real user send event?

If your NPCs are managed externally, yes.

Otherwise no, not really, because NPCs are server side only.
Assuming your NPCs are server-side, instead of sending an event why not calling the NPC logic directly?

There is one timer for game start. When it's completed then i have to trigger one event to all user for start game.

You need to at least split the logic between real users and NPCs.
Meaning that you send a specific "command" to the real users, either via Extension or other message and then you invoke you custom server-side logic for the "NPC game start" event.

Of course this can be wrapped into a method so that both branches of the game update are managed in one place.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
KrinalDhaduk
Posts: 22
Joined: 12 Nov 2019, 06:50
Location: Surat,Gujarat

Re: NPC user event

Postby KrinalDhaduk » 22 Jan 2020, 05:33

Thanks Lapo! :)

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 101 guests