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: [Tutorial][TC2Core] - Scale system + Morph system  (Read 10552 times)

glararan

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 162
    • View Profile
    • http://glararan.eu
[Tutorial][TC2Core] - Scale system + Morph system
« on: October 31, 2011, 05:18:26 pm »
Hi, it's too many long how i code it for my RP project, but i want to give you too this code.

So.
1)Open Player.cpp
2)Find - InitDisplayIds();
3)Replace it with:
[spoiler:xb4yxe79]// Morph system
   QueryResult result2 = CharacterDatabase.PQuery("SELECT morph FROM character_morph WHERE guid = %u", fields[0].GetUInt32());
   if(result2)
   {
      Field *fields2 = result2->Fetch();
      SetNativeDisplayId(fields2[0].GetUInt32());
      SetDisplayId(fields2[0].GetUInt32());
   }
   else
      InitDisplayIds();

   // Scale system
   QueryResult result3 = CharacterDatabase.PQuery("SELECT scale FROM character_scale WHERE guid = %u", fields[0].GetFloat());
   if(result3)
   {
      Field* fields3;
      fields3 = result3->Fetch();
      float Scale;
      Scale = fields3[0].GetFloat();
      SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
   }
   else
   {
      CharacterDatabase.PExecute("INSERT INTO character_scale VALUES (%u, 1, [CORE] - Basic Scale)", GetGUID());[/spoiler:xb4yxe79]

4)Save
5)Open CharacterDatabase
6)Insert:
[spoiler:xb4yxe79]SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for character_morph
-- ----------------------------
CREATE TABLE `character_morph` (
  `guid` int(11) NOT NULL DEFAULT '0',
  `morph` int(11) DEFAULT NULL,
  PRIMARY KEY (`guid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- ----------------------------
-- Table structure for character_scale
-- ----------------------------
CREATE TABLE `character_scale` (
  `guid` int(11) NOT NULL,
  `scale` float NOT NULL,
  `comment` text,
  PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;[/spoiler:xb4yxe79]

7)Compile
8)ENJOY!

How to add scale or morph?
1)Open table of scale or morph
2)Add guid of character
3)Add scale or morph(DisplayID)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Zim4ik

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 407
    • View Profile
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #1 on: October 31, 2011, 05:49:01 pm »
Does morph works after relogin?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

glararan

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 162
    • View Profile
    • http://glararan.eu
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #2 on: October 31, 2011, 08:17:26 pm »
Of Course...its perma morph....if you login you have morph or scale, if you delete morph you have normal morph of your char.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Zim4ik

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 407
    • View Profile
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #3 on: November 02, 2011, 07:32:41 pm »
WoW!!!
You really help me)
Thank You)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Mr.Patcher

  • Registred Member
  • Race Changer
  • *****
  • Posts: 39
    • View Profile
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #4 on: January 21, 2012, 06:04:08 pm »
Very ty ^^
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Blackplayer27

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 52
    • View Profile
    • http://home.pf-control.de/
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #5 on: February 11, 2012, 12:00:44 am »
In Player.cpp there are many "InitDisplayIds ();"...i dont found can include it in the Core >.<
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

glararan

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 162
    • View Profile
    • http://glararan.eu
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #6 on: February 12, 2012, 06:34:24 pm »
In func LoadFromDB
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Blackplayer27

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 52
    • View Profile
    • http://home.pf-control.de/
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #7 on: February 21, 2012, 12:20:17 pm »
now i have try to include the code so:
Code: [Select]
void Player::InitDisplayIds()
{
//Start Custom Script
// Morph system
QueryResult result2 = CharacterDatabase.PQuery("SELECT morph FROM character_morph WHERE guid = %u", fields[0].GetUInt32());
if(result2)
{
Field *fields2 = result2->Fetch();
SetNativeDisplayId(fields2[0].GetUInt32());
SetDisplayId(fields2[0].GetUInt32());
}
else
InitDisplayIds();

// Scale system
QueryResult result3 = CharacterDatabase.PQuery("SELECT scale FROM character_scale WHERE guid = %u", fields[0].GetFloat());
if(result3)
{
Field* fields3;
fields3 = result3->Fetch();
float Scale;
Scale = fields3[0].GetFloat();
SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
}
else
{
CharacterDatabase.PExecute("INSERT INTO character_scale VALUES (%u, 1, [CORE] - Basic Scale)", GetGUID());
}
//End Custom Script
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
    sLog->outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow());
    return;
}

uint8 gender = getGender();
switch (gender)
{
    case GENDER_FEMALE:
        SetDisplayId(info->displayId_f);
        SetNativeDisplayId(info->displayId_f);
        break;
    case GENDER_MALE:
        SetDisplayId(info->displayId_m);
        SetNativeDisplayId(info->displayId_m);
        break;
    default:
        sLog->outError("Invalid gender %u for player", gender);
        return;
}
}

but it not work.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Zim4ik

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 407
    • View Profile
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #8 on: February 26, 2012, 07:35:48 am »
glad, you forget
}
after
Quote
CharacterDatabase.PExecute("INSERT INTO character_scale VALUES (%u, 1, [CORE] - Basic Scale)", GetGUID());
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

glararan

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 162
    • View Profile
    • http://glararan.eu
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #9 on: February 26, 2012, 11:26:35 am »
or remove after else "{"
BTW! I forget post replace it in LoadFromDB feature!!
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Ascathos

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 1129
    • View Profile
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #10 on: June 09, 2012, 05:03:15 pm »
I've been testing and trying around, however, this is not working - for some reason, it doesn't load the scale system up. Model System works properly and has no issues, but auto scale doesn't load up. Might be because of the age - any idea ?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Blackplayer27

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 52
    • View Profile
    • http://home.pf-control.de/
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #11 on: August 06, 2012, 11:59:32 pm »
put the script in the    CharachterHandler.cpp

Script: http://pastebin.de/28600
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Domminust

  • Registred Member
  • Loreweaver
  • *****
  • Posts: 100
    • View Profile
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #12 on: February 08, 2015, 07:17:16 pm »
Hi does this still work? I have the newest trinity 3.3.5 I have never touched this kind of scripting before... I don't understand this step:

5)Open CharacterDatabase



What/where is the CharacterDatabase where I put the second script in? ty :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Makpptfox

  • Contributors
  • Loreweaver
  • *****
  • Posts: 103
    • View Profile
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #13 on: February 09, 2015, 10:53:50 am »
For the morph one, it's OK for me. On TC2.

The "Characters" Database is one of the 3 original databases by TC2.

(Auth, Characters and World.)

Just open Characters and create an SQL request with the good content.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
For support, send your Discord's ID by PM.

Kaev

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 308
    • View Profile
Re: [Tutorial][TC2Core] - Scale system + Morph system
« Reply #14 on: March 14, 2015, 08:36:23 am »
To make the scale work, you need to insert the Scale stuff at the bottom of the LoadFromDB function (right above "return true;"). I didn't search where, but somewhere between InitDisplayId and the end of the function the scale is changed to 1.

Tested and working with newest TrinityCore. Thanks! :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »