Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Serverside Modding => Topic started by: Krang Stonehoof on August 25, 2014, 10:08:46 pm

Title: [Another Question] - Unselectable NPC?
Post by: Krang Stonehoof on August 25, 2014, 10:08:46 pm
Greetings,

I have a question,
As you all probably saw on the retail, there are so many creatures that cannot be selected but yet you can get your mouse over them and see their names, and also interact with right-click. Can I get that working on 3.3.5? If yes, how?

Thanks.
Title: Re: [Another Question] - Unselectable NPC?
Post by: stoneharry on August 25, 2014, 10:20:15 pm
It's a UNIT_FIELD_FLAG.
Title: Re: [Another Question] - Unselectable NPC?
Post by: Krang Stonehoof on August 25, 2014, 10:24:26 pm
Where are these flags handled?
Title: Re: [Another Question] - Unselectable NPC?
Post by: stoneharry on August 25, 2014, 10:37:00 pm
Quote from: "Krang Stonehoof"
Where are these flags handled?

It's an attribute within the creature object.

Attributes of interest:

Bytes0 - I don't know
Bytes1 - Sitting, standing, 'dead', lying down, etc
Bytes2 - Weapon sheathe - main weapon out, second weapon out, both out, ranged out, etc
Bytes3 - Run state, swimming, flying, etc...
UInt32 Value - Many different flags such as unselectable, unattackable, player, etc.
UInt64 Value - I don't know, GUID?

In the server-side Lua API I can call this code:

Code: [Select]
obj:SetUInt32Value(0x0006 + 0x0003, 0x1) -- untargetable
That's using the true exact values though, which is hacky. In C++ You should use the enum provided. So in pseudocode:

Code: [Select]
pUnit->SetUInt32Value(UNIT_FIELD_FLAG_UNSELECTABLE, 1);
These values are also stored in the database for persistent creatures: http://collab.kpsn.org/display/tc/creature (http://collab.kpsn.org/display/tc/creature" onclick="window.open(this.href);return false;)
Title: Re: [Another Question] - Unselectable NPC?
Post by: Nibnob on August 26, 2014, 03:22:25 am
A bit off topic but is it possible to make an unselectable Player? or unattackable? I mean with this flag.
Title: Re: [Another Question] - Unselectable NPC?
Post by: stoneharry on August 26, 2014, 09:35:30 am
Quote from: "Nibnob"
A bit off topic but is it possible to make an unselectable Player? or unattackable? I mean with this flag.

The same flags can be applied but may have odd results.
Title: Re: [Another Question] - Unselectable NPC?
Post by: Nibnob on August 26, 2014, 08:37:27 pm
Thank you.