PDA

View Full Version : [C++]Event Checkpoint Guide



mager1794
07-07-09, 01:45 AM
Event Checkpoint Guide

by mager


I will teach you to make an npc that
will teleport you to your checkpoint
location all you need to do is create
a quest for each checkpoint you wish
to have

ok for our first bit of it lets put this



#include "StdAfx.h"
#include "Setup.h"

class SCRIPT_DECL Event : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);
void Destroy()
{
delete this;
}
};

k now we did that which is kinda just the
starting of the scripts its really absolutly
nothing to the actual NPC

lets make some menu selections for it



void Event::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
Menu->AddItem(5, "Take me to my checkpoint!", 1);
if you wish you can aswell add a line like this after that



Menu->AddItem(5, "What is my objective", 2);
now they have something that will exist when they
speak to your check point porter

after that line add this



Menu->SendTo(Plr);
}

void Prison::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NUL L;
if(pObject==NULL)
return;

switch(IntId)
{
excellent and now we make the check points
first off make sure you have a quest for
each check point if not make them now

then we do this



case 0: // Return to start
GossipHello(pCreature, Plr, true);
break;
case 1: // Teleport Down
{
if (Plr->HasFinishedQuest(QuestID) == false){
Plr->EventTeleport(0, X , Y, Z);
Plr->Gossip_Complete();
}
else if (Plr->HasFinishedQuest(QuestID) == false && Plr->HasFinishedQuest(400001) == true) {
Plr->EventTeleport(0, X, Y, Z);
Plr->Gossip_Complete();

just re add this line for a new quest to be added




}
else if (Plr->HasFinishedQuest(QuestID) == false && Plr->HasFinishedQuest(400001) == true) {
Plr->EventTeleport(0, X, Y, Z);
Plr->Gossip_Complete();
[/CODE

and you can make as many check points as you wish : )

if you added teh otehr menu item then this is what you do

[code]
case 2: // Information
{
Plr->BroadcastMessage("Fill in Event info here");
Plr->Gossip_Complete();
there now finish this script off with


}

}
};

void Event::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}

void SetupEvent(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new Event();
mgr->register_gossip_script([MOBENTRYID], gs);
}
and thats my guide well
thanks for listening please leave feedback : )

Onlykl
07-07-09, 03:26 AM
nice +Rep ;)