Forums WoW Modding Support Archives WoWModding Support Archives [DiscordArchive] do you mean a version using ground targeting or using unit data instead of one time accessed positio

[DiscordArchive] do you mean a version using ground targeting or using unit data instead of one time accessed positio

[DiscordArchive] do you mean a version using ground targeting or using unit data instead of one time accessed positio

Pages (5): Previous 1 2 3 4 5 Next
rektbyfaith
Administrator
0
06-17-2023, 05:34 PM
#21
Archived author: Nix • Posted: 2023-06-17T17:34:10.730000+00:00
Original source

Alright I got it to understand it can fetch the script
rektbyfaith
06-17-2023, 05:34 PM #21

Archived author: Nix • Posted: 2023-06-17T17:34:10.730000+00:00
Original source

Alright I got it to understand it can fetch the script

rektbyfaith
Administrator
0
06-17-2023, 05:34 PM
#22
Archived author: Nix • Posted: 2023-06-17T17:34:22.466000+00:00
Original source

Whether it is accurate or not I don't know, but it might be useful to you
rektbyfaith
06-17-2023, 05:34 PM #22

Archived author: Nix • Posted: 2023-06-17T17:34:22.466000+00:00
Original source

Whether it is accurate or not I don't know, but it might be useful to you

rektbyfaith
Administrator
0
06-17-2023, 05:34 PM
#23
Archived author: Nix • Posted: 2023-06-17T17:34:26.089000+00:00
Original source

```cpp
class spell_portal_creation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_portal_creation_SpellScript);

void HandleAfterCast()
{
if (Unit* target = GetHitUnit())
{
// Spawn the portal at the caster's location
float x, y, z;
GetCaster()->GetPosition(x, y, z);
GameObject* portal = GetCaster()->SummonGameObject(100001, x, y, z, 0, 0, 0, 0, 0, 0);

// Save the target's location
target->GetPosition(x, y, z);

// Store these coordinates in the go_portal class
if(auto script = dynamic_cast<go_portal*>(portal->GetScript()))
script->SetTargetPosition(Position(x, y, z));
}
}

void Register() override
{
AfterCast += SpellCastFn(spell_portal_creation_SpellScript::HandleAfterCast);
}
};
```
rektbyfaith
06-17-2023, 05:34 PM #23

Archived author: Nix • Posted: 2023-06-17T17:34:26.089000+00:00
Original source

```cpp
class spell_portal_creation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_portal_creation_SpellScript);

void HandleAfterCast()
{
if (Unit* target = GetHitUnit())
{
// Spawn the portal at the caster's location
float x, y, z;
GetCaster()->GetPosition(x, y, z);
GameObject* portal = GetCaster()->SummonGameObject(100001, x, y, z, 0, 0, 0, 0, 0, 0);

// Save the target's location
target->GetPosition(x, y, z);

// Store these coordinates in the go_portal class
if(auto script = dynamic_cast<go_portal*>(portal->GetScript()))
script->SetTargetPosition(Position(x, y, z));
}
}

void Register() override
{
AfterCast += SpellCastFn(spell_portal_creation_SpellScript::HandleAfterCast);
}
};
```

rektbyfaith
Administrator
0
06-17-2023, 05:34 PM
#24
Archived author: Nix • Posted: 2023-06-17T17:34:35.651000+00:00
Original source

```cpp
class go_portal : public GameObjectScript
{
public:
go_portal() : GameObjectScript("go_portal") { }

bool OnGossipHello(Player* player, GameObject* go) override
{
// Add a gossip option that teleports to the stored location
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, go->GetGUID());
return true;
}

bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action) override
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
// Teleport the player
player->TeleportTo(player->GetMapId(), _pos.GetPositionX(), _pos.GetPositionY(), _pos.GetPositionZ(), player->GetOrientation());
}
return true;
}

void SetTargetPosition(Position pos)
{
_pos = pos;
}

private:
Position _pos;
};
```
rektbyfaith
06-17-2023, 05:34 PM #24

