[DiscordArchive] thank u <@216234897390436353> , do i have to put my "script" in the core or build folder ?
[DiscordArchive] thank u <@216234897390436353> , do i have to put my "script" in the core or build folder ?
Archived author: Dyor • Posted: 2025-06-29T13:05:39.602000+00:00
Original source
okey, so i was looking on some scripts online and they looked something like this :
```public:
my_area_loot_script() : PlayerScript("my_area_loot_script") {}
void OnLootOpened(Player* player, ObjectGuid guid) override
{
if (!guid.IsCreature())
return;
Creature* lootSource = player->GetMap()->GetCreature(guid);
if (!lootSource || !lootSource->isDead())
return;
float radius = 20.0f;
std::list<Creature*> nearbyCorpses;
player->GetMap()->GetCreatureListInRange(
lootSource->GetPositionX(),
lootSource->GetPositionY(),
lootSource->GetPositionZ(),
radius,
nearbyCorpses);
for (Creature* creature : nearbyCorpses)
{
if (creature == lootSource || !creature->isDead())
continue;
if (creature->loot.isLooted())
continue;
if (creature->GetLootRecipient() != player &&
(!player->GetGroup() || creature->GetLootRecipientGroup() != player->GetGroup()))
continue;
for (auto& li : creature->loot.items)
{
if (li.is_looted)
continue;
lootSource->loot.items.push_back(li);
li.is_looted = true;
if (creature->loot.unlootedCount > 0)
--creature->loot.unlootedCount;
}
if (creature->loot.unlootedCount == 0)
creature->loot.NotifyMoneyRemoved();
}
}
};
void AddSC_my_area_loot_script()
{
new my_area_loot_script();
}
```
Archived author: Dyor • Posted: 2025-06-29T13:06:39.019000+00:00
Original source
so if im correct i need to mae it like this or ?
```void Creature(Creature* creature, SmartScript) override
```
Archived author: Dyor • Posted: 2025-06-29T13:06:42.660000+00:00
Original source
or i am wrong here
Archived author: Dyor • Posted: 2025-06-29T13:09:56.317000+00:00
Original source
(new to c++ ( was learning the basics ((new to making scripts ))