This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [QUESTION] Morphing item  (Read 2858 times)

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
[QUESTION] Morphing item
« on: July 02, 2015, 02:04:44 pm »
Hey everyone!
Any good tutorial on making an item that morphs when worn? No spell-morphs, please, I need to use displayids.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

Alastor

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1105
    • View Profile
Re: [QUESTION] Morphing item
« Reply #1 on: July 02, 2015, 05:11:38 pm »
ITEM >> SPELL ( with morph )

Done .. look at noggers elixir
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
No matter how fast light travels it finds the darkness has always got there first and is waiting for it
Star Citizen Referral Code : STAR-XNFS-HVL9

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] Morphing item
« Reply #2 on: July 02, 2015, 06:53:17 pm »
I hope you are just trolling
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

bizzlesnaff

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 124
    • View Profile
Re: [QUESTION] Morphing item
« Reply #3 on: July 02, 2015, 07:39:45 pm »
Quote from: "Смердокрыл"
I hope you are just trolling

Why? Thats a good idea. Can't be so difficult to copy the code and just edit the display id..

edit:
ah...see just now what you mean....

edit2:
maybe you could try to look into the databse if item XYZ has durability >0 and if not, the owner get any effect..?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] Morphing item
« Reply #4 on: July 02, 2015, 08:56:37 pm »
I was gonna use trinkets, so cant use durability, can I?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

bizzlesnaff

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 124
    • View Profile
Re: [QUESTION] Morphing item
« Reply #5 on: July 02, 2015, 09:08:09 pm »
No that's not possible. But i thought u try to morph the player when the item is worn...maybe it is an translation mistake by me...worn means damaged so in wow the item is shown "red". trinkets, rings, back, neck etc. can never lose durability.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Rochet2

  • Contributors
  • Polygonshifter
  • *****
  • Posts: 59
    • View Profile
    • http://rochet2.github.io/
Re: [QUESTION] Morphing item
« Reply #6 on: July 02, 2015, 10:18:53 pm »
You either need to use a spell or a script.

Spell would nicely take use of the aura system incase the player has multiple morphs. Lets say he has your trinket and noggenfogger, the spell system would probably be able to restore the other when the other wears out and maybe take into account other things.

If you apply the morph on equip (or on spell cast) and then the player morphs to something else (noggenfogger) it might be a hassle to try to restore the morph from the trinket after that without checking all the time for the correct displayid.

What core do you use for the server?

Mangos based cores (mangos, cmangos, trinitycore.. ) do not have an "on equip" hook in their C++ scripting API. Unsure about arcemu ?_?
This means that you would need to modify the core to add such a hook.
A workaround for this could be .. yet again .. using a spell.
By using a spell on use for the item you can script the spell to do what you want in C++.
You can use the same spell for all items you create since you can script it to do different things according to the item entry or other data.

Did I mention a spell yet? :3

Quote from: "bizzlesnaff"
No that's not possible. But i thought u try to morph the player when the item is worn...maybe it is an translation mistake by me...worn means damaged so in wow the item is shown "red". trinkets, rings, back, neck etc. can never lose durability.
by worn he probably meant that he wanted the morph to be visible when the item is equipped/weared.
« Last Edit: July 02, 2015, 10:32:32 pm by Admin »

Daweo

  • Registred Member
  • Race Changer
  • *****
  • Posts: 39
    • View Profile
Re: [QUESTION] Morphing item
« Reply #7 on: July 02, 2015, 10:21:12 pm »
Quote from: "Смердокрыл"
Hey everyone!
Any good tutorial on making an item that morphs when worn? No spell-morphs, please, I need to use displayids.

You can make hook in core to catch this event. For example in TrinityCore in file Player.cpp, It is tested.

Code: [Select]
void Player::DurabilityPointsLoss(Item* item, int32 points)
.
.
.
if (pNewDurability == 0 && pOldDurability > 0 && item->IsEquipped())
{
_ApplyItemMods(item, item->GetSlot(), false);

// Morph on durability loss
SetDisplayId(999);
ChatHandler(GetSession()).PSendSysMessage("It's broken and You are morphed!");
}
.
.
.
item->SetUInt32Value(ITEM_FIELD_DURABILITY, pNewDurability);

I hope I helped You...
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] Morphing item
« Reply #8 on: July 03, 2015, 12:26:38 am »
Rochet2 and Daweo's replies look promising, other than I have no experience in C++ at all, so I dont really get what demonic rituals do I have to perform with this ancient scripts...
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

Daweo

  • Registred Member
  • Race Changer
  • *****
  • Posts: 39
    • View Profile
Re: [QUESTION] Morphing item
« Reply #9 on: July 03, 2015, 12:29:37 am »
Quote from: "Смердокрыл"
Rochet2 and Daweo's replies look promising, other than I have no experience in C++ at all, so I dont really get what demonic rituals do I have to perform with this ancient scripts...

So, what you really wanted? Morph on item equip or on durability loss? :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] Morphing item
« Reply #10 on: July 03, 2015, 12:33:52 am »
Morph on item equip, but with the ability to morph using ANY displayid, and not only those that are attached to a certain spell/aura
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

Daweo

  • Registred Member
  • Race Changer
  • *****
  • Posts: 39
    • View Profile
Re: [QUESTION] Morphing item
« Reply #11 on: July 03, 2015, 12:44:44 am »
Off top of my head there are a few options.

A) Hook in Core... C++
- You would have to find in core, where the item equip is handled and there add your own code
- But, this option will definitely work...

B) Make SpellScript to any spell and that spell will be set on item equip.. C++
- So if you equip an item, the spell will be executed and then our spellscript too. And in code of spellscript wil be implementation of your Morphs.

C) DBC Edits of spells
- It may not seem, but if you dont know C++, it is the most easy method for you, but the custom patch is then needed...
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] Morphing item
« Reply #12 on: July 03, 2015, 12:46:34 am »
Quote from: "Daweo"
C) DBC Edits of spells
This seems to be the best option for a noob like myself. But can I create a custom spell, not to destroy any existing ones?

P.S. I have  4.3.4 trinity
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

Daweo

  • Registred Member
  • Race Changer
  • *****
  • Posts: 39
    • View Profile
Re: [QUESTION] Morphing item
« Reply #13 on: July 03, 2015, 12:51:24 am »
Ou... I dont have any experience with DBC above 3.3.5a...
But maybe i can write a simple code...

The solution would be:
SQL table item_morph with two columns: item_id and model_id
C++ Script to handle whoch model_id should be used
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] Morphing item
« Reply #14 on: July 03, 2015, 12:59:47 am »
Ok, you can congratulae me, because I managed to create a table!
[attachment=0:1v80o1pg]table.jpg[/attachment:1v80o1pg]
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.