Jump to content

Question

Posted (edited)

Hello, i'm sorry if i distract anybody with these silly questions, i starter in l2java i wanted to make 2 different things but it's a bit dificult to do it so i would love

somebody to give me a hand just a clue no 100% solution.

 

 

Notorious code

When someone gets karma when he enter inside guard region and if geodata allow they attack him by AI. This region is declared some files like 1900.

I wanted to make some code (i start it alone) like this

 

L2PcInstance.java

setKarma(getKarma() + newKarma);if (target instanceof L2PcInstance && AntiFeedManager.getInstance().check(this, target))
setPkKills(getPkKills() + 1);


Notorious(this);
//Notorious begin
public static void Notorious(final L2PcInstance killer)
{
if (killer.getKarma() >= 1);
{
killer.sendMessage("Your Notorious level: 1");
}
if (killer.getKarma() >= 1500);
{
killer.sendMessage("Your Notorious level: 2");
}
if (killer.getKarma() >= 4500);
{
killer.sendMessage("Your Notorious level: 3");
}
if (killer.getKarma() >= 7500);
{
killer.sendMessage("Your Notorious level: 4");
}
if (killer.getKarma() >= 9999);
{
killer.sendMessage("You are now most wanted!");
}
}

I have to do like in case 1 guards distance 500 in case 2 guard distance 1000 in case 3 guard distance 1500 in case 4 guard distance 3000 e.t.c

And also when killer insert in area 500 range before the area that AI start attack him i want a social effect or something on guards like a red circle that

warning the killer that if he go closer to guards they will attack him.

So the problem is that i can't locate the file that i do these actions about range e.t.c i searchd in L2GuardInstance.java and L2AIAttack.java (btw i use ct2.5).

If someone can locate me or give me en example i would appreciate

 

 

Wedding skill code

I had an idea to create a skill passive or active (in SkillHandlers) that when you are married and your parther is in range of 1500 X-Y  your HP or P.attack increased by 5% this is no problem the idea is to make the SkillHandler.

I'm sure is something like this

 

public class MarriedSkillHelp implements ISkillHandler
{
private static final L2SkillType[] SKILL_IDS = { L2SkillType.MARRIED_SUPPORT };


@Override
public void useSkill(final L2Character activeChar, final L2Skill skill, final L2Object[] targets)
{
          
final L2PcInstance target = (L2PcInstance) player.getPartherId();
final L2Object firstTarget = target;
??????
????
??
}


@Override
public L2SkillType[] getSkillIds()
{
return SKILL_IDS;
}
}

If someone can help me with these two, i know these are few lines but im starter and i love editing the server instead of just make him alive.

Appreciate any comment...

Edited by OTzimakosKaiToTeras

6 answers to this question

Recommended Posts

  • 0
Posted

Regarding your wedding skill, forget what you thought : you only have to create a passive skill in datapack and reward it if isMarried() in rewardSkills() method, when a player enters in the world.

 