Archived author: Nix • Posted: 2023-06-17T17:34:35.651000+00:00
Original source

```cpp
class go_portal : public GameObjectScript
{
public:
go_portal() : GameObjectScript("go_portal") { }

bool OnGossipHello(Player* player, GameObject* go) override
{
// Add a gossip option that teleports to the stored location
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, go->GetGUID());
return true;
}

bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 action) override
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
// Teleport the player
player->TeleportTo(player->GetMapId(), _pos.GetPositionX(), _pos.GetPositionY(), _pos.GetPositionZ(), player->GetOrientation());
}
return true;
}

void SetTargetPosition(Position pos)
{
_pos = pos;
}

private:
Position _pos;
};
```

rektbyfaith
Administrator
0
06-17-2023, 05:34 PM
#25
Archived author: Kiffy • Posted: 2023-06-17T17:34:52.788000+00:00
Original source

im drowning in code
rektbyfaith
06-17-2023, 05:34 PM #25

Archived author: Kiffy • Posted: 2023-06-17T17:34:52.788000+00:00
Original source

im drowning in code

rektbyfaith
Administrator
0
06-17-2023, 05:34 PM
#26
Archived author: Kiffy • Posted: 2023-06-17T17:34:55.855000+00:00
Original source

xD
rektbyfaith
06-17-2023, 05:34 PM #26

Archived author: Kiffy • Posted: 2023-06-17T17:34:55.855000+00:00
Original source

xD

rektbyfaith
Administrator
0
06-17-2023, 05:34 PM
#27
Archived author: Kiffy • Posted: 2023-06-17T17:34:59.763000+00:00
Original source

ill try some stuff
rektbyfaith
06-17-2023, 05:34 PM #27

Archived author: Kiffy • Posted: 2023-06-17T17:34:59.763000+00:00
Original source

ill try some stuff

rektbyfaith
Administrator
0
06-17-2023, 05:35 PM
#28
Archived author: Nix • Posted: 2023-06-17T17:35:42.419000+00:00
Original source

It only took 4 messages to convince it that go_portal in fact does exist, and isn't magically resolved at runtime <:kekw:728766271772033046>

It initially said GameObjectScript is static and there is no instance on any specific gameobject... silly gpt
rektbyfaith
06-17-2023, 05:35 PM #28

Archived author: Nix • Posted: 2023-06-17T17:35:42.419000+00:00
Original source

It only took 4 messages to convince it that go_portal in fact does exist, and isn't magically resolved at runtime <:kekw:728766271772033046>

It initially said GameObjectScript is static and there is no instance on any specific gameobject... silly gpt

rektbyfaith
Administrator
0
06-17-2023, 05:41 PM
#29
Archived author: bulbous0617 • Posted: 2023-06-17T17:41:13.461000+00:00
Original source

the spell script should work, for the gameobject one you can use GameObjectAI instead of GameObjectScript and then register it with `RegisterGameObjectAI(go_portal)`, saves you from doing loader stuff
rektbyfaith
06-17-2023, 05:41 PM #29

Archived author: bulbous0617 • Posted: 2023-06-17T17:41:13.461000+00:00
Original source

the spell script should work, for the gameobject one you can use GameObjectAI instead of GameObjectScript and then register it with `RegisterGameObjectAI(go_portal)`, saves you from doing loader stuff

rektbyfaith
Administrator
0
06-17-2023, 05:44 PM
#30
Archived author: Kiffy • Posted: 2023-06-17T17:44:36.989000+00:00
Original source

I do use gameobjectai currently, but why wouldnt a loader be needed for the spellscript? has been my experience that it doesnt register without it
rektbyfaith
06-17-2023, 05:44 PM #30

Archived author: Kiffy • Posted: 2023-06-17T17:44:36.989000+00:00
Original source

I do use gameobjectai currently, but why wouldnt a loader be needed for the spellscript? has been my experience that it doesnt register without it

Pages (5): Previous 1 2 3 4 5 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)