Kariss
Nombre de messages : 17 Localisation : Sud de la France (Au pays du pastaga) Date d'inscription : 18/11/2008
| Sujet: [résolu]fleeNpc.java 30/11/08, 09:22 pm | |
| Récemment j'ai eu une erreur avec le fichier fleeNpc.java en installant un serveur l2j version 2670 pour le serveur et 5495 pour la datapack. Alors pour les noob comme moi je post un fichier qui est bon en espérant que ça servira à quelqu'un. - 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 ai.individual;
import net.sf.l2j.gameserver.ai.CtrlIntention; import net.sf.l2j.gameserver.model.L2CharPosition; import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.quest.Quest; import net.sf.l2j.util.Rnd; import ai.group_template.L2AttackableAIscript;
public class FleeNpc extends L2AttackableAIscript { private int[] _npcId = { 20432, 22228 ,18150,18151,18152,18153,18154,18155,18156,18157};
public FleeNpc(int questId, String name, String descr) { super(questId, name, descr);
for( int i = 0; i < _npcId.length; i++ ) { this.addEventId(_npcId[i], Quest.QuestEventType.ON_ATTACK); } }
public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet) { if (npc.getNpcId() >= 18150 && npc.getNpcId() <= 18157) { npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition((npc.getX() + Rnd.get(-40, 40)), (npc.getY()+ Rnd.get(-40, 40)), npc.getZ(), npc.getHeading())); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null); return null; } else if (npc.getNpcId() == 20432 || npc.getNpcId() == 22228) { if (Rnd.get(3) == 2) npc.getAI().setIntention( CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition((npc.getX() + Rnd.get(-200, 200)), (npc.getY()+ Rnd.get(-200, 200)), npc.getZ(), npc.getHeading())); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null); return null; } return super.onAttack(npc, attacker, damage, isPet); }
// Register the new script at the script System public static void main(String[] args) { new FleeNpc(-1, "FleeNpc", "Ai for Flee Npcs"); } }
Bonne soirée à vous tous.
Dernière édition par Kariss le 13/12/08, 08:53 pm, édité 1 fois | |
|
alfo
Nombre de messages : 107 Localisation : ~/agonia Date d'inscription : 17/05/2007
| Sujet: Re: [résolu]fleeNpc.java 30/11/08, 09:31 pm | |
| Bonsoir, Il serait bien de préciser quelle erreur pour nous éclairer un petit peu. | |
|
Grimly
Nombre de messages : 601 Date d'inscription : 30/08/2007
| Sujet: Re: [résolu]fleeNpc.java 01/12/08, 05:44 pm | |
| Cet AI ne fonctionne pas avec ses nouveaux NPC. N'ai-je pas raison ? | |
|
Kariss
Nombre de messages : 17 Localisation : Sud de la France (Au pays du pastaga) Date d'inscription : 18/11/2008
| Sujet: Re: [résolu]fleeNpc.java 01/12/08, 05:53 pm | |
| Problème de compilation à la ligne 25 d'après mon gameserveur. Avant rectification j'avais "public class fleeNpc extends QuestJython" au lieu de "public class FleeNpc extends L2AttackableAIscript". Mon message d'erreur dans la console c'était: - Code:
-
1. ERROR in \FleeNpc.java (at line 25) public class fleeNpc extends QuestJython ^^^^^^^ The public type fleeNpc must be defined in its own file et mon fichier error: - Code:
-
Error on: C:\L2server\gameserver\data\scripts\ai\individual\ FleeNpc.java.error.log Line: -1 - Column: -1 compilation failed | |
|
Snorri
Nombre de messages : 26 Age : 34 Localisation : la yaute! Date d'inscription : 12/01/2008
| Sujet: Re: [résolu]fleeNpc.java 03/12/08, 07:54 pm | |
| j'ai eu ce type d'erreur en placant un fichier multisell pour un npc custom au mauvais endrois. je sais plus exactement ce qui avait été fait faux mais ca m'avais donner le meme type d'erreur. | |
|
Contenu sponsorisé
| Sujet: Re: [résolu]fleeNpc.java | |
| |
|