я примерно ход мысли понимаю как оно должно быть, вопрос стоит в примере... как реализоватьВ чем сложности?
Пишешь и регаешь общий листенер на убийства мобов и в нем делаешь проверки - если убитый моб этой рб и убивший имеет клан подходящего уровня - даешь репу. Ну или в чуть более усложненном варианте не только убившего проверяешь, но и всех кто засветился в агролисте у рб и всем им даешь репу.
У себя когда-то делал следующим образом:я примерно ход мысли понимаю как оно должно быть, вопрос стоит в примере... как реализовать
public String onKill (L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
int npcId = npc.getNpcId();
L2Clan clan = killer.getClan();
if (clan == null)
{
return super.onKill(npc, killer, isPet);
}
if (clan.getLevel() < 5)
{
return super.onKill(npc, killer, isPet);
}
switch (npcId) {
// РБ 60 уровня
case 25016:
case 25256:
case 29056:
case 25179:
case 25407:
case 25162:
case 25234:
case 25106:
case 25423:
case 25226:
case 25467:
case 25255:
case 25478:
case 25051:
case 25444:
case 25125:
case 25140:
case 25470:
case 25322:
case 25263:
case 25337:
case 25233:
case 25073:
case 25198:
case 25163:
case 25252:
case 25092:
case 25453:
case 25035:
case 25269:
case 25281:
case 25328:
case 25447:
case 25248:
case 25199:
case 25235:
case 25220:
case 25523:
case 25296:
case 25109:
case 25202:
clan.setReputationScore(clan.getReputationScore() + 100,true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// РБ 65+ уровня
case 25054:
case 25276:
case 25266:
case 25249:
case 25244:
case 25229:
case 25282:
case 25205:
case 25524:
case 25290:
case 25293:
case 25338:
case 25245:
case 25143:
case 25450:
case 25126:
case 25514:
case 25309:
case 25283:
case 25299:
case 25286:
case 29030:
case 25325:
case 29033:
case 29036:
case 29037:
case 25302:
case 25312:
case 29040:
case 25319:
case 25527:
case 29096:
case 29095:
case 29065:
case 29062:
case 25316:
case 25315:
case 25305:
case 25306:
case 25517:
clan.setReputationScore(clan.getReputationScore() + 200,true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// Valakas
case 29028:
clan.setReputationScore(clan.getReputationScore() + 1500, true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// Antharas
case 29019:
case 29066:
case 29067:
case 29068:
clan.setReputationScore(clan.getReputationScore() + 1250, true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// Baium
case 29020:
clan.setReputationScore(clan.getReputationScore() + 750, true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// Frintezza
case 29047:
clan.setReputationScore(clan.getReputationScore() + 500, true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// Zaken
case 29022:
clan.setReputationScore(clan.getReputationScore() + 500, true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// Queen Ant
case 29001:
clan.setReputationScore(clan.getReputationScore() + 700, true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// Orfen
case 29014:
clan.setReputationScore(clan.getReputationScore() + 300, true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
// Core
case 29006:
clan.setReputationScore(clan.getReputationScore() + 300, true);
clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan));
break;
}
return null;
}
ну ты даже сборку не указаля примерно ход мысли понимаю как оно должно быть, вопрос стоит в примере... как реализовать
package listeners.npcs;
import l2p.commons.util.Rnd;
import l2p.gameserver.enums.ScreenMessageAlign;
import l2p.gameserver.listener.actor.OnDeathListener;
import l2p.gameserver.model.Creature;
import l2p.gameserver.model.actor.listener.CharListenerList;
import l2p.gameserver.model.instances.MonsterInstance;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.network.s2c.ExShowScreenMessage;
import l2p.gameserver.scripts.ScriptFile;
import l2p.gameserver.utils.NpcUtils;
import l2p.gameserver.utils.PositionUtils;
import npc.model.LineaInstance;
/**
* Спавнит с определенным шансом Рейдового Посланника Ринею при убийстве рейд-боссов 85+ уровней
*
* @author Gaikotsu
*/
public class SpawnLinea implements ScriptFile
{
private static final DeathListener _deathListener = new DeathListener();
@Override
public void onLoad()
{
CharListenerList.addGlobal(_deathListener);
}
@Override
public void onReload()
{
CharListenerList.removeGlobal(_deathListener);
}
private static class DeathListener implements OnDeathListener
{
@Override
public void onDeath(Creature actor, Creature killer)
{
if (killer == null)
return;
if (!actor.isRaid() || actor.isBoss() || actor.getLevel() < 85 || !actor.getReflection().isDefault())
return;
if (((NpcInstance) actor).isSpecialBoss())
return;
if (!Rnd.chance(actor.getLevel() / 4) || NpcUtils.findNearbyNpc(actor, 2000, 33919))
return;
LineaInstance npc = (LineaInstance) NpcUtils.spawn(33919, PositionUtils.findPointToStay(actor, 80, 160), 180000);
if (npc != null)
{
npc.broadcastPacket(new ExShowScreenMessage(1802489, 10000, ScreenMessageAlign.TOP_CENTER, true, true)); // Появилась Рейдовый Посланник Ринея.
npc.setKnownPlayers(((MonsterInstance) actor).getAggroList().getPlayableMap().keySet());
}
}
}
}
EventHandler MY_DYING(last_attacker, pledge0, i2) {
if (last_attacker.pledge_id > 0) {
pledge0 = GetPledge(last_attacker);
if (IsNull(pledge0) == 0) {
i2 = pledge0.skill_level;
if (i2 > 5) { // for example more than level 5 clan
UpdatePledgeNameValue(last_attacker, CRP_amount);
}
}
}
}
CRP_amount я так понял это для количества? И ещё хочу уточнить, "myself." потребуется добавить в:Quick pseudo example:
Код:EventHandler MY_DYING(last_attacker, pledge0, i2) { if (last_attacker.pledge_id > 0) { pledge0 = GetPledge(last_attacker); if (IsNull(pledge0) == 0) { i2 = pledge0.skill_level; if (i2 > 5) { // for example more than level 5 clan UpdatePledgeNameValue(last_attacker, CRP_amount); } } } }
GetPledge(last_attacker);
?UpdatePledgeNameValue
CRP_amount: you specify your desired int value.CRP_amount I understand this for the amount? And I want to clarify, "myself." need to be added to:
?
There's just no way to compile now
GF pts.CRP_amount: you specify your desired int value.
The script compiles fine on GF PTS. Why specify myself, is it c4?
You should add the script to the parent class of the bosses (raid_boss_standard), I THINK it will work. For level checks:GF pts.
All works. thanks! question is, I need a different crp amount for the boss levels. Each class takes a long time to edit. is there any quick way?
if (myself.sm.level > 60 && myself.sm.level < 65) {
UpdatePledgeNameValue(last_attacker, CRP_amount_1)
}
else if (etc etc) {
UpdatePledgeNameValue(last_attacker, CRP_amount_2)
}
about that?You should add the script to the parent class of the bosses (raid_boss_standard), I THINK it will work. For level checks:
Код:if (myself.sm.level > 60 && myself.sm.level < 65) { UpdatePledgeNameValue(last_attacker, CRP_amount_1) } else if (etc etc) { UpdatePledgeNameValue(last_attacker, CRP_amount_2) }
if (last_attacker.pledge_id > 0) {
pledge0 = myself.GetPledge(last_attacker);
if (IsNull(pledge0) == 0) {
i2 = pledge0.skill_level;
if (i2 > 5 && myself.sm.level > 40 && myself.sm.level < 50) {
myself.UpdatePledgeNameValue(last_attacker, 100);
}
else if (i2 > 5 && myself.sm.level > 49 && myself.sm.level < 60) {
myself.UpdatePledgeNameValue(last_attacker, 200);
}
else if (i2 > 5 && myself.sm.level > 59 && myself.sm.level < 70) {
myself.UpdatePledgeNameValue(last_attacker, 300);
}
else if (i2 > 5 && myself.sm.level > 69 && myself.sm.level < 80) {
myself.UpdatePledgeNameValue(last_attacker, 400);
}
}
}
Sorry but I don't understand your question. You need to add the script to my_dying handler of raid_boss_standard.nasc (it's the parent class of the raid bosses). This way all the raid bosses inherit the behavior of issuing CRP.about that?
C++:if (last_attacker.pledge_id > 0) { pledge0 = myself.GetPledge(last_attacker); if (IsNull(pledge0) == 0) { i2 = pledge0.skill_level; if (i2 > 5 && myself.sm.level > 40 && myself.sm.level < 50) { myself.UpdatePledgeNameValue(last_attacker, 100); } else if (i2 > 5 && myself.sm.level > 49 && myself.sm.level < 60) { myself.UpdatePledgeNameValue(last_attacker, 200); } else if (i2 > 5 && myself.sm.level > 59 && myself.sm.level < 70) { myself.UpdatePledgeNameValue(last_attacker, 300); } else if (i2 > 5 && myself.sm.level > 69 && myself.sm.level < 80) { myself.UpdatePledgeNameValue(last_attacker, 400); } } }
I misunderstood. I need to add a level check to the RaidBossStandart1,2,3,4 class. But how will refer to EventHandler MY_DYING with level check to issue a certain amount of CRP
everything is great, everything worked out. thanks a lot for your help!!!!Sorry but I don't understand your question. You need to add the script to my_dying handler of raid_boss_standard.nasc (it's the parent class of the raid bosses). This way all the raid bosses inherit the behavior of issuing CRP.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?