• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] NPC revive via code?

Status
Not open for further replies.

ackzell

Member
The NPC has to revive itself either by using a spell or as I explained above, due to this being a feature in the game but bugged in the core I am using.
 

Tommy

Founder
EROoyFp.png


Is reading getting harder these days? Moved thread to the CORRECT section. TrinityCore -> C++ is a release section. This is a SUPPORT thread. Read section description. Actually. Read.


Why don't you just respawn the npc when it dies in the "JustDied" hook via ScriptedAI?..
 

ackzell

Member
Solved it myself, excuse me for being lazy and not reading correctly.

The fix was pretty easy for anyone wondering, turns out the mob only had dead UNIT flags and I had to reset them using,

me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetHealth(1000);

Thanks anyways.
 

Tommy

Founder
Solved it myself, excuse me for being lazy and not reading correctly.

The fix was pretty easy for anyone wondering, turns out the mob only had dead UNIT flags and I had to reset them using,

me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetHealth(1000);

Thanks anyways.

Not really sure if that's the best way to handle it. My way seemed more logical. Is the health of the npc 1,000? If not, "me->SetHealth(me->GetMaxHealth);" is what you should do.

Marking as solved since you "solved it".
 
Status
Not open for further replies.
Top