Forums WoW Modding Support Archives WoWModding Threads [DiscordArchive] Custom spell and item cooldown

[DiscordArchive] Custom spell and item cooldown

[DiscordArchive] Custom spell and item cooldown

Pages (2): 1 2 Next
rektbyfaith
Administrator
0
07-03-2025, 01:58 PM
#1
Archived author: Needle • Posted: 2025-07-03T13:58:55.277000+00:00
Original source

rektbyfaith
07-03-2025, 01:58 PM #1

Archived author: Needle • Posted: 2025-07-03T13:58:55.277000+00:00
Original source

rektbyfaith
Administrator
0
07-03-2025, 01:58 PM
#2
Archived author: Needle • Posted: 2025-07-03T13:58:56.201000+00:00
Original source

Thread automatically created by hoodie in <#415944535718494208>
rektbyfaith
07-03-2025, 01:58 PM #2

Archived author: Needle • Posted: 2025-07-03T13:58:56.201000+00:00
Original source

Thread automatically created by hoodie in <#415944535718494208>

rektbyfaith
Administrator
0
07-03-2025, 01:59 PM
#3
Archived author: hoodie • Posted: 2025-07-03T13:59:16.611000+00:00
Original source

Here are the steps of what I did:

- Using WoW Spell Editor, duplicate Hearthstone into a new spell ID 966559. "Category recovery time" set to 0, and "recovery time" set to 1800000 (30 mins). Generate Spell.dbc and replace it on server and client.
- insert into `item_template`: Using Keira editor, create a new Dalaran Hearthstone item ID 966559, tied to spell 966559 created before. Reuse a display ID of some other item with a different icon (using 48007)
- insert into `spell_script_names`, tying spell 966559 to spell script `dalaran_hearthstone` below
- Add a new module with the following loader
```
void AddSC_spell_dalaran_hs();
void Addmod_dalaran_hearthstoneScripts()
{
AddSC_spell_dalaran_hs();
}
```

- And the following spell script:

```
#include "SpellMgr.h"
#include "AreaDefines.h"
#include "Player.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "ObjectAccessor.h"
class spell_dalaran_hs : public SpellScriptLoader
{
public:
spell_dalaran_hs() : SpellScriptLoader("dalaran_hearthstone") { }
class spell_dalaran_hs_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dalaran_hs_SpellScript);
void HandleAfterCast()
{
if (Unit* caster = GetCaster())
{
Player* player = caster->ToPlayer();
player->TeleportTo(MAP_NORTHREND, 5851.55, 636.693, 647.513, player->GetOrientation());
}
}
void Register() override
{
AfterCast += SpellCastFn(spell_dalaran_hs_SpellScript::HandleAfterCast);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dalaran_hs_SpellScript();
}
};
void AddSC_spell_dalaran_hs()
{
new spell_dalaran_hs();
}
```

