Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead. There is no support for other server builds than the official provided by l2jserver.com
Why this script lag server? My character etc. After 5 seconds i can move finally. Before it's mean with Gracia Final it wasn't a problem. Now when I want delay something I get lag. Anybody knows what's happend?
... where do you put that?
It makes a thread stop doing anything for 5 seconds, it's not lag.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste! Discussion breeds innovation.
well, you can schedule an event that after 5 seconds sends the second packet...
Thread.sleep is not a good choice in that place, you have to return something in that event.
That is, assuming you're putting this in an event script (extends Quest).
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste! Discussion breeds innovation.
So what I have to do to delay NPC conversation. We have only thread.sleep or something else?
Like I said I have a lot scripts with thread.sleep I had live server and everything was OK. I had musicians playing music with 6 threads.sleep about 5 minut delay in never ending loop (while (true)) and no lag, no problems.
Now only one thread with 5 sec delay and all stops... Weird...
are those scripts in core or are they "extends Quest"???
In any case, you can try to schedule the events using ThreadPoolManager.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste! Discussion breeds innovation.
Script was in L2Npc.java but now all scripts like support blessing are in DP handlers. So I made new java file with public boolean useBypass(String command, L2PcInstance player, L2Character target) and I paste my script without any errors and warning in gameserver window. All script works but thread.sleep freeze my char on 5 sek.
most probably because useBypass call expects an answer before continuing doing its stuff, i.e. it's not just blabla.useBypass, it's if (blabla.useBypass()).
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste! Discussion breeds innovation.
I've tested with people script with thread.sleep and i observed that freeze only character who activate link. Not all world.
Maybe there is a way to focus this thread on NPC not on character.
Any Idea?
target.broadcastPacket(new CreatureSay(target.getObjectId(), Say2.ALL, target.getName(),"Hello"));------HERE I NEED SOMETHING TO FOCUS THIS ALL THREAD ON NPC------try{ Thread.sleep(5000); // 5 sek}catch (InterruptedException e1){}//and after 5 seconds npc saying again something...target.broadcastPacket(new CreatureSay(target.getObjectId(), Say2.ALL, target.getName(),"I said... Hello!!!"));
thread.sleep freezes the thread, it does not make it do "something else". Figure out what you need/want to do first.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste! Discussion breeds innovation.
I want to freeze NPC not character. NPC saying words, not me. I push the button in chat window to start script. The rest of the script should concern NPC.
I think the character is not allowed to do anything until the bypass is being processed.
If you want a delayed action, use threadpool and a private method.
Also, if the player is not saying it, then who is "target"? Naming the NPC as "target" makes me think it could change at any given moment...
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste! Discussion breeds innovation.
Using the thread.sleep method is not a good option... Playing with threads causes these problems you've described, and there is no clean way to solve it. It's much better to use a runnable class like someone has already said. Here you have an example of what you should do to make it work.