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: [Another Question] - Unselectable NPC?  (Read 1187 times)

Krang Stonehoof

  • Contributors
  • Wiki Incarnate
  • *****
  • Posts: 164
    • View Profile
[Another Question] - Unselectable NPC?
« 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [Another Question] - Unselectable NPC?
« Reply #1 on: August 25, 2014, 10:20:15 pm »
It's a UNIT_FIELD_FLAG.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Krang Stonehoof

  • Contributors
  • Wiki Incarnate
  • *****
  • Posts: 164
    • View Profile
Re: [Another Question] - Unselectable NPC?
« Reply #2 on: August 25, 2014, 10:24:26 pm »
Where are these flags handled?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [Another Question] - Unselectable NPC?
« Reply #3 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
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Nibnob

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 13
    • View Profile
Re: [Another Question] - Unselectable NPC?
« Reply #4 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [Another Question] - Unselectable NPC?
« Reply #5 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Nibnob

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 13
    • View Profile
Re: [Another Question] - Unselectable NPC?
« Reply #6 on: August 26, 2014, 08:37:27 pm »
Thank you.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »