Jump to content

Recommended Posts

Posted (edited)

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

Edited by Devlin
Posted

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

 

Are you check my PM?

  • 2 weeks later...
Guest Elfocrash
Posted

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

This wont work on any kind of project ever unless you check in as a task.

Also the time of uptime is automaticaly reset on logout.

Posted

This wont work on any kind of project ever unless you check in as a task.

Also the time of uptime is automaticaly reset on logout.

For sure it needs a task.

 

About the reset, I didn't know :P

Posted (edited)

A simple task with a counter linked to L2PcInstance can do the trick. Inside the run section you ++ the counter and make checks regarding it.

 

An exemple for monster derby track which I'm currently recoding for aCis, making checks every seconds to call events :

 

Called by

ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Announcement(), 0, 1000);

And running

	class Announcement implements Runnable
	{
		public Announcement()
		{
		}
		
		@Override
		public void run()
		{
			if (_finalCountdown >= 1200)
				_finalCountdown = 0;
			
			switch (_finalCountdown)
			{
				case 0:
					makeAnnouncement(SystemMessageId.MONSRACE_TICKETS_AVAILABLE_FOR_S1_RACE);
					break;
				
				case 30: // 30 sec
				case 60: // 1 min
					...
				
				case 1080: // 18 min
					makeAnnouncement(SystemMessageId.MONSRACE_RACE_START);
					break;
			}
			_finalCountdown += 1;
		}
	}

As you can see on my exemple, it runs the task every second, increasing _finalCountdown value and checking if that variable reached a particular number.

			if (_finalCountdown >= 1200)
				_finalCountdown = 0;

exists to make a cycle of 20min (reset to 0 when it happens).

 

Instead of 1000 (one second), you put 60000 (one minute) for scheduleGeneralAtFixedRate timer and then you can reward for case 30, 60, 120, etc (30min, 1hour, 2hours,..).

Edited by Tryskell
Guest
This topic is now closed to further replies.


  • Posts

    • No, the real purpose is cheating and custom  development for games.  I'm building a custom AI moderator specially for checking illegal activity and flag current topica.
    • Hello trying to edit Armorgrp_Classic.dat using L2ClientDat Editor - l2jmobius edition I can normally open a file but can't save, even can't save "clean" version of file (just open and then click save) Other files i can normally open, edit and save. but there is problem with Armorgrp_Classic.dat Anyone find solution, or other Editor for protocol 166 ?   [25/12 15:10:11] --------------------------------------- [25/12 15:10:11] Open file: Armorgrp_Classic.dat [25/12 15:10:11] File Armorgrp_Classic.dat encrypted. Lineage2Ver413 decrypt ... [25/12 15:10:11] Decrypt Armorgrp_Classic.dat file successfully by v413_encdec decrypter. [25/12 15:10:11] Read the file structure ... [25/12 15:10:11] Unpacking [L2GameDataName.dat] [25/12 15:10:11] GameDataName: Load 97534 count. [25/12 15:10:11] Completed. [25/12 15:11:32] Wrong param count for wrapper: fertheia_mesh_add, paramIndex: 1, params: {{{[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11;[none]};{{109;114};{0;-1};{109;114};{0;-1};{109;114}}};{[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None]};[None]} -node: fertheia_mesh_add[WRAPPER][null][null] param: {{{[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11;[none]};{{109;114};{0;-1};{109;114};{0;-1};{109;114}}};{[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None]};[None]} org.l2jmobius.xml.exceptions.PackDataException: Wrong param count for wrapper: fertheia_mesh_add, paramIndex: 1, params: {{{[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11;[none]};{{109;114};{0;-1};{109;114};{0;-1};{109;114}}};{[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None]};[None]} -node: fertheia_mesh_add[WRAPPER][null][null] param: {{{[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11];[None];[LineageAccessory3.fertheia_pvp_Hrm_ad11;[none]};{{109;114};{0;-1};{109;114};{0;-1};{109;114}}};{[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None];[Mantleguild.kingdom.E_elmd_1_t00];[None]};[None]} at org.l2jmobius.xml.DescriptorWriter.packData(DescriptorWriter.java:275) at org.l2jmobius.xml.DescriptorWriter.packData(DescriptorWriter.java:184) at org.l2jmobius.xml.DescriptorWriter.parseData(DescriptorWriter.java:100) at org.l2jmobius.actions.SaveDat.action(SaveDat.java:70) at org.l2jmobius.actions.ActionTask.doInBackground(ActionTask.java:48) at org.l2jmobius.actions.ActionTask.doInBackground(ActionTask.java:27) at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:303) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328) at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:340) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619) at java.base/java.lang.Thread.run(Thread.java:1447) [25/12 15:11:32] buff == null.  
    • Leave your contact information or write to me on Telegram @dieorditsa
    • Hello everyone, I’m looking for a graphic designer to design a custom logo that will be used in NPC HTML interfaces for Lineage. Please send me a private message if you are interested.
    • ok sounds good sign me up
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock