TrinityCore/TrinityCore — Issue #3604: [Quest/FIX] Missing Friends
Author: Discover-
Created: 2011-10-21 05:29:01+00:00
State: open

A lot of thanks go to Retriman for the help. :)

```cpp
/*########
#### go_veil_skith_cage
#####*/

enum MissingFriends
{
QUEST_MISSING_FRIENDS = 10852,
NPC_CAPTIVE_CHILD = 22314,
SAY_FREE_0 = 0,
SAY_FREE_1 = 1,
SAY_FREE_2 = 2,
SAY_FREE_3 = 3
};

class go_veil_skith_cage : public GameObjectScript
{
public:
go_veil_skith_cage() : GameObjectScript("go_veil_skith_cage") { }

bool OnGossipHello(Player *player, GameObject* go)
{
if (player->GetQuestStatus(QUEST_MISSING_FRIENDS) == QUEST_STATUS_INCOMPLETE)
{
std::list ChildrenList;
GetCreatureListWithEntryInGrid(ChildrenList, go, NPC_CAPTIVE_CHILD, INTERACTION_DISTANCE);
for (std::list::const_iterator itr = ChildrenList.begin(); itr != ChildrenList.end(); ++itr)
{
go->UseDoorOrButton();
player->KilledMonsterCredit(NPC_CAPTIVE_CHILD, (*itr)->GetGUID());
(*itr)->ForcedDespawn(6000);
(*itr)->GetMotionMaster()->MoveFleeing(player, 3500);

switch(urand(0,3))
{
case 0:
DoScriptText(SAY_FREE_0, *itr);
break;
case 1:
DoScriptText(SAY_FREE_1, *itr);
break;
case 2:
DoScriptText(SAY_FREE_2, *itr);
break;
case 3:
DoScriptText(SAY_FREE_3, *itr);
break;
}

(*itr)->GetMotionMaster()->Clear();
}
}
return false;
}
};
```

```sql
-- [Q] Missing Friends

-- ScriptName for the cages
UPDATE `gameobject_template` SET `ScriptName`='go_veil_skith_cage' WHERE `entry` IN (185202,185203,185204,185205);

-- Texts
DELETE FROM `creature_text` WHERE `entry`=22314;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(22314,0,0,"Woot!",12,0,100,0,0,0,"Captive Child"),
(22314,0,0,"I think those weird bird guys were going to eat us. Gross!",12,0,100,0,0,0,"Captive Child"),
(22314,0,0,"Yay! We''re free!",12,0,100,0,0,0,"Captive Child"),
(22314,0,0,"Gross!",12,0,100,0,0,0,"Captive Child");
```