all avatars go to same map problem

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

navgustavo13
Posts: 15
Joined: 14 Sep 2011, 19:44

all avatars go to same map problem

Postby navgustavo13 » 24 Sep 2011, 16:15

Hello!
I have this problem : When we have multiple avatars on the same map and one of them moves to another map, it moves ALL the avatars to the same map.
I use the method openspace.loadMap(roomName) to change maps.
Please help me. I have looking for an answer for 3 days an I'm stuck here. :(
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 26 Sep 2011, 07:20

I think you should double check your code, because this is not happening in our tests. What happens if you have two clients opened and tell client A to load a new map? Do you see the map being switched on client B too?
What I need to understand is the same on both clients or not.
Paolo Bax
The SmartFoxServer Team
navgustavo13
Posts: 15
Joined: 14 Sep 2011, 19:44

Postby navgustavo13 » 26 Sep 2011, 12:56

Yes, it is the same with all the clients. If one of them changes room, all of them change at the same time.
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 26 Sep 2011, 14:19

This is a clear hint that you are doing something wrong in your code. You are probably calling loadMap on all the clients, I think inside an handler of some event fired on all the clients.
Paolo Bax
The SmartFoxServer Team
navgustavo13
Posts: 15
Joined: 14 Sep 2011, 19:44

Postby navgustavo13 » 26 Sep 2011, 16:43

Thank you for you quick response. After somo more tests on different clients. We have found that this problem is intermittent. Some times an avatar drags all of them to the same room, some times one avatar can change room without affecting all others and sometimes one avtar drags only another ONE avatar whit it.
It's really strange...
navgustavo13
Posts: 15
Joined: 14 Sep 2011, 19:44

Postby navgustavo13 » 26 Sep 2011, 16:48

This is a part of my code:

Code: Select all

private function onAvatarStopOverTile(e:AvatarEvent):void
         {
            if (e.params.trigger.target == "cambiarRoom"){
               loadMapFromTrigger(e.params.trigger);
            }
               
         }


And then, we have the loadMapFormTrigger code (the same as the Ranch example)

Code: Select all

public function loadMapFromTrigger(trigger:Trigger):void
         {
            var params:Array = trigger.params.split("|");
            var roomName:String = params[0];
            var coords:Array = params[1].split(",")
            var dir:int = params[2]
            if (coords.length == 2)
            {
               nextCenteringCoords = new Point(coords[0], coords[1]);
               nextDir = dir;
            }   
         os.loadMap(roomName);            
         }


And we add the triggers and params in the openSpace editor and everything passes ok.
navgustavo13
Posts: 15
Joined: 14 Sep 2011, 19:44

Postby navgustavo13 » 26 Sep 2011, 19:20

I finally got it! :D

The answer was in the question it self! :wink:
When you make your map on the OpenSpace Editor, you create the triggers and there is a little checkbox that reads "ALL AVATARS"!!
Looking here I realized my error.

You just have to leave this UNCHECKED so that the trigger only affects ONE AVATAR, not ALL of them!

Thank you for your support on all my questions.

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 9 guests