- Recompile, restart, delete Cache folder on the client, start game:
- `.additem 966559 1` works ok and can be used (icon didn't work though) but has the cooldown issues I mentioned above
rektbyfaith
07-03-2025, 01:59 PM #3

Archived author: hoodie • Posted: 2025-07-03T13:59:16.611000+00:00
Original source

Here are the steps of what I did:

- Using WoW Spell Editor, duplicate Hearthstone into a new spell ID 966559. "Category recovery time" set to 0, and "recovery time" set to 1800000 (30 mins). Generate Spell.dbc and replace it on server and client.
- insert into `item_template`: Using Keira editor, create a new Dalaran Hearthstone item ID 966559, tied to spell 966559 created before. Reuse a display ID of some other item with a different icon (using 48007)
- insert into `spell_script_names`, tying spell 966559 to spell script `dalaran_hearthstone` below
- Add a new module with the following loader
```
void AddSC_spell_dalaran_hs();
void Addmod_dalaran_hearthstoneScripts()
{
AddSC_spell_dalaran_hs();
}
```

- And the following spell script:

```
#include "SpellMgr.h"
#include "AreaDefines.h"
#include "Player.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "ObjectAccessor.h"
class spell_dalaran_hs : public SpellScriptLoader
{
public:
spell_dalaran_hs() : SpellScriptLoader("dalaran_hearthstone") { }
class spell_dalaran_hs_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dalaran_hs_SpellScript);
void HandleAfterCast()
{
if (Unit* caster = GetCaster())
{
Player* player = caster->ToPlayer();
player->TeleportTo(MAP_NORTHREND, 5851.55, 636.693, 647.513, player->GetOrientation());
}
}
void Register() override
{
AfterCast += SpellCastFn(spell_dalaran_hs_SpellScript::HandleAfterCast);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dalaran_hs_SpellScript();
}
};
void AddSC_spell_dalaran_hs()
{
new spell_dalaran_hs();
}
```

- Recompile, restart, delete Cache folder on the client, start game:
- `.additem 966559 1` works ok and can be used (icon didn't work though) but has the cooldown issues I mentioned above

rektbyfaith
Administrator
0
07-03-2025, 02:01 PM
#4
Archived author: robinsch • Posted: 2025-07-03T14:01:00.844000+00:00
Original source

Item spell cooldowns are limited to uint16
rektbyfaith
07-03-2025, 02:01 PM #4

Archived author: robinsch • Posted: 2025-07-03T14:01:00.844000+00:00
Original source

Item spell cooldowns are limited to uint16

rektbyfaith
Administrator
0
07-03-2025, 02:03 PM
#5
Archived author: Rymercyble • Posted: 2025-07-03T14:03:28.909000+00:00
Original source

dont items have cooldown too ?
rektbyfaith
07-03-2025, 02:03 PM #5

Archived author: Rymercyble • Posted: 2025-07-03T14:03:28.909000+00:00
Original source

dont items have cooldown too ?

rektbyfaith
Administrator
0
07-03-2025, 02:08 PM
#6
Archived author: hoodie • Posted: 2025-07-03T14:08:26.115000+00:00
Original source

There is a cooldown field for the item, but description says that it can be left blank and it would use the spell cooldown. I tried to set the cooldown there on the item too but same result
[Image: 2025-07-03-10-05-34.png?ex=690cabda&is=6...e627761b3&]
rektbyfaith
07-03-2025, 02:08 PM #6

Archived author: hoodie • Posted: 2025-07-03T14:08:26.115000+00:00
Original source

There is a cooldown field for the item, but description says that it can be left blank and it would use the spell cooldown. I tried to set the cooldown there on the item too but same result
[Image: 2025-07-03-10-05-34.png?ex=690cabda&is=6...e627761b3&]

rektbyfaith
Administrator
0
07-03-2025, 02:09 PM
#7
Archived author: robinsch • Posted: 2025-07-03T14:09:07.218000+00:00
Original source

just lower your spell ID below uint16
rektbyfaith
07-03-2025, 02:09 PM #7

Archived author: robinsch • Posted: 2025-07-03T14:09:07.218000+00:00
Original source

just lower your spell ID below uint16

rektbyfaith
Administrator
0
07-03-2025, 02:09 PM
#8
Archived author: hoodie • Posted: 2025-07-03T14:09:20.227000+00:00
Original source

Thanks! I will try that
rektbyfaith
07-03-2025, 02:09 PM #8

Archived author: hoodie • Posted: 2025-07-03T14:09:20.227000+00:00
Original source

Thanks! I will try that

rektbyfaith
Administrator
0
07-03-2025, 03:03 PM
#9
Archived author: hoodie • Posted: 2025-07-03T15:03:52.224000+00:00
Original source

It worked! You guys are incredible.

I'll try to figure out why the icon isn't working
[Image: 2025-07-03-11-00-44.png?ex=690c1018&is=6...876210f52&]
rektbyfaith
07-03-2025, 03:03 PM #9

Archived author: hoodie • Posted: 2025-07-03T15:03:52.224000+00:00
Original source

It worked! You guys are incredible.

I'll try to figure out why the icon isn't working
[Image: 2025-07-03-11-00-44.png?ex=690c1018&is=6...876210f52&]

rektbyfaith
Administrator
0
07-03-2025, 03:58 PM
#10
Archived author: Jyria • Posted: 2025-07-03T15:58:38.490000+00:00
Original source

Item.dbc for the client
rektbyfaith
07-03-2025, 03:58 PM #10

Archived author: Jyria • Posted: 2025-07-03T15:58:38.490000+00:00
Original source

Item.dbc for the client

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