[C++] Honor reward for killing same faction in Gurubashi Arena

MISLEADING TITLE

Should be: Honor reward for killing same faction in Gurubashi Arena.

I was bored, so i decided to make this: http://pastebin.com/yh473VVW

A simple C++ script that should give you 100 honor points if you kill a member of the same faction as you if you are in the Gurubashi Battle Ring.

AreaID and Reward is changeable.

Variable reward = reward in honor points

Variable pvparea = areaid players must be in to get the rewards.

I hope you like it!

Little typo there.

on line 14.

int area = area; should be

int area = area1;

Thank you a lot for pointing out! =)

the script is not working for me, i am killing my own faction in guru but nothing

Make sure you’ve applied the typo-fix in the second post. Otherwise the condition

if(area == pvparea)will never be met because ‘area’ never has a value set. /emoticons/default_smile.png

It doesn’t work ;/


	#include "ScriptPCH.h"


	class gurubashipvp : public PlayerScript

	{

	public:

			gurubashipvp() : PlayerScript("gurubashipvp") { }


		void OnPvPKill(Player *pKiller, Player *pVictim) {

					int reward = 100; //How many points shall the killer get?

					int pvparea = 2177; //Area ID of the place both characters must be to be eligible for reward

				int area1 = pKiller->GetAreaId();

				int area2 = pVictim->GetAreaId();

					if(area1 == area2)

					{

							int area = area1;

							if(area == pvparea)

							{

									if(pKiller->GetTeam() != pVictim->GetTeam())

									{

										int honor = pKiller->GetHonorPoints();

										pKiller->ModifyHonorPoints(honor + reward);

									}

							}

					}

		}

	};


	void AddSC_gurubashipvp()

	{

			new gurubashipvp();

	}

core_version: TrinityCore rev. 2012-05-25 16:44:34 +0200 (c40d86f05f58+) (Win32, Release)

Can be done much easier. Go into Player.cpp and navigate to Player::RewardHonor and replace line 7290, which looks like this:

if (GetTeam() == victim->GetTeam() && !sWorld->IsFFAPvPRealm())

with the following:

if (GetTeam() == victim->GetTeam() && GetAreaId() != 2177 && victim->GetAreaId() != 2177)

This also means the killer gets a normal and blizzlike (as long as current formula IS blizzlike…) amount of honor on pvp kill of own faction.

I would not listen to Discovered.

You should keep your scripts “individual” without having to change the core code (anything that is not in the src/scripts folder).

If the core code changes, you would need to handle the merge errors and it might break your scripts.

If you keep the scripts in the correct place, you will have much less trouble.

Meh, than use this (untested but should work):

[CODE]#include “ScriptPCH.h”
#include “Group.h”

class gurubashipvp : public PlayerScript
{
public:
gurubashipvp() : PlayerScript(“gurubashipvp”) { }

	void OnPvPKill(Player* killer, Player* victim)
	{
		Group* group = killer->GetGroup();

		if (killer->GetTeam() == victim->GetTeam() && killer->GetAreaId() == 2177 && victim->GetAreaId() == 2177)
			killer->RewardHonor(victim, killer->GetGroup() ? group->GetMembersCount() : 1);
	}

};

void AddSC_gurubashipvp()
{
new gurubashipvp();
}[/code]
[/CODE]

Hm, no nothing. the script doesn’t work /emoticons/default_sad.png

Try now, made a little change.