hi, Sorry for bothering you, the question is how can I add a pet to my character, how can i have control over it (for example the pet has animations and with a button you make the animations play). I am lost.
Thank you
Pets
Pets
Thank you men, You gave me some ideas, another question in the new version of SmartfoxSever, Are you going to include a features like this??. Again thank you.
I met a problem. I pass Npc-user as parameter to Task and perform moveAvatar in it. When I kick user Task doesn't stop and I begin to receive warnings like "moveAvatar is ignored because user is not in room".
I tried to do such tricks inside doTask
and
So how to kill Task when user is lost, disconnected, kicked?
I tried to do such tricks inside doTask
Code: Select all
if (!npc.isInRoom(npc.getRoom()))
{
task.active = false;
}
and
Code: Select all
try {
moveAvatar(npc, npc.getRoom(), (int) Math.round(Math.random() * 10), (int) Math.round(Math.random() * 10), 0);
} catch (Exception e) {
task.active = false;
}
So how to kill Task when user is lost, disconnected, kicked?
Yes, you are right, I use 1 task per User.
I tried to figure out what's happening inside doTask..
After User is disconnected or kicked, I still receive message "User is in room: #"
So task.active = false; is never fired
I tried to figure out what's happening inside doTask..
Code: Select all
public void doTask(Task task) throws Exception
{
String id = (String) task.id;
String message = "Handling Task >>> { " + id + " }";
Map params = task.parameters;
User npc = (User)params.get("npc");
trace("Check user: " + npc.getUserId());
if (!npc.isInRoom(npc.getRoom()))
{
task.active = false;
}
else
{
trace("User is in room: " + npc.getRoom());
}
}
After User is disconnected or kicked, I still receive message "User is in room: #"
So task.active = false; is never fired
I tried to solve this issue without success. I have no idea why User npc = (User)params.get("npc"); always exists, even after the user is lost.
Now I see the only solution:
1. Store all NPC in DB.
2. Mark lost users in internalEvent for removing in DB.
3. Check if it's makred for removing on each tick in doTask. If it's - deactivate task and remove NPC from DB.
I'm not sure that it's good solution because of it's complexity and additional stress for DB. What do you think?
Now I see the only solution:
1. Store all NPC in DB.
2. Mark lost users in internalEvent for removing in DB.
3. Check if it's makred for removing on each tick in doTask. If it's - deactivate task and remove NPC from DB.
I'm not sure that it's good solution because of it's complexity and additional stress for DB. What do you think?
I am a little puzzled.
Can you better explain this?
In the USER_LOST event you are passed the User object. Where else do you get that User? I don't understand. After the USER_LOST you should not receive any more events about that User.
I have no idea why User npc = (User)params.get("npc"); always exists, even after the user is lost.
Can you better explain this?
In the USER_LOST event you are passed the User object. Where else do you get that User? I don't understand. After the USER_LOST you should not receive any more events about that User.
Return to “OpenSpace v2 discussions and help”
Who is online
Users browsing this forum: No registered users and 41 guests