So i resolved the problem with the precise location for the minions .
My problem now is the fact that minions appears only if somebody attacks the referent.
I'm looking to spawn the minions in the same time as the referent.
if i change "onAttack" in "onSpawn", it doesn't work anymore.
I'm not a great java writer, i only search for the players have fun in our server.
if you can help me, it would be great, thx.
Code: Select all
/* * 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/>. * * code java des minions Sel mahums custom elegia */package ai.individual; import com.l2jserver.gameserver.ai.CtrlIntention;import com.l2jserver.gameserver.model.actor.L2Attackable;import com.l2jserver.gameserver.model.actor.L2Character;import com.l2jserver.gameserver.model.actor.L2Npc;import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import javolution.util.FastList;import javolution.util.FastSet;import ai.group_template.L2AttackableAIScript; public class sel65210minion extends L2AttackableAIScript{ private static final int REFERENT = 65210; private static final int MINION1 = 65202; private static final int MINION2 = 65203; private static final int MINION3 = 65204; private static final int MINION4 = 65205; private static final int MINION5 = 65206; private static final int MINION6 = 65207; private static final int MINION7 = 65208; private static final int MINION8 = 65209; private static final int MINION9 = 65201; private static int _HasSpawned1; private static FastSet<Integer> secondSpawn = new FastSet<Integer>(); private static FastSet<Integer> myTrackingSet = new FastSet<Integer>(); public sel65210minion(int id, String name, String descr) { super(id,name,descr); int[] mobs = {REFERENT, MINION1, MINION2, MINION3, MINION4, MINION5, MINION6, MINION7, MINION8, MINION9}; this.registerMobs(mobs); _HasSpawned1 = 0; myTrackingSet.clear(); secondSpawn.clear(); } public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet) { int npcId = npc.getNpcId(); int npcObjId = npc.getObjectId(); _HasSpawned1==npcObjId; if (npcId == MINION) { if (!myTrackingSet.contains(npcObjId)) //traqueur de party { myTrackingSet.add(npcObjId); _HasSpawned1 = npcObjId; } if ((_HasSpawned1==npcObjId)) { //Spawn des minions int x = npc.getX(); int y = npc.getY(); FastList<L2Attackable> _minion = new FastList<L2Attackable>(); _minion.add((L2Attackable) addSpawn(MINION1,89583,67567,-3710,0,false,40000); _minion.add((L2Attackable) addSpawn(MINION2,89583,67717,-3710,0,false,40000); _minion.add((L2Attackable) addSpawn(MINION3,89733,67417,-3710,0,false,40000); _minion.add((L2Attackable) addSpawn(MINION6,89883,67417,-3710,0,false,40000); _minion.add((L2Attackable) addSpawn(MINION7,89883,67567,-3710,0,false,40000); _minion.add((L2Attackable) addSpawn(MINION4,89733,67567,-3710,0,false,40000); _minion.add((L2Attackable) addSpawn(MINION5,89733,67717,-3710,0,false,40000); _minion.add((L2Attackable) addSpawn(MINION8,89883,67717,-3710,0,false,40000); _minion.add((L2Attackable) addSpawn(MINION9,90058,67342,-3710,0,false,40000); _HasSpawned1 = 0; L2Character originalAttacker = isPet? attacker.getPet(): attacker; for (int i=0;i<_minion.size();i++) { L2Attackable minion = _minion.get(i); minion.setRunning(); minion.addDamageHate(originalAttacker,0,999); minion.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker); } _minion.clear(); } } return super.onAttack(npc, attacker, damage, isPet); } public static void main(String[] args) { // Quest class and state definition new sel65210minion(-1,"sel65210minion","ai"); }}