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!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Daweo

Pages: [1] 2 3
1
It's quite easy for Trinity. Use Player::Update() function.

Code: [Select]
void Player::Update(uint32 p_time)
{
.
.
.
    // Played time
    if (now > m_Last_tick)
    {
        uint32 elapsed = uint32(now - m_Last_tick);
        m_Played_time[PLAYED_TIME_TOTAL] += elapsed;        // Total played time
        m_Played_time[PLAYED_TIME_LEVEL] += elapsed;        // Level played time
        m_Last_tick = now;
       
        // Your hour system
        if (GetTotalPlayedTime() % 3600 == 0)
        {
                ChatHandler(GetSession()).PSendSysMessage("You played an hour!");
                ModifyMoney(10000); // One gold coin is added
        }
        // END
    }
.
.
.

2
Quote from: "bizzlesnaff"
Yeah I'm little bit confused ;) I try to check if a database entry is 0 or smaller, but I didn't get it..:(

Code: [Select]
QueryResult result = CharacterDatabase.PQuery("SELECT x FROM y WHERE z='%u'", player->GetName());

if (result <= 0)
{
well...something happen here ;)
}

Yeah..something like that..but it didn't work..:(

At first for string you have to use %s and into this PQuery function you have to use char* or const char*.

Code: [Select]
QueryResult result = CharacterDatabase.PQuery("SELECT x FROM y WHERE z='%s'", player->GetName().c_str());

And to count maybe you should use Count function:

Code: [Select]
SELECT COUNT(column_name) FROM table_name;

EDIT:
I think it should be like this...
Code: [Select]
QueryResult result = CharacterDatabase.PQuery("SELECT COUNT(x) FROM y WHERE z='%s'", player->GetName().c_str());

if (result)
{
Field* fields = result->Fetch();
uint32 count = fields[0].GetUInt32();
// Your code...
}

3
Hi all,

Maybe stupid question, but is there way to relocate object and player see the change immediately? Because when I use .gobject move, object is reload (flashes), but it stay on its place until player relog...

I tried DestroyForNearbyPlayers and UpdateObjectVisibility, but result was same .

Daweo

(TrinityCore 335a)

4
I tried to rotate that model in Blender. But model wasnt valid...

I did it like this:
Extract model and skin (WMV) -> Convert model from m2 to m2i (M2Mod3) -> Import to Blender (M2ModRedux) -> And there my experience ends because of model is not shown in blender after import or model is not valid after rotation in blender... :/

5
Modelling and Animation / [QUESTION] M2 rotation "out-game" (Wotlk)
« on: July 06, 2015, 06:08:47 pm »
Hi, everybody.

I am not good at model editing, so I need help from you, Masters of WoW modelling...  :|

My problem is, that I have simple M2 model which I want to spawn ingame, but model as is, is badly rotated. It lies horizontaly and I need it verticaly located...

So, is there easy way to rotate model in m2 file? I need it rotate 90 degrees...


Daweo

6
Serverside Modding / Re: [QUESTION] Morphing item
« on: July 03, 2015, 01:49:53 am »
For TrinityCore 3.3.5a the solution could be:

SQL table in world database:
Code: [Select]
CREATE TABLE IF NOT EXISTS `item_morph` (
`item_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
`morph_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`item_id`)
)
COMMENT='Item Morph system'
COLLATE='utf8_general_ci'
ENGINE=MyISAM;


C++ code in Player.cpp:
Code: [Select]
Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
{
.
.
.
ApplyEquipCooldown(pItem2);

// Item Morph
QueryResult result = WorldDatabase.PQuery("SELECT model_id FROM item_morph WHERE item_id = %u", pItem2->GetEntry());

if (result)
{
Field* fields = result->Fetch();
uint32 model_id = fields[0].GetUInt32();

if (sCreatureDisplayInfoStore.LookupEntry(sObjectMgr->GetCreatureDisplay(model_id)))
SetDisplayId(model_id);
}
// END

return pItem2;
    }
.
.
.
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);

// Item Morph
QueryResult result = WorldDatabase.PQuery("SELECT model_id FROM item_morph WHERE item_id = %u", pItem->GetEntry());

if (result)
{
Field* fields = result->Fetch();
uint32 model_id = fields[0].GetUInt32();

if (sCreatureDisplayInfoStore.LookupEntry(sObjectMgr->GetCreatureDisplay(model_id)))
SetDisplayId(model_id);
}
// END

return pItem;
}
.
.
.
void Player::QuickEquipItem(uint16 pos, Item* pItem)
{
.
.
.
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);

// Item Morph
QueryResult result = WorldDatabase.PQuery("SELECT model_id FROM item_morph WHERE item_id = %u", pItem->GetEntry());

if (result)
{
Field* fields = result->Fetch();
uint32 model_id = fields[0].GetUInt32();

if (sCreatureDisplayInfoStore.LookupEntry(sObjectMgr->GetCreatureDisplay(model_id)))
SetDisplayId(model_id);
}
// END


Did not test, but should work... However this only morph player on equip and doesnt demorph on unequip...

7
Serverside Modding / Re: [QUESTION] Morphing item
« 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

8
Serverside Modding / Re: [QUESTION] Morphing item
« 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...

9
Serverside Modding / Re: [QUESTION] Morphing item
« 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? :)

10
Miscellaneous / Re: Extracting interface files?
« on: July 02, 2015, 11:17:15 pm »
Quote from: "Craigiea"
Hey everyone ive been trying to access my LUA files and ive heard i do this by extracting my interface via the console. I have the console working but its not accepting Extract as a command.


Anyone help me do what i need.

Many thanks =)

Dont know about console, but you can use the Wow Model Viever to extract the specific LUA files...

11
Serverside Modding / Re: [QUESTION] Morphing item
« 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...

12
Level Design / Re: How to minimize a Custom Patch
« on: July 19, 2014, 02:13:15 pm »
Hi, Maybe You dont compact your archive...
When you delete or replace some file, it isnt deleted until you compact your archive.

13
But,
this file only handles additional Mana bar. Not the power (previously Mana) bar, which is replaced with new power (Energy).



I tried to find something in FrameXML/PlayerFrame.lua but I am not good at Lua so much...

14
Thank You very much... :)

15
Miscellaneous / [QUESTION] TC: GUI show bad value of Power - Energy
« on: July 10, 2014, 08:10:37 pm »
Hi, Modcraft.

I have problem with changing my player power regeneration. I set the energy as main power and disable regeneration in config and core then too. Energy doesnt regenerate, but ingame the GUI still show regeneration.
For example I have only 10 energy, but GUI show regen up to maximum of 100. When You want to cast spell uses energy it will show you error text. I think, that this is coded somewhere in LUA, but I cant find it.
Is there somebody who has an experience with, please?

Pages: [1] 2 3