services

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
Forum rules
READ NOW: L2j Forums Rules of Conduct
User avatar
zelmaks
Posts: 5
Joined: Wed Aug 19, 2015 11:42 pm

game events

Post by zelmaks »

Good day guys help me with the event. whether it is possible to do this assembly work automatically to game events. when it comes time event pops up a window where you can click a yes or no.
Explain if possible how to make or do I have downloaded.
thanks in advance.
sorry for my english, I live in Ukraine :wink:
User avatar
zelmaks
Posts: 5
Joined: Wed Aug 19, 2015 11:42 pm

services

Post by zelmaks »

Boys and girls, help me with the service, tell me how to make the service "change nickname" - "to change the color of nick"
please help me
User avatar
zelmaks
Posts: 5
Joined: Wed Aug 19, 2015 11:42 pm

services

Post by zelmaks »

Boys and girls, help me with the service, tell me how to make the service "change nickname" - "to change the color of nick"
please help me
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7005
Joined: Tue Aug 11, 2009 3:36 am

Re: services

Post by Zoey76 »

zelmaks wrote:Boys and girls, help me with the service, tell me how to make the service "change nickname" - "to change the color of nick"
please help me
I recommend you that you read this guides:
https://github.com/L2J/L2J_Server/wiki/Add-a-custom-NPC
https://github.com/L2J/L2J_Server/wiki/ ... a-basic-AI

Code: Select all

player.getAppearance().setNameColor(Integer.decode("0x" + val));
player.broadcastUserInfo();
Where val must be something like 0000ff, also I think colors in L2 are like RBG or some other order.
Powered by Eclipse 4.30 🌌 | Eclipse Temurin 21 ☕ | MariaDB 11.2.2 🗃️ | L2J Server 2.6.3.0 - High Five 🚀

🔗 Join our Discord! 🎮💬
User avatar
zelmaks
Posts: 5
Joined: Wed Aug 19, 2015 11:42 pm

Re: services

Post by zelmaks »

I somehow did not understand the event with what I need to do when the event took place or LH TW jump out the window at the igrakov and there would accept or reject
User avatar
epu
Posts: 57
Joined: Sat Nov 29, 2014 1:56 pm
Location: Russia

Re: services

Post by epu »

zelmaks wrote:igrakov
players*

Проверочное слово - игрок :)
quest maniac
User avatar
zelmaks
Posts: 5
Joined: Wed Aug 19, 2015 11:42 pm

Re: services

Post by zelmaks »

epu wrote:
zelmaks wrote:igrakov
players*

Проверочное слово - игрок :)
Привет, ахуенно что русские тут есть))
Слушай помоги мне с сервисами и ивентами
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila »

I try this one too but

Code: Select all

/*
 * Copyright (C) 2004-2015 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack 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.
 * 
 * L2J DataPack 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 custom.ai.EvilSantaClaus;

import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import ai.npc.AbstractNpcAI;

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

/**
 * Evil Santa Claus AI.
 * @author Zoey76
 */
public class EvilSantaClaus extends AbstractNpcAI
{
    // NPC
    private static final int NPC_ID = 1004307;
    // Rewarded players
    private static final Set<Integer> REWARDED_PLAYERS_IDS = ConcurrentHashMap.newKeySet();
    // Reward
    private static final long ADENA_COUNT = 100;

    public EvilSantaClaus()
    {
        super(EvilSantaClaus.class.getSimpleName(), "custom/ai");

        addFirstTalkId(NPC_ID);
        addTalkId(NPC_ID);
    }

    @Override
    public String onFirstTalk(L2Npc npc, L2PcInstance player)
    {
        String html = getHtm(player.getHtmlPrefix(), "1004307.html");
        html = html.replace("%gender%", player.getAppearance().getSex() ? "girl" : "boy");
        return html;
    }

    @Override
    public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
    {
        switch (event)
        {
            case "reward":
            {
                if (npc.isInsideRadius(player, 300, false, true))
                {
                    if (REWARDED_PLAYERS_IDS.contains(player.getObjectId()))
                    {
                        player.sendMessage("You have already been rewarded!");
                    }
                    else
                    {
                        REWARDED_PLAYERS_IDS.add(player.getObjectId());

                        player.sendMessage("Here is your reward!");
                        giveAdena(player, ADENA_COUNT, false);
                    }
                }
                else
                {
                    player.sendMessage("You are too far to get a reward!");
                }
                break;
            }
        }
        return super.onAdvEvent(event, npc, player);
    }
}
But i got this error message:
no main method in custom.ai.EvilSantaClaus.EvilSantaClaus

what do i need the do some help please
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7005
Joined: Tue Aug 11, 2009 3:36 am

Re: services

Post by Zoey76 »

My bad, I'll fix the guide. :+1:
Powered by Eclipse 4.30 🌌 | Eclipse Temurin 21 ☕ | MariaDB 11.2.2 🗃️ | L2J Server 2.6.3.0 - High Five 🚀

🔗 Join our Discord! 🎮💬
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila »

Zoey76 wrote:My bad, I'll fix the guide. :+1:
So what i need te do now to make this work
:eh:
User avatar
Zoey76
L2j Inner Circle
L2j Inner Circle
Posts: 7005
Joined: Tue Aug 11, 2009 3:36 am

Re: services

Post by Zoey76 »

Attila wrote:
Zoey76 wrote:My bad, I'll fix the guide. :+1:
So what i need te do now to make this work
:eh:

Add the missing main method like the error says: https://github.com/L2J/L2J_Server/wiki/ ... a-basic-AI
Powered by Eclipse 4.30 🌌 | Eclipse Temurin 21 ☕ | MariaDB 11.2.2 🗃️ | L2J Server 2.6.3.0 - High Five 🚀

🔗 Join our Discord! 🎮💬
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila »

Zoey76 wrote:
Attila wrote:
Zoey76 wrote:My bad, I'll fix the guide. :+1:
So what i need te do now to make this work
:eh:

Add the missing main method like the error says: https://github.com/L2J/L2J_Server/wiki/ ... a-basic-AI


I see this but do not know what I should do with it
can you tell me how to make the missing main method and where i need to put it
sorry :oops:
methods:

addFirstTalkId(NPC_ID) is used to notify the AI when the NPC is talked so the AI can send and modify the first HTML displayed by this NPC.

addTalkId(NPC_ID) is used to notify the AI when event links are triggered, check the HTML below.
There are two methods overriden:

onFirstTalk is called when the NPC is talked, it manages the first content the player see in the NPC Chat window for the first time, in this case we load the HTML and modify the string %gender% accordingly with the player's gender.

onAdvEvent is called when the NPC clicks an event link, then the event is matched and validations are performed, if everything is correct the player is rewarded and added to the REWARDED_PLAYERS_IDS set to prevent multiple rewards.
User avatar
Avanael92
Advanced User
Advanced User
Posts: 189
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: services

Post by Avanael92 »

The main method is at the very end, just copy & paste the updated code. The main method is basically the starting point to execute a java application.
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila »

Avanael92 wrote:The main method is at the very end, just copy & paste the updated code. The main method is basically the starting point to execute a java application.
yes tanks
but if i click on the NPC
i don't got a popup but the the html code at system message window
look img
Image
i put the 1004307.html to
game\data\scripts\quests\EvilSantaClaus
User avatar
Avanael92
Advanced User
Advanced User
Posts: 189
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: services

Post by Avanael92 »

You clearly didn't read the guide :)

The package declaration tells you where the script should be stored. In this case:

Code: Select all

game/data/scripts/custom/ai/EvilSantaClaus
Post Reply