Forums WoW Modding Support Archives TrinityCore Discord Archives [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 ?

[DiscordArchive] thank u <@216234897390436353> , do i have to put my "script" in the core or build folder ?

Pages (2): Previous 1 2
rektbyfaith
Administrator
0
06-29-2025, 01:05 PM
#11
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();
}
```
rektbyfaith
06-29-2025, 01:05 PM #11

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();
}
```

rektbyfaith
Administrator
0
06-29-2025, 01:06 PM
#12
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
```
rektbyfaith
06-29-2025, 01:06 PM #12

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
```

rektbyfaith
Administrator
0
06-29-2025, 01:06 PM
#13
Archived author: Dyor • Posted: 2025-06-29T13:06:42.660000+00:00
Original source

or i am wrong here
rektbyfaith
06-29-2025, 01:06 PM #13

Archived author: Dyor • Posted: 2025-06-29T13:06:42.660000+00:00
Original source

or i am wrong here

rektbyfaith
Administrator
0
06-29-2025, 01:09 PM
#14
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 ))
rektbyfaith
06-29-2025, 01:09 PM #14

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 ))

Pages (2): Previous 1 2
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)