Regarding your karma stuff, I guess you already cared about setKarma(, which needs to be custom (because 10k karma is almost nothing). By "they attack" I guess you mean guards ? It's an AI thing, you can take a look on autoAttackCondition( on L2AttackableAI. This is where regular behavior of guards regarding PKs is made.

  • 0
Posted (edited)

Regarding your wedding skill, forget what you thought : you only have to create a passive skill in datapack and reward it if isMarried() in rewardSkills() method, when a player enters in the world.

 

Regarding your karma stuff, I guess you already cared about setKarma(, which needs to be custom (because 10k karma is almost nothing). By "they attack" I guess you mean guards ? It's an AI thing, you can take a look on autoAttackCondition( on L2AttackableAI. This is where regular behavior of guards regarding PKs is made.

Yeah i already notice that im searching in L2AttackableAI.java but i don't know how the lines should be i mean if target.isNotorious1() e.t.c this.

and about wedding system again don't forget i'm not professional a little more detail i would appreciate about the passive skill how it should be

if parther is in range of 1500 e.t.c 

 

anyway thanks

 

Ps. i see this code 

// Check if the actor is a L2GuardInstance
		if (getActiveChar() instanceof L2GuardInstance)
		{
			
			// Check if the L2PcInstance target has karma (=PK)
			if (target instanceof L2PcInstance && ((L2PcInstance) target).getKarma() > 0)
				// Los Check
				return GeoData.getInstance().canSeeTarget(me, target);
			
			//if (target instanceof L2Summon)
			//	return ((L2Summon)target).getKarma() > 0;
			
			// Check if the L2MonsterInstance target is aggressive
			if (target instanceof L2MonsterInstance && Config.GUARD_ATTACK_AGGRO_MOB)
				return ((L2MonsterInstance) target).isAggressive() && GeoData.getInstance().canSeeTarget(me, target);
			
			return false;

but i can't understand how to make it.

Edited by OTzimakosKaiToTeras
  • 0
Posted (edited)

About the range thing on your wedding skill, you need to create a listener system on knownlists. You have to edit the knownlist system which can be server breaking if you make it bad. I'm not even sure it's the most appropriate option... I would suggest to forget your initial idea, until postIL L2J servers got an appropriate answers which I don't know. You can also launch a task when a character is new married or just logged in as a married ppl, but well... It's fat.

 

About your guard thing, if it has to use different ranges you also have to make something regarding knownlists of the guards. Editing the location I said won't be enough.

 

Basically don't mess with range things if you're a total newcomer. And ranges are based on knownlists.

 

If someone wants to help more, he is welcomed.

Edited by Tryskell
  • 0
Posted

1st of all thanks for your answers on my posts
2nd i made them work now i have a new problem in a new
code i make. This code understand if your parthner (marriage) is inside radius of 500 and on pvp kill it addxp or restore HP (whatever) the idea is this what i did is this:

 

public void increasePvpKills(final L2Character target)
{
if (vs == null)
vs = new Versus(this);
else
vs.increaseKills();
if (target instanceof L2PcInstance && AntiFeedManager.getInstance().check(this, target))
{
// Add karma to attacker and increase its PK counter

PvpClanPoints();
CoupleSupport(this);


// Increase the kill count for a special hero aura
heroConsecutiveKillCount++;


// Ignore this
if (heroConsecutiveKillCount > 999)
setHero(true);


L2MultiFunctionZone.givereward(this);


// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
sendPacket(new UserInfo(this));
sendPacket(new ExBrExtraUserInfo(this));
}
}


/**
* If Player has partner and he/her inside X zone, restore HP points
*/

public static void CoupleSupport(final L2PcInstance player)
{


//Repeat
for (L2Character target : player.getKnownList().getKnownCharactersInRadius(500))//Gia kathe xaraktira entos 500 radius(xaraktires einai kai ta summon kai ta terata ktlp)
{
if(target instanceof L2PcInstance)//An o xaraktiras einai pektis 
{


if(((L2PcInstance) target).getPartnerId() == player.getObjectId());
{
player.sendMessage("Your parthner is inside Zone!");
target.addExpAndSp(50000000, 500000); //something


//player.sendPacket(new RadarControl(0, 2, 186214, 61591, -4152));


//target.setIsParalyzed(true);
           }
}
}
}

It work but it also give EXP and SP to victim(the player get killed). how to avoid this? I want only parthner get EXP (if inside zone)

Thanks in advance <3

  • 0
Posted

 

1st of all thanks for your answers on my posts

2nd i made them work now i have a new problem in a new

code i make. This code understand if your parthner (marriage) is inside radius of 500 and on pvp kill it addxp or restore HP (whatever) the idea is this what i did is this:

 

 

public void increasePvpKills(final L2Character target)

{

if (vs == null)

vs = new Versus(this);

else

vs.increaseKills();

if (target instanceof L2PcInstance && AntiFeedManager.getInstance().check(this, target))

{

// Add karma to attacker and increase its PK counter

 

PvpClanPoints();

CoupleSupport(this);

 

 

// Increase the kill count for a special hero aura

heroConsecutiveKillCount++;

 

 

// Ignore this

if (heroConsecutiveKillCount > 999)

setHero(true);

 

 

L2MultiFunctionZone.givereward(this);

 

 

// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter

sendPacket(new UserInfo(this));

sendPacket(new ExBrExtraUserInfo(this));

}

}

 

 

/**

* If Player has partner and he/her inside X zone, restore HP points

*/

public static void CoupleSupport(final L2PcInstance player)

{

 

 

//Repeat

for (L2Character target : player.getKnownList().getKnownCharactersInRadius(500))//Gia kathe xaraktira entos 500 radius(xaraktires einai kai ta summon kai ta terata ktlp)

{

if(target instanceof L2PcInstance)//An o xaraktiras einai pektis 

{

 

 

if(((L2PcInstance) target).getPartnerId() == player.getObjectId());

{

player.sendMessage("Your parthner is inside Zone!");

target.addExpAndSp(50000000, 500000); //something

 

 

//player.sendPacket(new RadarControl(0, 2, 186214, 61591, -4152));

 

 

//target.setIsParalyzed(true);

           }

}

}

}

It work but it also give EXP and SP to victim(the player get killed). how to avoid this? I want only parthner get EXP (if inside zone)

Thanks in advance <3

 

shame on you , i fixed it up  for you :(

  • 0
Posted (edited)

shame on you , i fixed it up  for you :(

Afcourse you are the best i know since i start working with l2j. Most of them here are wannabe child like xdem but you are real good :) appreciate

Thumbs up for L2j developer :)

 

And basicaly u the reason i loved l2j :P

Edited by OTzimakosKaiToTeras

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...