Jump to content

Recommended Posts

Posted
So i share a simply way for niebies...

 

1)Go to your datapack in data/scripts/cron/ directory

2)Create a file and name it tvt.py(py is the extension so if you create a txt file and rename it,remove the txt and add py)

3)Open the file and paste

 

import sys

from com.l2jfree.gameserver.model.entity.events import TvT

TvT.loadData()

TvT.autoEvent()

 

save and close it.

 

4)Finally add in your global tasks the following:

INSERT INTO `global_tasks` (`id`, `task`, `type`, `last_activation`, `param1`, `param2`, `param3`) VALUES

(996, 'jython', 'TYPE_FIXED_SHEDULED', 1206595935732, '60000', '14400000', 'tvt.py');

 

"param1" means time since server restart.So in what i share means that event will start 1 minite after restart

"param2" means how much time that the event will repeat.In what i share event will start automatic every 4 hours

 

You can change it by your needs(for example you may want every 3 hours)

 

Have fun.....

 

how to do this on l2jteon? there is not cron folder!

  • 4 weeks later...
  • 2 weeks later...
  • 2 years later...
Posted

I have problem with add auto eventmodrabbits.java. Can som1 help me with this? Event code :

/*

* This program is free software: you can redistribute it and/or modify it under

* the terms of the GNU General Public License as published by the Free Software

* Foundation, either version 3 of the License, or (at your option) any later

* version.

*

* This program is distributed in the hope that it will be useful, but WITHOUT

* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS

* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more

* details.

*

* You should have received a copy of the GNU General Public License along with

* this program. If not, see <http://www.gnu.org/licenses/>.

*/

package mods.eventmodRabbits;

 

import java.util.List;

import java.util.concurrent.ScheduledFuture;

 

import javolution.util.FastList;

 

import com.l2jserver.Config;

import com.l2jserver.gameserver.Announcements;

import com.l2jserver.gameserver.ThreadPoolManager;

import com.l2jserver.gameserver.datatables.SkillTable;

import com.l2jserver.gameserver.instancemanager.QuestManager;

import com.l2jserver.gameserver.model.L2Object;

import com.l2jserver.gameserver.model.L2Skill;

import com.l2jserver.gameserver.model.actor.L2Npc;

import com.l2jserver.gameserver.model.actor.instance.L2EventChestInstance;

import com.l2jserver.gameserver.model.actor.instance.L2EventMonsterInstance;

import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;

import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

import com.l2jserver.gameserver.model.quest.Event;

import com.l2jserver.gameserver.model.quest.Quest;

import com.l2jserver.gameserver.model.quest.QuestState;

import com.l2jserver.gameserver.util.Util;

import com.l2jserver.util.Rnd;

 

public class eventmodRabbits extends Event

{

// Event NPC's list

private List<L2Npc> _npclist;

// Event Task

ScheduledFuture<?> _eventTask = null;

// Event time

public static final int _event_time = 10;

// Event state

private static boolean _isactive = false;

// Current Chest count

private static int _chest_count = 0;

// How much Chests

private static final int _option_howmuch = 200;

// NPc's

public static final int _npc_snow  = 900101;

public static final int _npc_chest = 900102;

// Skills

public static final int _skill_tornado = 630;

public static final int _skill_magic_eye = 629;

 

// Drop data

private static final int[][] DROPLIST =

{

{  1538,  80,  3, 5 }, // Blessed Scroll of Escape

{  3936,  60,  3, 5 }, // Blessed Scroll of Ressurection

{  14720,  50,  5, 10 }, // E Apiga

{  1540,  40, 20, 30 }, // Quick Healing Potion

{  6622,  35,  1, 3 }, // Giant's Codex

{ 9627,  30,  1, 3 }, // GCM

{ 20004,  25,  1, 1 }, // grejtering

{ 14721,  15,  1, 1 } // GEApiga

};

 

public static void main(String[] args)

{

new eventmodRabbits(-1, "eventmodRabbits", "mods");

}

 

public eventmodRabbits(int questId, String name, String descr)

{

super(questId, name, descr);

 

addStartNpc(_npc_snow);

addFirstTalkId(_npc_snow);

addTalkId(_npc_snow);

 

addFirstTalkId(_npc_chest);

addSkillSeeId(_npc_chest);

addSpawnId(_npc_chest);

addAttackId(_npc_chest);

}

 

@Override

public String onSpawn(L2Npc npc)

{

((L2EventMonsterInstance)npc).eventSetDropOnGround(true);

((L2EventMonsterInstance)npc).eventSetBlockOffensiveSkills(true);

 

npc.setIsImmobilized(true);

npc.disableCoreAI(true);

 

return super.onSpawn(npc);

}

 

@Override

public boolean eventStart()

{

// Don't start event if its active

if(_isactive)

return false;

 

// Check Custom Table - we use custom NPC's

if (!Config.CUSTOM_NPC_TABLE)

return false;

 

// Initialize list

_npclist = new FastList<L2Npc>();

 

// Set Event active

_isactive = true;

 

// Spawn Manager

recordSpawn(_npc_snow, -59227, -56939, -2039, 64106, false, 0);

 

// Spawn Chests

for(int i=0; i < _option_howmuch; i++)

{

int x = Rnd.get(-60653, -58772);

int y = Rnd.get(-55830, -57718);

recordSpawn(_npc_chest, x, y, -2030, 0, true, _event_time*60*1000);

_chest_count++;

}

 

// Announce event start

Announcements.getInstance().announceToAll("Rabbit Event : Chests spawned!");

Announcements.getInstance().announceToAll("Go to Fantasy Isle and grab some rewards!");

Announcements.getInstance().announceToAll("You have "+_event_time+" min - after that time all chests will disappear...");

 

// Schedule Event end

_eventTask = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()

{

public void run()

{

timeUp();

}

}, _event_time*60*1000);

 

return true;

}

 

