Jump to content
  • 0

Question

6 answers to this question

Recommended Posts

  • 0
Posted

You can create new TASK, take a look at tasks from:

 

\gameserver\taskmanager\tasks

 

And take a look about how does it work.

 

Also there is guide about task manager shared already aswell.

 

Use search.

  • 0
Posted

package custom.Test;

import java.util.Calendar;

import com.l2jserver.Config;
import com.l2jserver.gameserver._announcements;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;

public class Test extends Quest
{
  private static final boolean _announce = true; 
  private static final int _event_duration = 2;
  private static final int _event_delay = 3;

  private static final Byte _start_hour = 0;
                                                                    
  private static final Byte _start_minute = 0;

  private static final int _event_frequency = 360;

  public Test(int questId, String name, String descr)
  {
     super(questId, name, descr);

     if (loadGlobalQuestVar("") == "")
     {
        if (_start_hour > 0)
           startQuestTimer("START", setStartTime(_start_hour, _start_minute), null, null);
        else
           startQuestTimer("START", _event_delay * 60000, null, null);
     }
     else 
        startQuestTimer("RESTORE", 60000, null, null);
  }

  private long setStartTime(Byte minute, Byte hour)
  {
     Calendar starttime = Calendar.getInstance();
     if (hour > 0 && hour < 24)
        starttime.set( Calendar.HOUR_OF_DAY, hour );
     else _log.info("Skipped.");
     if (minute > 0 && minute < 60)
        starttime.set( Calendar.MINUTE, minute );
     else if (minute > 60)
        starttime.set( Calendar.MINUTE, minute % 60 );
     if ((starttime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis()) > 0)
        return (starttime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
     else return 60000L;
  }

  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  {
     if (event.equalsIgnoreCase("START"))
     {
        
     }

     if (event.equalsIgnoreCase("RESTORE"))
     {
        
        if (_start_hour > 0)
           startQuestTimer("START", setStartTime(_start_hour, _start_minute), null, null);
        else if (_event_frequency > 0)
           startQuestTimer("START", _event_frequency * 60000, null, null);
     }
     return "";
  }

  public static void main(String[] args)
  {
     new Test(-1, "Test", "custom");
  }
}

 

example for your spawn. now just add spawn func to it. look at event "elpys" in DP side if you use freya

  • 0
Posted

public void spawnSevenSignsNPC()

 

eKo, such a big code for a little thing o_o.

 

just as an example o_o, i had it on my files was used for smth else

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...