sendAvatarToMap and NPC

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

Moderators: Lapo, Bax

giri_darius
Posts: 13
Joined: 15 Jun 2011, 11:41
Location: Mumbai, India

sendAvatarToMap and NPC

Postby giri_darius » 01 Oct 2011, 12:52

hi

Im following NpcAvatarExample.java extension to create NPC and to move around.
How Im suppose to show him on map.
Right now I can see NPC is added in room through admin panel but i cant see him on the map
How should I call sendAvatarToMap() method.

Code: Select all

 if (npcUser == null)
            {
                    npcUser = api.createNPC(NPC_USER_NAME, IP, Port, getOwnerZone());
                    api.joinRoom(npcUser, -1, roomID, false, "", false, true);HashMap<String, Object> vars = new HashMap<String, Object>();
                    vars.put("_os_px", new UserVariable(String.valueOf(px), UserVariable.TYPE_NUMBER));
                    vars.put("_os_py", new UserVariable(String.valueOf(py), UserVariable.TYPE_NUMBER));
                    vars.put("_os_dir", new UserVariable("5", UserVariable.TYPE_NUMBER));
                    vars.put("_os_type", new UserVariable("example"));      
                    vars.put("_os_name", new serVariable(NPC_USER_NAME));   
                                       
                   // sendAvatarToMap()
                  api.setUserVariables(npcUser, vars, true);}

can I call it in this class or is there another way to achieve this. Or only CustomOSExtension.java can call this method

Im using OpenSpace 2.0
And smartfox server 1.6.9
Girish Patil
Flash Developer
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 03 Oct 2011, 07:00

You can call that method from your custom server-side extension only.
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 13 guests