LUA Sample Scripts

From ArcEmu-Wiki
Jump to: navigation, search

Example Code

 function KoboldVermin_OnEnterCombat(pUnit, Event) 
     if math.random() > 0.5 then -- math.random() will return a float between 0 and 1 (not including 1).
         pUnit:SendChatMessage(11, 0, "You no take candle!") -- 11 is monster say, and 0 is universal language
     else 
         pUnit:SendChatMessage(11, 0, "Yiieeeeeee! Me run!") -- 11 is monster say, and 0 is universal language
     end 
 end
 
 RegisterUnitEvent(6, 1, "KoboldVermin_OnEnterCombat") -- On Enter Combat event for unit with ID 6 (Kobold Vermin)
Personal tools