How do i update the position of an MMOItem ?

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

Moderators: Lapo, Bax

genar
Posts: 137
Joined: 13 Jul 2017, 11:49

How do i update the position of an MMOItem ?

Postby genar » 07 Jun 2018, 11:22

Hey there !

Im currently spawning in MMOItems like this :

ISFSMMOApi mmoApi = SmartFoxServer.getInstance().getAPIManager().getMMOApi();
mmoApi.setMMOItemPosition((BaseMMOItem)item, new Vec3D(x, y, 0.0f), (Room)user.getCurrentMMORoom());

This works fine so far... But theres one problem... how do i update this position ?


I already tried to set a new position like this :

mmoApi.setMMOItemPosition((BaseMMOItem)item, new Vec3D(x, y, 0.0f), (Room)user.getCurrentMMORoom());

This want sucessfull at all, it seems like it just creates a new MMOitem, theres no proximity update or variable update called.


I also tried to update the position like this :

MMOROOM.updateItem((BaseMMOItem)item, new Vec3D(x, y, 0.0f));

Which wasnt sucessfull either. Still no proximity or variable update. I dont want to update the variables at all, just the position of the item itself. And even the proximity position.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How do i update the position of an MMOItem ?

Postby Lapo » 07 Jun 2018, 15:47

genar wrote:I already tried to set a new position like this :

mmoApi.setMMOItemPosition((BaseMMOItem)item, new Vec3D(x, y, 0.0f), (Room)user.getCurrentMMORoom());

This want sucessfull at all, it seems like it just creates a new MMOitem, theres no proximity update or variable update called.

This is actually correct. It can't create a new item here since you're passing the instance of the MMOItem that you want to move, so the item already exists.

As regards the event, you should get a proximity event if the Item is in the client's AOI.

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 67 guests