Page 1 of 2

game events

Posted: Tue Sep 08, 2015 11:25 pm
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:

services

Posted: Tue Sep 08, 2015 11:29 pm
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

services

Posted: Tue Sep 08, 2015 11:32 pm
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

Re: services

Posted: Sat Sep 12, 2015 8:06 pm
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.

Re: services

Posted: Sat Sep 12, 2015 8:22 pm
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

Re: services

Posted: Sun Sep 13, 2015 5:27 am
by epu
zelmaks wrote:igrakov
players*

Проверочное слово - игрок :)

Re: services

Posted: Sun Sep 13, 2015 10:30 am
by zelmaks
epu wrote:
zelmaks wrote:igrakov
players*

Проверочное слово - игрок :)
Привет, ахуенно что русские тут есть))
Слушай помоги мне с сервисами и ивентами

Re: services

Posted: Sun Sep 13, 2015 11:43 am
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

Re: services

Posted: Sun Sep 13, 2015 4:53 pm
by Zoey76
My bad, I'll fix the guide. :+1:

Re: services

Posted: Sun Sep 13, 2015 8:29 pm
by Attila
Zoey76 wrote:My bad, I'll fix the guide. :+1:
So what i need te do now to make this work
:eh:

Re: services

Posted: Sun Sep 13, 2015 8:42 pm
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

Re: services

Posted: Sun Sep 13, 2015 9:56 pm
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.

Re: services

Posted: Mon Sep 14, 2015 4:06 pm
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.

Re: services

Posted: Mon Sep 14, 2015 6:32 pm
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

Re: services

Posted: Mon Sep 14, 2015 6:56 pm
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