private void timeUp()

{

Announcements.getInstance().announceToAll("Time up !");

eventStop();

}

 

@Override

public boolean eventStop()

{

// Don't stop inactive event

if(!_isactive)

return false;

 

// Set inactive

_isactive = false;

 

// Cancel task if any

if (_eventTask != null)

{

_eventTask.cancel(true);

_eventTask = null;

}

// Despawn Npc's

if(!_npclist.isEmpty())

{

for (L2Npc _npc : _npclist)

if (_npc != null)

_npc.deleteMe();

}

_npclist.clear();

 

// Announce event end

Announcements.getInstance().announceToAll("Rabbit Event finished");

 

return true;

}

 

@Override

public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)

{

String htmltext = event;

 

if (event.equalsIgnoreCase("transform"))

{

if (player.isTransformed() || player.isInStance())

player.untransform();

 

SkillTable.getInstance().getInfo(2428, 1).getEffects(npc, player);

 

return null;

}

return htmltext;

}

 

@Override

public String onFirstTalk(L2Npc npc, L2PcInstance player)

{

QuestState st = player.getQuestState(getName());

if (st == null)

{

Quest q = QuestManager.getInstance().getQuest(getName());

st = q.newQuestState(player);

}

return npc.getNpcId()+".htm";

}

 

@Override

public String onSkillSee(L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)

{

if (Util.contains(targets,npc))

{

if(skill.getId() == _skill_tornado)

{

dropItem(npc, caster, DROPLIST);

npc.deleteMe();

_chest_count--;

 

if(_chest_count <= 0)

{

Announcements.getInstance().announceToAll("No more chests...");

eventStop();

}

}

else if (skill.getId() == _skill_magic_eye)

{

if(npc instanceof L2EventChestInstance)

((L2EventChestInstance)npc).trigger();

}

}

return super.onSkillSee(npc,caster,skill,targets,isPet);

}

 

@Override

public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet, L2Skill skill)

{

// Some retards go to event and disturb it by breaking chests

// So... Apply raid curse if player don't use skill on chest but attack it

if(_isactive && npc.getNpcId() == _npc_chest)

SkillTable.getInstance().getInfo(4515, 1).getEffects(npc, attacker);

 

return super.onAttack(npc, attacker, damage, isPet);

}

 

private static final void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist)

{

final int chance = Rnd.get(100);

 

for (int i = 0; i < droplist.length; i++)

{

int[] drop = droplist;

if (chance > drop[1])

{

((L2MonsterInstance)mob).dropItem(player, drop[0], Rnd.get(drop[2], drop[3]));

return;

}

}

}

 

private L2Npc recordSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)

{

L2Npc _tmp = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);

if(_tmp != null)

_npclist.add(_tmp);

return _tmp;

}

 

@Override

public boolean eventBypass(L2PcInstance activeChar, String bypass)

{

return false;

}

}

 

Chronicle freya.

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
Reply to this topic...

×   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.




  • Posts

    • ElmoreLab Harbor - Eternal C1 x1: ✅ https://harbor.elmorelab.com ElmoreLab Harbor - Eternal C1 x1 - is an exclusive server of the Eternal C1 chronicles from the top project ElmoreLab Harbor.   A unique server of its kind, on which everyone will have maximum pleasure, such as oldschool players who dream of nostalgia and to feel the warmest and classic C1 chronicles, as well as experienced players who are tired of thousands unbalanced servers of late chronicles. Due to the professional corrections of the balance system and the HONEST gameplay system - on this server, EVERY player will feel like in their own, warm and cozy Harbor C1. Let's return to the origins of L2 - back to 2004 in C1! ❤️   ⭐ Server characteristics:   STRICTLY 1 window, NO BOXES Bans for RMT and bots/cheats No donations with benefits Unique and high-quality PTS-build from Master Toma Professional corrections and full class-balance Reworked economy and closed all abuses Improved animations and all aspects of the game Exclusive HD-client with high-quality textures Experienced administration and management Fixed all bugs, geodata, exploits and holes Maximum sociality due to the 1-box system Discovering, exploring and researching Big online International server Nostalgia and oldschool-feelings   Rates: x1 Server start: 14.02.2025   The server is at the final stages of development and preparation for release. Information on the server will be updated, soon the patchnotes and changes/edits will be posted. Don't miss the legendary and epic experience on the best server in the last 20 years! ❤️ Join our C1-forum with a lot of information about server and active discussions.   ⭐ Website: https://harbor.elmorelab.com   ✅ Forum: https://forum-harbor.elmorelab.com   💥 Telegram: https://t.me/l2harbor https://t.me/l2harbor_chat   ⚡ Discord: https://discord.gg/harborelmorelab
    • yeah ok, if you say what is fuctional 100% i can't say something different 😛  but if someone find hard to compile it or get vs and all that things i have here one more simple way here to put overlay in your own server or to change your window name with few money.
    • I've been using this for 2 years now with no issues from Discord. I don't use ogg.dll either. This one works with any l2.exe too; I don’t see any difference between them.
    • hmm.. ok i just see that, is different code first of all. My sources is totally different based in other way, with else libraries.  I have access to modify everything even to make the clock to stop show how many time users play in server. 1) so maybe keep some personal info more hide. 2) i dont use ogg.dll 3) i create it and give it ready + support to install it. Plus what is mine can working with what ever .exe you want not just l2 with same simple method. And i am sure if you try this source to compile it, after 3 hours discord will like shadowban your API too thats my source
  • Topics

×
×
  • Create New...