Jump to content
  • 0

Add Point Rep clan on Mob's


Question

8 answers to this question

Recommended Posts

  • 0
Posted
Index: L2J_Server/com/l2jserver/gameserver/model/actor/instance
===================================================================
---L2J_Server/com/l2jserver/gameserver/model/actor/instance/L2MonsterInstance.java
+++ L2J_Server/com/l2jserver/gameserver/model/actor/instance/L2MonsterInstance.java

@@ 159 , 23   162 , 24 @@
@Override
public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	if (_maintenanceTask != null)
	{
		_maintenanceTask.cancel(false); // doesn't do it?
		_maintenanceTask = null;
	}
+		if (getNpcId() == YourMobId) //Set here which mob ID you want to "drop" fame on die.
+		{
+			L2PcInstance kil = (L2PcInstance) killer;
+			//kil.setFame(kil.getFame() + Fame_Points); // set here how many fame points you want to add in character
+                      kil.getClan().addReputationScore(Clan_points, true) //set on clan_points number of points you want to give
+		}
	return true;
}

  • 0
Posted

In L2MonsterInstance.java

 

find public boolean doDie(L2Character killer)

 

and add this:

 

if(getNpcId() == MOBID)

{

if(((L2PcInstance) killer).getClan() == null)

{

return false;

}

((L2PcInstance) killer).getClan().addReputationScore(1, true); Adds 1 clan rep if you want more increase the number "1"

((L2PcInstance) killer).sendMessage("Your Clan Reputation is increased.");

 

}

  • 0
Posted

`Heroin/exity, your code can lead to different errors :

  • ClassException if the killer wasn't a L2PcInstance (can't cast that on that).
  • no consideration if the killer was a summon.
  • NPE if the given player hasn't clan (for `Heroin).

 

For the first, the use of getActingPlayer() resolves the problem, and also take in consideration if the killer was a summon (taking the summon's owner). If == null, it means the player can't be found (so the summon hasn't any owner, or the player isn't existing anymore).

 

For the second, a null check on getClan() is required (or if your pack got a hasClan() method, use it).

  • 0
Posted

true, but i didnt give more than 1 minutes to test this code, and i did it firstly to add FAME points, which it is working ok. However, when i saw again topic title i understood that i gave this guy wrong code since he needs for clan reputation and i gave him code for fame. So, i add to my "code" a line with reputation poitns without see all over the conditions. I hope you understand what i mean ;)

  • 0
Posted

Well, I just warn the topic creator than your code is flawed and it shouldn't be just c/ped.

 

Rep p or fame, you should share "working" code :P. And your first code, even regarding fame points, had the cast problem.

  • 0
Posted

Until author isn't satistfied, it's not cool to lock. Just let the topic being covered by other topics and get lost in the sea of old topics.

 

:alone: topic

Guest
This topic is now closed to further replies.


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock