Peacy Posted March 4, 2016 Share Posted March 4, 2016 Hey Guys, I have this NPC that is unattackable because I get it's unit_flags in the trinity database to 2. I want this npc to stay unattackable untill players trigger a certain event. Upon this event being triggered I want him to become attackable and I'm not sure how to do this. I'm using npc_bal:SetInt32Value(UNIT_FLAG_ATTACKABLE) at the moment but it's not working! Any other ideas? Thanks, Peacy! Link to comment Share on other sites More sharing options...
Grindi Posted March 4, 2016 Share Posted March 4, 2016 You should use UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_IMMUNE_TO_PC, UNIT_FLAG_IMMUNE_TO_NPC. You can read more about this flags here - https://trinitycore.atlassian.net/wiki/display/tc/creature_template Link to comment Share on other sites More sharing options...
Amaroth Posted March 4, 2016 Share Posted March 4, 2016 A way around would be using friendly reputation, which would be changed into hostile reputation when some event occurs. Such script could be easily done even in SmartAI. English YT tutorial channel. Check it out if you preffer videos over walls of text.:https://www.youtube.com/AmarothEng I am now completely retired from modding. I am still reading PMs and reacting to them, however, I am not keeping up to date with what is going on in the community and my ability to help you is becoming very limited - I no longer remember some things, I don't have tools installed anymore, and I don't know what is up to date nowadays. Link to comment Share on other sites More sharing options...
Peacy Posted March 4, 2016 Author Share Posted March 4, 2016 1 hour ago, Grindi said: You should use UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_IMMUNE_TO_PC, UNIT_FLAG_IMMUNE_TO_NPC. You can read more about this flags here - https://trinitycore.atlassian.net/wiki/display/tc/creature_template Would UNIT_FLAG_NOT_ATTACKABLE_1 make the npc attackable? Link to comment Share on other sites More sharing options...
Peacy Posted March 5, 2016 Author Share Posted March 5, 2016 Anyone Know how to solve this issue? Link to comment Share on other sites More sharing options...
Kaev Posted March 5, 2016 Share Posted March 5, 2016 Set it with npc->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); and remove it with npc->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Link to comment Share on other sites More sharing options...
Flag Question
By Peacyin Serverside
Recommended Posts