Page 1 of 1

sendAvatarToMap and NPC

Posted: 01 Oct 2011, 12:52
by giri_darius
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

Posted: 03 Oct 2011, 07:00
by Bax
You can call that method from your custom server-side extension only.