We moved our repositories to BitBucket!

If you can't login or you can't register to the forums do not rise an issue, instead please write to support (at) l2jserver.com

Check our wiki!

Report server issues here

Forum has been updated to phpBB 3.2, let's see if this fixes some minor bugs we had.

Thank you for visiting http://www.l2jserver.com/

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
Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila » Mon Sep 14, 2015 7:59 pm

Avanael92 wrote: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
Yes i put the script at game/data/scripts/custom/ai/EvilSantaClaus

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);
    }

    public static void main(String[] args)
    {
        new EvilSantaClaus();
    }
}
and i put this html at game\data\scripts\quests\EvilSantaClaus

Code: Select all

<html><body>Evil Santa Claus:<br>
You have been a naughty %gender%!<br>
<a action="bypass -h Quest EvilSantaClasus reward">Rewards</a><br>
</body></html>
and i put this NPC code to game\data\stats\npcs\custom

Code: Select all

<npc id="1004307" displayId="4307" level="80" type="L2Npc" name="Evil Santa Claus"
        usingServerSideName="true" title="My First Custom NPC" usingServerSideTitle="true">
    <sex>MALE</sex>
    <collision>
        <radius normal="25" />
        <height normal="35" />
    </collision>
</npc>
but if i click at the NPC Evil Santa Claus i don't get a popup to click to get the rewards
I get to see the code in chat options look picture below here
Image

User avatar
Avanael92
Advanced User
Advanced User
Posts: 187
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: services

Post by Avanael92 » Mon Sep 14, 2015 8:14 pm

HTML path is wrong, it should be in the same folder like your script. All files you use in your script needs to be in the same package, otherwise your script can't find it anyway.
Image

Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila » Tue Sep 15, 2015 3:50 pm

Avanael92 wrote:HTML path is wrong, it should be in the same folder like your script. All files you use in your script needs to be in the same package, otherwise your script can't find it anyway.
Yes but if i put the HTML path to the same folder like script
i see the HTML code at chat option and don't get a popup
and if i take the HTML path out of the same folder like the script and click on the npc
i see this look pics
Image

Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila » Tue Sep 15, 2015 3:53 pm

Attila wrote:
Avanael92 wrote:HTML path is wrong, it should be in the same folder like your script. All files you use in your script needs to be in the same package, otherwise your script can't find it anyway.
Yes but if i put the HTML path to the same folder like script
i see the HTML code at chat option and don't get a popup Look pics
Image
and if i take the HTML path out of the same folder like the script and click on the npc
i see this look pics
Image

User avatar
Avanael92
Advanced User
Advanced User
Posts: 187
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: services

Post by Avanael92 » Tue Sep 15, 2015 4:56 pm

Okay, i'll explain it to you again :)

Both, script and html, need to be in this path:

Code: Select all

game/data/scripts/custom/ai/EvilSantaClaus

(you probably need to create folder "ai" and "EvilSantaClaus" because they dont exist, just saying)
Afterwards open scripts.cfg in "game/data" and search for this:

Code: Select all

# Custom
Below that line, you paste in:

Code: Select all

custom/ai/EvilSantaClaus/EvilSantaClaus.java
Then you're done. I don't have any problems with that, proof below:

Image
Image

Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila » Tue Sep 15, 2015 8:34 pm

strange
I have it that all on the same place that you say here
Image
Image


and this is my 1004307.html

Code: Select all

<html><body>Evil Santa Claus:<br>
You have been a naughty %gender%!<br>
<a action="bypass -h Quest EvilSantaClasus reward">Rewards</a><br>
</body></html>
and this the NPC code

Code: Select all

<npc id="1004307" displayId="4307" level="80" type="L2Npc" name="Evil Santa Claus"
        usingServerSideName="true" title="My First Custom NPC" usingServerSideTitle="true">
    <sex>MALE</sex>
    <collision>
        <radius normal="25" />
        <height normal="35" />
    </collision>
</npc>
so, in my opinion, is good
But why do I get no popup but the html code to see at chat options :eh:
So what's wrong or am I doing something still wrong :think:

Attila
Posts: 441
Joined: Mon May 05, 2014 10:15 am

Re: services

Post by Attila » Wed Sep 16, 2015 3:37 pm

Hi
I do not understand why it not working properly with me

I have tried it on 3 different servers latest hi5
but on all 3 the same problem
No popup but the html code to see at chat options :?

User avatar
volix
Posts: 106
Joined: Tue May 17, 2011 5:20 pm

Re: services

Post by volix » Wed Sep 16, 2015 6:16 pm

Code: Select all

package custom.ai.EvilSantaClaus;
Attila wrote: and this is my 1004307.html

Code: Select all

<html><body>Evil Santa Claus:<br>
You have been a naughty %gender%!<br>
<a action="bypass -h Quest EvilSantaClasus reward">Rewards</a><br>
</body></html>
EvilSantaClasus

Edit: With this .html file, too?
You do not have the required permissions to view the files attached to this post.
Last edited by volix on Wed Sep 16, 2015 8:50 pm, edited 1 time in total.

User avatar
Avanael92
Advanced User
Advanced User
Posts: 187
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: services

Post by Avanael92 » Wed Sep 16, 2015 6:31 pm

volix wrote:

Code: Select all

package custom.ai.EvilSantaClaus;
Attila wrote: and this is my 1004307.html

Code: Select all

<html><body>Evil Santa Claus:<br>
You have been a naughty %gender%!<br>
<a action="bypass -h Quest EvilSantaClasus reward">Rewards</a><br>
</body></html>
EvilSantaClasus
This has nothing to do with calling the HTML-file within the script.

It's just too strange for me that I'm even running out of ideas lol..
Image

User avatar
Flyleaf
Posts: 89
Joined: Thu Apr 30, 2015 7:34 am

Re: services

Post by Flyleaf » Mon Sep 21, 2015 10:00 am

Avanael92 wrote:
volix wrote:

Code: Select all

package custom.ai.EvilSantaClaus;
Attila wrote: and this is my 1004307.html

Code: Select all

<html><body>Evil Santa Claus:<br>
You have been a naughty %gender%!<br>
<a action="bypass -h Quest EvilSantaClasus reward">Rewards</a><br>
</body></html>
EvilSantaClasus
This has nothing to do with calling the HTML-file within the script.

It's just too strange for me that I'm even running out of ideas lol..
Hi, can you help with the service if you do not mind helping me write in a personal
Sorry for my English

Post Reply