Kết quả 1 đến 1 của 1
Chủ đề: [Source] Swamp Of Calmness Event
-
12-08-10, 04:01 PM #1
- Ngày tham gia
- Sep 2009
- Bài viết
- 203
- Thanks
- 0
- Thanked 4 Times in 4 Posts
[Source] Swamp Of Calmness Event
SwampPeace.cpp
Code://============================================================// // Swamp Of Calmness Event Coded By M.E.S // // // //============================================================// #include "StdAfx.h" #include "SwampEvent.h" #include "GameServer.h" #include "Message.h" #include "User.h" #include "Utilidades.h" int iSwampItemBugCount; SwampPeace Swamp; SwampBag g_SwampItemBag[255]; // ------------------------------------------------------------- SwampPeace::SwampPeace() { // ---- } // ------------------------------------------------------------- SwampPeace::~SwampPeace() { // ---- } // ------------------------------------------------------------- void SwampPeace::LoadSwampConfig() { Swamp.SwampEnabled = GetPrivateProfileInt("SwampOfPeace","SwampOfPeaceEventEnabled",1,EventFile); Swamp.SwampMinutes = GetPrivateProfileInt("SwampOfPeace","SwampOfPeaceEventDuration",10,EventFile)*60; if (Swamp.SwampEnabled == 1) { Swamp.LoadSwampEventItemBag(); } } // ------------------------------------------------------------- void SwampPeace::LoadSwampEventItemBag() { FILE * FilePath; char cLineText[255] = {0}; int iIndex = 0; int iNumber[9] = {0}; // ---- fopen_s(&FilePath,SwampEventItemBag,"r"); // ---- while(fgets (cLineText , 255 , FilePath) != NULL) { if(cLineText[0] != '/' && cLineText[1] != '/' && strlen(cLineText) > 3) { sscanf_s(cLineText , "%d %d %d %d %d %d %d %d %d", &iNumber[0], &iNumber[1], &iNumber[2],&iNumber[3], &iNumber[4], &iNumber[5], &iNumber[6], &iNumber[7], &iNumber[8]); // ---- g_SwampItemBag[iIndex].iType = iNumber[0]; g_SwampItemBag[iIndex].iIndex = iNumber[1]; g_SwampItemBag[iIndex].iLevel = iNumber[2]; g_SwampItemBag[iIndex].iDur = iNumber[3]; g_SwampItemBag[iIndex].iLuck = iNumber[4]; g_SwampItemBag[iIndex].iSkill = iNumber[5]; g_SwampItemBag[iIndex].iOption = iNumber[6]; g_SwampItemBag[iIndex].iExc = iNumber[7]; g_SwampItemBag[iIndex].iAnc = iNumber[8]; // ---- iSwampItemBugCount++; iIndex++; } } // --- fclose(FilePath); } // ------------------------------------------------------------- void SwampPeace::SwampMonsterManager(int aIndex,int MobIndex) { if (Swamp.SwampEnabled == 1 && Swamp.SwampIsRunning == 1) { OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex); OBJECTSTRUCT *gObjMob = (OBJECTSTRUCT*)OBJECT_POINTER(MobIndex); // ---- if (MobIndex == Swamp.SwampBossIndex && Swamp.SwampBossKilled == 0) { int Random = rand()%iSwampItemBugCount; int RewardItem = ((g_SwampItemBag[Random].iType*512)+g_SwampItemBag[Random].iIndex); ItemSerialCreateSend(aIndex,gObjMob->MapNumber,gObjMob->X,gObjMob->Y,RewardItem,g_SwampItemBag[Random].iLevel,g_SwampItemBag[Random].iDur,g_SwampItemBag[Random].iLuck,g_SwampItemBag[Random].iSkill,g_SwampItemBag[Random].iOption,aIndex,g_SwampItemBag[Random].iExc,g_SwampItemBag[Random].iAnc); Swamp.SwampBossKilled = 1; } } } // ------------------------------------------------------------- void SwampPeace::SwampAddMonster() { int RandomMapSwamp = rand()%4; if (RandomMapSwamp == 0) { Swamp.SwampBossIndex = MonsterAddAndSpawn(561,56,96,167); } else if (RandomMapSwamp == 1) { Swamp.SwampBossIndex = MonsterAddAndSpawn(561,56,60,77); } else if (RandomMapSwamp == 2) { Swamp.SwampBossIndex = MonsterAddAndSpawn(561,56,140,48); } else if (RandomMapSwamp == 3) { Swamp.SwampBossIndex = MonsterAddAndSpawn(561,56,204,114); } else { Swamp.SwampBossIndex = MonsterAddAndSpawn(561,56,96,167); } } // ------------------------------------------------------------- void SwampPeace::SwampOfPeaceStart() { if (Swamp.SwampEnabled == 1 && Swamp.SwampIsRunning == 0) { m_Message.AllServerGold("[Swamp of Peace] Medusa has corrupted Swamp. Find her!!"); Swamp.SwampTimer = Swamp.SwampMinutes; Swamp.SwampIsRunning = 1; Swamp.SwampBossKilled = 0; Swamp.SwampAddMonster(); _beginthread(SwampOfPeaceTimer,0,NULL); } } // ------------------------------------------------------------- void SwampOfPeaceTimer(void * lpParam) { while (true) { if (Swamp.SwampTimer == 0) { m_Message.AllServerGold("[Swamp of Peace] Medusa has taken Swamp"); gObjDel(Swamp.SwampBossIndex); Swamp.SwampIsRunning = 0; _endthread(); } if (Swamp.SwampBossKilled == 1) { m_Message.AllServerGold("[Swamp of Peace] Medusa has been defeated. Peace has returned"); gObjDel(Swamp.SwampBossIndex); Swamp.SwampIsRunning = 0; _endthread(); } Swamp.SwampTimer = Swamp.SwampTimer - 1; Sleep(1000); } } // -------------------------------------------------------------
Code://============================================================// // Swamp Of Calmness Event Coded By M.E.S // // // //============================================================// struct SwampBag { int iType; int iIndex; int iLevel; int iDur; int iLuck; int iSkill; int iOption; int iExc; int iAnc; }; class SwampPeace { public: SwampPeace(); ~SwampPeace(); // ---- void LoadSwampConfig(); void LoadSwampEventItemBag(); void SwampMonsterManager(int aIndex,int MobIndex); void SwampRewardItem(int aIndex); void SwampAddMonster(); void SwampOfPeaceStart(); // ---- int SwampEnabled; int SwampIsRunning; int SwampMinutes; int SwampTimer; int SwampBossKilled; int SwampBossIndex; // ---- }; extern SwampPeace Swamp; void SwampOfPeaceTimer(void * lpParam);
That is for make a Random Medusa respawn with Event Manager
But you can change Monster respawn time in Monster.txt and make event like Kundum in Kalima. For that you have to only read eventitembag and make monstermanager function.
Credits : M.E.SKhách viếng thăm hãy cùng MinBrack1 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!
Các Chủ đề tương tự
-
Cần mở sự kiện event SCF 10.07.65
Bởi skyexe001 trong diễn đàn Hỏi Đáp/ Yêu CầuTrả lời: 6Bài viết cuối: 21-06-11, 02:54 AM -
NPC Sky Event SCf .65 không dùng được
Bởi ngocanh87 trong diễn đàn Hỏi Đáp/ Yêu CầuTrả lời: 2Bài viết cuối: 11-06-11, 03:17 PM -
Cần sửa lỗi Sự kiện Sky Event Sẻver SCF 10.07.65
Bởi TRIEN trong diễn đàn Hỏi Đáp/ Yêu CầuTrả lời: 4Bài viết cuối: 15-05-11, 11:11 AM -
Hướng Dẫn Viết 1 Event Như Event Ngũ Quả
Bởi ThanhVipLn trong diễn đàn ScriptsTrả lời: 27Bài viết cuối: 02-09-10, 04:13 PM -
xin hỏi cách tạo GM và bật các event
Bởi MotAiDo trong diễn đàn Các Server Không Nằm Trong BoxTrả lời: 8Bài viết cuối: 06-07-08, 08:45 PM