Likes: 0
Results 1 to 2 of 2
Thread: [C++]Event Checkpoint Guide
-
07-07-09, 02:45 AM #1
[C++]Event Checkpoint Guide
Register to remove this adEvent 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
Code:#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; } };
starting of the scripts its really absolutly
nothing to the actual NPC
lets make some menu selections for it
Code: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);
Code:Menu->AddItem(5, "What is my objective", 2);
speak to your check point porter
after that line add this
Code: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):NULL; if(pObject==NULL) return; switch(IntId) {
first off make sure you have a quest for
each check point if not make them now
then we do this
Code: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();
[code]
}
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();
Code:} } }; 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); }
thanks for listening please leave feedback : )
› See More: [C++]Event Checkpoint Guide
-
07-07-09, 04:26 AM #2
Register to remove this adnice +Rep