Hi dev ! I share this tutoriel, This system gives a similar drop at the same time to all players in your group during a dungeon. In a quest that gives this example:
1. Open your questlua_dungeon.cpp 2. After the function int dungeon_notice (lua_State * L) add this:
3.After line { "notice", dungeon_notice}, add this:
4. Open your file dungeon.h 5. Find the function void Notice(const char* msg); and add this function:
6.Open your file dungeon.cpp 7.Search function void CDungeon::Notice(const char* msg) and add the following function:
Code
8. Search the struct FNotice thereafter add the following structure:
Code
- struct FDROP { FDROP(int vnum) : m_vnum(vnum) { } void operator() (LPENTITY ent) { if (ent->IsType(ENTITY_CHARACTER)) { LPCHARACTER ch = (LPCHARACTER) ent; if (ch->IsPC()) { LPITEM item = NULL; item = ITEM_MANAGER::instance().CreateItem(m_vnum); item->SetOwnership( ch ); PIXEL_POSITION pos; pos.x = ch->GetX() + number(-200, 200); pos.y = ch->GetY() + number(-200, 200); item->AddToGround(ch->GetMapIndex(), pos); item->StartDestroyEvent(); } } } int m_vnum; };
Compile the game. Open the quest_function and add " d.drop " Jin.