Likes: 0
Results 1 to 10 of 16
-
18-09-09, 09:48 AM #1
[Lua] How to make an NPC unattackable in Lua
Register to remove this adMaking an NPC unattackable in Lua.
This tutorial requires the ArcEmu rev: 2700+
Making an NPC unattackable is the perfect thing for your cutscenes for your boss. You don't want your boss in the middle of a cut-scene to be killed by an inpatient Warlock shadow bolting it, do you? Well, there is only one way at this time of writing to do this.Code:function NegEtheriumBossOnOnePercent(Unit, Event) if Etherium:GetHealthPct() == 1 then Etherium:RemoveEvents() Etherium:SetUInt32Value(58, 2) -- Set the NPC to be unattackable, Etherium:RemoveAllAuras() Etherium:SetCombatCapable(1) print("Etherium has been defeated. Spawning cache...") Etherium:RegisterEvent("NegEtheriumCINESix", 1, 1) Etherium:RegisterEvent("NegEtheriumCINESeven", 5000, 1) Etherium:RegisterEvent("NegEtheriumCINEEight", 15000, 1) Etherium:RegisterEvent("NegEtheriumCINENine", 22000, 1) Etherium:RegisterEvent("NegEtheriumCINETen", 27000, 1) Etherium:RegisterEvent("NegEtheriumCINEEleven", 29000, 1) Etherium:RegisterEvent("NegEtheriumKill", 30000, 1) --[[ Spawn Cache Event here.. ]]-- else end end
Code:Etherium:SetUInt32Value(58, 2) -- Set the NPC to be unattackable, Etherium:RemoveAllAuras() Etherium:SetCombatCapable(1)
Code:Unit:SetUInt32Value(58, 2)
Code:Unit:SetUInt32Value(58, 26)
To make him attackable again, you use this code:
Code:Unit:SetUInt32Value(58, 0)
So, to recap. SetUInt32Value(58, 2) will set the NPC as unattackable, SetUInt32Value(52, 0) will set the NPC as attackable.
Furthermore, here are all of the Unit flags (That are known as of r2850)
Code:2 -- Client won't let you attack the mob 4 -- Makes players & NPCs attackable/unattackable 256 -- Changes attackable status 13 -- Sets PVP Flag 14 -- Silenced 15 -- Dead 17 -- Alive 18 -- Pacified 19 -- Stunned 20 -- Sets Combat Flag 21 -- Sets the same flag as mounted on a taxi (Can't cast spells) 22 -- Disarmed 23 -- Confused 24 -- Fleeing/Fear 25 -- Makes players & NPCs attackable/unattackable 26 -- Unselectable 27 -- Skinnable 30 -- Feign Death
Hope this helps you,
lbniese
› See More: [Lua] How to make an NPC unattackable in Lua
-
21-09-09, 05:54 AM #2
Nice guide.
me if I have helped you in anyway ^^ Example: Sharing a repack, answering questions... Well you know the rest xD. As long as I help you!
-
21-09-09, 09:50 AM #3
-
21-09-09, 04:01 PM #4
all this lua go over to C++ so the emulation development can continue
-
22-09-09, 12:05 AM #5
-
22-09-09, 06:47 AM #6
LUA is like kiddy language in coding. Grow up! Learn the MAN/WOMAN language aka C++!!!
me if I have helped you in anyway ^^ Example: Sharing a repack, answering questions... Well you know the rest xD. As long as I help you!
-
23-09-09, 08:23 AM #7
-
24-09-09, 07:14 AM #8
Then you're a kid!
me if I have helped you in anyway ^^ Example: Sharing a repack, answering questions... Well you know the rest xD. As long as I help you!
-
24-09-09, 07:40 AM #9
Enegue, you cant speak. You dont know C++ properly either.
-
25-09-09, 04:09 AM #10
Register to remove this adI'm learning it! And I do know from other developers that LUA is kid language. Developers like... K.
me if I have helped you in anyway ^^ Example: Sharing a repack, answering questions... Well you know the rest xD. As long as I help you!