Jump to content

[Question][unit->canFly() ]


Recommended Posts

Posted
void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
{
   // Check if caster is player and if this player can fly
   if(m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->CanFly)
   {
       // Your effect
   }
// Recheck immune (only for delayed spells)
if( m_spellInfo->speed && (
.
.
.
.
}

Posted
void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
{
   // Check if caster is player and if this player can fly
   if(m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->CanFly)
   {
       // Your effect
   }
// Recheck immune (only for delayed spells)
if( m_spellInfo->speed && (
.
.
.
.
}

Thx

But This Error !

Spell.cpp(956) : error C3867: 'Player::CanFly': function call missing argument list; use '&Player::CanFly' to create a pointer to member

Posted
((Player*)m_caster)->CanFly

should be so:

((Player*)m_caster)->CanFly()

hmm Thx

Excuse Me :

I Need Test Target Can Fly Or Not And My Target is NPC

My Target isn`t Player

This Cod Not Useful For Me :(

Posted

make sure this is before that code

    if(!unit || !effectMask)
       return;

also it could be trying to cast a player to creature so try

if(unit->GetTypeId != TYPEID_PLAYER && ((Creature*)unit)->canFly())

Posted

also it could be trying to cast a player to creature so try

if(unit->GetTypeId != TYPEID_PLAYER && ((Creature*)unit)->canFly())

Creature* creature = ((Creature*)unit);

if(creature && creature->canFly())
{
}

Thx All :)

These Cods Work Without Crash But Always Return False !

I Think Mangos Can`t Support CanFly() For Creature !

Example :

Return False For This NPC

http://www.wowhead.com/?npc=19514

Please Developers Answer CanFly() Support For Creature Or Not :(

Posted
 bool canFly()  const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; }

 INHABIT_AIR    = 4,

You must update in the db columm InhabitType to 4.

hmmm

Thx

Solve My Problem :)

I Use This Query :

 
UPDATE `creature_template` SET `inhabittype` = '4' WHERE `entry` = '19514' ;

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use