Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Contributor
    Lbniese's Avatar
    Join Date
    Aug 2009
    Location
    C# Developer
    Posts
    381
    Post Thanks / Like
    Rep Power
    16
    Reputation
    91

    [Lua] How to make an NPC unattackable in Lua


    Register to remove this ad
    Making 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
    This is an excerpt from my own, unfinished, script. The bit we are interested in is this bit:
    Code:
    Etherium:SetUInt32Value(58, 2) -- Set the NPC to be unattackable,
            Etherium:RemoveAllAuras()
            Etherium:SetCombatCapable(1)
    What this code does is that it sets the NPC to be unattackable (but still displays it as hostile), removes all debuffs/buffs from him, and then makes him unable to attack.
    Code:
    Unit:SetUInt32Value(58, 2)
    This bit sets the NPC as unattackable. If you click him, he is displayed as hostile, but you won't see the sword when you mouse-over. You won't be able to attack him, at all.
    Code:
    Unit:SetUInt32Value(58, 26)
    The above code will make the NPC unselectable from the client.

    To make him attackable again, you use this code:
    Code:
    Unit:SetUInt32Value(58, 0)
    Quite simple eh? It's certainly not the most ideal solution, but it is the only way to do this in Lua as of this writing.

    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
    NOTE THAT THE UNIT FLAGS CHANGE EVERY CLIENT UPDATE.
    Hope this helps you,

    lbniese




    › See More: [Lua] How to make an NPC unattackable in Lua



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Contributor
    enegue's Avatar
    Join Date
    Aug 2008
    Location
    Before God
    Posts
    715
    Post Thanks / Like
    Rep Power
    17
    Reputation
    106
    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!

  4. #3
    Contributor
    Lbniese's Avatar
    Join Date
    Aug 2009
    Location
    C# Developer
    Posts
    381
    Post Thanks / Like
    Rep Power
    16
    Reputation
    91
    thanks

  5. #4
    Contributor
    LiLLeCarl's Avatar
    Join Date
    Jan 2009
    Posts
    106
    Post Thanks / Like
    Rep Power
    17
    Reputation
    84
    all this lua go over to C++ so the emulation development can continue

  6. #5
    Contributor
    Lbniese's Avatar
    Join Date
    Aug 2009
    Location
    C# Developer
    Posts
    381
    Post Thanks / Like
    Rep Power
    16
    Reputation
    91
    Nope, i like lua... not c++ :P

  7. #6
    Contributor
    enegue's Avatar
    Join Date
    Aug 2008
    Location
    Before God
    Posts
    715
    Post Thanks / Like
    Rep Power
    17
    Reputation
    106
    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!

  8. #7
    Contributor
    Lbniese's Avatar
    Join Date
    Aug 2009
    Location
    C# Developer
    Posts
    381
    Post Thanks / Like
    Rep Power
    16
    Reputation
    91
    Quote Originally Posted by enegue View Post
    LUA is like kiddy language in coding. Grow up! Learn the MAN/WOMAN language aka C++!!!
    No way, i like LUA and i stay on lua .....

  9. #8
    Contributor
    enegue's Avatar
    Join Date
    Aug 2008
    Location
    Before God
    Posts
    715
    Post Thanks / Like
    Rep Power
    17
    Reputation
    106
    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!

  10. #9
    Banned

    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    652
    Post Thanks / Like
    Rep Power
    0
    Reputation
    103
    Enegue, you cant speak. You dont know C++ properly either.

  11. #10
    Contributor
    enegue's Avatar
    Join Date
    Aug 2008
    Location
    Before God
    Posts
    715
    Post Thanks / Like
    Rep Power
    17
    Reputation
    106

    Register to remove this ad
    I'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!

 

 
Page 1 of 2 12 LastLast

Visitors found this page by searching for:

wow Make unit unattackable

wow arcemu hostile unattackable npc

wow unattackable mobs made attackable

arcemu how to make an npc unselectable

Unattackable WoW

Lua Make npc

ascent lua set npc level

wow lua hostile npc

trinity unattackable

make an npc skinnable arcemu

lua wow spawn npc

unattackable trinity

wow npc attackable

how to make a npc unattackable arcemu

warcraft npc kids unattacakble

wow lua how to let a npc interrupt

make npc unselectable wow skyfire

wo lua how to select npc

wow arcemu npc not able to hit

mangos make npc unattackable

unselectable npc arcemu

world of warcraft lua script make npc not attack

arcemu skinnable

00webhost login

arcemu make npc attackable

wow arcemu npcs arre unattackable

npc unselectable

lua unattackable mobs

l2j how to make npc unattackable

language

How to make a npc unselectable WoW

how to make npc unattackable arcemu

arcemu lua how to make npc unattackable

unit_flags mangos

Arcemu npc unattackable

How to make a npc unselectable

npc unattackable wow

make player unattackable otland

make an npc unattacable lua

make an npc not attack you lua

lua making an npc

wow how to makes unattackable

make npc alive lua

wow lua make npc unattackable hostile

wow lua how to get a npcs level

wow unselectable npc

ArcEmu unattackable mobs

how to become unattackable in wow

npc attackable otland

Arcemu how to make a npc unattackable

SEO Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 12:21 AM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org