• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] my first script outdoor pvp get error?? don't know why

Status
Not open for further replies.

Shaorin

Respected Member
hi all

i ahve tryd to make a script here but when i follow a vid from Tommy i get an error that his does not.

error: http://puu.sh/6bG4l.png

main cpp
Code:
#include "OutDorrPvP_QD.h"


OutdoorPvPSunwell::OutdoorPvPSunwell()
{
	m_TypeId = OUTDOOR_PVP_QD;
	hordeResources = 300;
	allyResources = 300;
}

bool OutdoorPvPSunwell::SetupOutdoorPvP()
{
	for (uint8 i = 0; i < sizeof(OutdoorPvPZone) / sizeof(uint32); ++i)
		RegisterZone(OutdoorPvPZone[i[);
	return true;
}

void  OutdoorPvPSunwell::HandlePlayerEnterZone(Player* player, uint32 zone)
{
	ChatHandler(player->GetSession()).SendSysMessage("You have Enter a PvP Zone!");
	OutdoorPvP::HandlePlayerEnterZone(player, zone);
}

void OutdoorPvPSunwell::HandlePlayerLeaveZone(Player* player, uint32 zone)
{
	OutdoorPvP::HandlePlayerLeaveZone(player, zone);
}

void OutdoorPvPSunwell::HandleKill(Player* player, Unit* killed)
{
	OutdoorPvP::HandleKill(player, killed);
}

bool OutdoorPvPSunwell::Update(uint32 diff)
{
	allyResources -= 3;
	hordeResources -= 3;
	if (allyResources <= 0)
	{
		// Horde Loses
	}

	if (hordeResources <= 0)
	{
		// Ally Loses
	}
	OutdoorPvP::Update(diff);
}

class pvp_resource_sunwell : public OutdoorPvPScript
{
public:
	pvp_resource_sunwell() : OutdoorPvPScript ("pvp_resource_sunwell") { }
};

and the .h

Code:
#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"

const uint32 OutdoorPvPZone [1] = { 4080 };

class OutdoorPvPSunwell : public OutdoorPvP
{
public:
	OutdoorPvPSunwell(); 
	
	bool SetupOutdoorPvP();
	// Handle Join and Öeave Zone
	void HandlePlayerEnterZone(Player* player, uint32 zone);
	void HandöerPlayerLeaveZone(Player* player, uint32 zone);

	void HandleKill(Player* player, Unit* killed);

	bool Update(uint32 diff);

private:
	uint32 hordeResources;
	uint32 allyResources;

};


i ahve other questins too. i wonder cuz i sounds that you can do so mutch but he did never expain in a way so you as nood and never done c++ to undersand what he means^^ i don't mean anything rude i like his work and its a good wau to start as a noob, i think i will learn alot.

but that i want to know are as reword for winning how can i change the NPC faction so that i will be like WG? and can i make this so you can kill en npc and then you win or so that u start it but talking to an NPC and then select something from a Gossip?

i don't want you really to do it for me. i just want a really good explaintion on how to do it so i can learn instead of asking the next time and so on.

i have abit hard to undersand when someone just worte a pace of code and nothing more, its ok to change stuff what a diff coulor i will get that.^^

sorry for bad eng and bad explain.

if you want to u can hit me up on skype too the i will learn mutch faster^^
skype: qvika_gilla

u don't need to but u deside^^
 

Tommy

Founder
In your header file, you're using an invalid character "ö" and the wrong character. It should be an l, not an o.

You had "HandöerPlayerLeaveZone", it should be:

Code:
void HandlePlayerLeaveZone(Player* player, uint32 zone);
 

Shaorin

Respected Member
get new error^^

3>c:\trinitycore-master\server\src\server\scripts\outdorrpvp_qd.cpp(50): error C4716: 'OutdoorPvPSunwell::Update' : must return a value

you did not worite anything else then i did so why do i get error?

its a bit hard to see if i should be : or ; and so the youtube vid are ok but its damn hard^ but the you learn^^
 

Tommy

Founder
It isn't hard at all, if you look at the examples, it shows you everything. The error you're getting is an easy fix, just add a 'return false' at the end of the Update function:

Corrected:

Code:
bool OutdoorPvPSunwell::Update(uint32 diff)
{
	allyResources -= 3;
	hordeResources -= 3;
	if (allyResources <= 0)
	{
		// Horde Loses
	}

	if (hordeResources <= 0)
	{
		// Ally Loses
	}
	OutdoorPvP::Update(diff);
    return false;
}
 

Shaorin

Respected Member
whatttt????? if i need to that?`why did you not do that in you tut for this?

i ahve copy everthing to start learning its fun that i tut can give me an error that not the teatcher are getting^^

but thx so mutch for your kindness and helping support

just in case next time plz tell us that if this i s happening do this to fix it^^ cuz for them how have never write a script theu will be sack as i was^^ this is only what i think. i know you do good work but i think your explanition are to bad for bigginers^^ i just say this cuz of my own experience^^

anyway keep up the good work.

- - - Updated - - -

it fixed it btw thx.
 

Tommy

Founder
whatttt????? if i need to that?`why did you not do that in you tut for this?

i ahve copy everthing to start learning its fun that i tut can give me an error that not the teatcher are getting^^

but thx so mutch for your kindness and helping support

just in case next time plz tell us that if this i s happening do this to fix it^^ cuz for them how have never write a script theu will be sack as i was^^ this is only what i think. i know you do good work but i think your explanition are to bad for bigginers^^ i just say this cuz of my own experience^^

anyway keep up the good work.

- - - Updated - - -

it fixed it btw thx.

Calm down? If you look at the source file of my OutdoorPvP example on line 61, I do have a return false: http://pastebin.com/pApiCTAz

Not my fault if you're doing this and forgetting some code. It's all trial and error anyway, you'll learn..
 

Shaorin

Respected Member
ok i see^^ but you did not have it in the vid^^

http://puu.sh/6bLCe.jpg

btw something else is wrong i can complite whitout any problems but when i enter my zonr nothing happends and nothing happends when i kill someone^^

anything i can do to fix it?

- - - Updated - - -

maybe i don't saw it cuz i have dowloaded it so i can watch and do this on the go^^ maybe this vid are old its this one
EmuDevs_ TrinityCore - Setting up an OutdoorPvP Template
 

Tommy

Founder
I'm aware I don't have it in the video, but sometimes during the end I fix those or I fix it within the source code itself.

Show me your new edited scripts. You probably didn't code the OutdoorPvPScript right or you didn't set the script up in the table outdoorpvp_template.
 

Shaorin

Respected Member
ok here.

cpp:
[

#include "OutDorrPvP_QD.h"


OutdoorPvPSunwell::OutdoorPvPSunwell()
{
m_TypeId = OUTDOOR_PVP_QD;
hordeResources = 300;
allyResources = 300;
}

bool OutdoorPvPSunwell::SetupOutdoorPvP()
{
for (uint8 i = 0; i < sizeof(OutdoorPvPZone) / sizeof(uint32); ++i)
RegisterZone(OutdoorPvPZone);
return true;
}

void OutdoorPvPSunwell::HandlePlayerEnterZone(Player* player, uint32 zone)
{
ChatHandler(player->GetSession()).SendSysMessage("You have Enter a PvP Zone!");
OutdoorPvP::HandlePlayerEnterZone(player, zone);
}

void OutdoorPvPSunwell::HandlePlayerLeaveZone(Player* player, uint32 zone)
{
OutdoorPvP::HandlePlayerLeaveZone(player, zone);
}

void OutdoorPvPSunwell::HandleKill(Player* player, Unit* killed)
{
OutdoorPvP::HandleKill(player, killed);
}

bool OutdoorPvPSunwell::Update(uint32 diff)
{
allyResources -= 3;
hordeResources -= 3;
if (allyResources <= 0)
{
// Horde Loses
}

if (hordeResources <= 0)
{
// Ally Loses
}
OutdoorPvP::Update(diff);
return false;
}

class pvp_resource_sunwell : public OutdoorPvPScript
{
public:
pvp_resource_sunwell() : OutdoorPvPScript ("pvp_resource_sunwell") { }
};


/QUOTE]

h.

#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"

const uint32 OutdoorPvPZone[1] = { 4080 };

class OutdoorPvPSunwell : public OutdoorPvP
{
public:
OutdoorPvPSunwell();

bool SetupOutdoorPvP();
// Handle Join and leave Zone
void HandlePlayerEnterZone(Player* player, uint32 zone);
void HandlePlayerLeaveZone(Player* player, uint32 zone);

void HandleKill(Player* player, Unit* killed);

bool Update(uint32 diff);

private:
uint32 hordeResources;
uint32 allyResources;

};

outdoorpvp.h

enum OutdoorPvPTypes
{
OUTDOOR_PVP_HP = 1,
OUTDOOR_PVP_NA = 2,
OUTDOOR_PVP_TF = 3,
OUTDOOR_PVP_ZM = 4,
OUTDOOR_PVP_SI = 5,
OUTDOOR_PVP_EP = 6,
OUTDOOR_PVP_QD = 7
};

#define MAX_OUTDOORPVP_TYPES 8

db:

http://puu.sh/6bMb7.png

did i do something wrong? or should i just replace:

pvp_resource_sunwell

whit

OUTDOOR_PVP_QD

not sure^^

thx so mutch for your help^^
 

Tommy

Founder
This is wrong:

Code:
class pvp_resource_sunwell : public OutdoorPvPScript
{
public:
    pvp_resource_sunwell() : OutdoorPvPScript ("pvp_resource_sunwell") { }
};

You're missing the GetOutdoorPvP() constant.

Look at the source file template.. http://pastebin.com/pApiCTAz

It should look like:

Code:
class pvp_resource_sunwell : public OutdoorPvPScript
{
public:
    pvp_resource_sunwell() : OutdoorPvPScript ("pvp_resource_sunwell") { }

[COLOR="#00FF00"]    OutdoorPvP* GetOutdoorPvP() const
    {
        return new OutdoorPvPSunwell();
    }[/COLOR]
};

If you look carefully, you'll see what's wrong if you compare my example script with your script.
 

Shaorin

Respected Member
but PLZ i said i have downloaded the vid ofc i think its 100% complite and nothing i need to do a long research on. other then that its good to have something to follow. but maybe somethingi can do on the go cuz its not done to 100%.

plz if you know any other vids plz fix them cuz i think ther is more ppl how dl thema nd watch them later^^

thx one more time for the help. hope the otehr ones are better if not i will post more avout error if i can fix them my self^^ i think i will learn something someday^^

- - - Updated - - -

hmm still nothing.

http://puu.sh/6bQcm.jpg
 

Shaorin

Respected Member
oo i find it.

sorry but how OLD is THAT VID?????

this not fun anymore!!!!


plz if you know that you have chaned something after the vid is done plz reupload a nre one what all the changed in it. other then that u need to check you script and then see. but then you just can copy paste it if u are lazy. i want to take me an hour to write it myself to learn but its not easy when the vid are inconplite.


i hope i will know what to do if i get in touble next time^^ im happy for your work and so on^^ i just get angry of unfinish stuff that are made as helping things whits in the end req you to know are ask for help anyway^^

so im not mad at you sa a person or anything i like all the help and so on that you give us and me^^
 

Shaorin

Respected Member
hmm its works now but how do i get it annanced in the world in the zone when ppl are killing and so. cuz i don't know when somone have won or not^^
 
Status
Not open for further replies.
Top