More c4/c5 retail like AI for Fall Orc Shamans.
Now with "onSkillSee" support.
To do :
Auto-Targeting the spawned monster is working, but client wont update the target window.
Nonetheless the player charakter will attack the spawned monster.
L2Off Example :
Note: If you use this version ,make sure to remove....
from "polymorphing_onAttack.py"
FallenOrcShaman.java
scripts.cfg
Regards
Now with "onSkillSee" support.
To do :
Auto-Targeting the spawned monster is working, but client wont update the target window.
Nonetheless the player charakter will attack the spawned monster.
L2Off Example :
Note: If you use this version ,make sure to remove....
- Code:
1258: [1259, 100, 100], #Fallen Orc Shaman -> Sharp Talon Tiger
from "polymorphing_onAttack.py"
FallenOrcShaman.java
- 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.L2Attackable;
import net.sf.l2j.gameserver.model.L2Character;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.L2Skill;
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;
/**
* FALLEN_ORC_SHAMAN AI.
* By Karakan for L2jLisvus
*/
public class FallenOrcShaman extends Quest
{
public FallenOrcShaman (int questId, String name, String descr)
{
super(questId, name, descr);
int[] mobs =
{
1258
}; // Fallen Orc Shaman
registerMobs(mobs);
}
@Override
public String onSkillSee(L2NpcInstance npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet)
{
if (skill.isOffensive() && targets[0] == npc)
{
npc.onDecay();
L2Attackable newNpc = (L2Attackable) addSpawn (1259, npc.getX(), npc.getY(), npc.getZ()+10, npc.getHeading(), false, 0); //Sharp Talon Tiger
if (caster.getTarget() == npc)
{
newNpc.onAction(caster);
}
newNpc.setRunning();
L2Character originalCaster = isPet ? caster.getPet() : caster;
if (originalCaster != null)
{
newNpc.addDamageHate(originalCaster, 0, 100);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalCaster);
}
}
return super.onSkillSee(npc, caster, skill, targets, isPet);
}
@Override
public String onAttack (L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet)
{
npc.onDecay();
L2Attackable newNpc = (L2Attackable) addSpawn (1259, npc.getX(), npc.getY(), npc.getZ()+10, npc.getHeading(), false, 0); //Sharp Talon Tiger
if (attacker.getTarget() == npc)
{
newNpc.onAction(attacker);
}
newNpc.setRunning();
L2Character originalAttacker = isPet ? attacker.getPet() : attacker;
if (originalAttacker != null)
{
newNpc.addDamageHate(originalAttacker, 0, 100);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
}
return super.onAttack(npc, attacker, damage, isPet);
}
public static void main(String[] args)
{
// Quest class and state definition
new FallenOrcShaman(-1, "fallenorcshaman", "ai/individual");
}
}
scripts.cfg
- Code:
ai/individual/FallenOrcShaman.java
Regards
Last edited by Karakan on 25th July 2019, 19:31; edited 2 times in total