Network: WoW Gold | WoW Accounts | MPS Games | FPSowned
MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides
Homepage »      Register »      Hall of Fame »      Ranks And Awards »      Advertise »      Marketplace »
 
Sign up



Do you like this excellent information? Then Donate HERE to remove ads and support the MMOwned community.


Go Back   MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides > WoW Emulator Server > Emulator Server Guides

Emulator Server Guides Guides for working with World of Warcraft Emulator servers. Learn how to create a WoW Server here.
[NO QUESTIONS HERE]

Reply
 
LinkBack Thread Tools
  #1  
Old 07-15-2009
Dibes's Avatar
Dibes is offline.
Sergeant
  
 
Join Date: May 2008
Posts: 46
Reputation: 16
Points: 649, Level: 1
Points: 649, Level: 1 Points: 649, Level: 1 Points: 649, Level: 1
Level up: 50%, 251 Points needed
Level up: 50% Level up: 50% Level up: 50%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

Wow Guides Amazing Lua guide!!!

[CENTER]
I know this has been done 100 times over but i want to explain it my way and add more onto it because what people have shown is really, really basic and will get you nowhere but a basic boss...


TABLE OF CONTENTS

1. Begginers Guide....BASIC's


2. Casting Spells!!

3. Making your script loop!

4. Phases!!

5. Random Events WOOT!

6. How to add your script


Ok lets kick it off

1 == BASIC GUIDE
The one thing you MUST remember is that Lua is sensitive

Ok lets start off simple...a function name. This means alot, it just names your script so you can register it late and it can be named anything you want but cannot be named something thats already used. lets name a function
Quote:
function Random_OnCombat(pUnit, Event)
end
this starts your script and will be used alot.

ok lets make this guy talk
Quote:
function Random_OnCombat(pUnit, Event)

pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
end
the 12 is the type of message you want

Quote:
12 -- Talking
13 -- Whisper
14 -- Yelling
and much more
the 0 is the language you want it in

Quote:
0 -- Universal - heard by all
1 -- Orcish
2 -- Darnassian
3 -- Taurahe
6 -- Dwarven
7 -- Common
8 -- Demonic
9 -- Titans
13 -- Gnomish
14 -- Zalandari
33 -- Gutterspeak
35 -- Draenei
now we need to make it complete by adding what he does when you leave combat and when you kill him or when he kills you.

Quote:
function Random_OnCombat(pUnit, Event)

pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
end

function Random_OnLeave
pUnit:RemoveEvent() -- This removes the events above
end

function Random_OnDie
end -- BTW the end, ends the script...

-- now we register them to an NPC

RegisterUnitEvent(99999, 1, "Random_OnCombat") -- the 99999 is the ID of the npc
RegisterUnitEvent(99999, 2, "Random_OnLeave") -- The 2 is the type of event only change it for the Random_OnCombat
RegisterUnitEvent(99999, 4, "Random_OnDie) -- 3 is for when the npc kills someone
here is a list of all the different things you can do with combat
Quote:
CREATURE_EVENT_ON_ENTER_COMBAT = 1,
CREATURE_EVENT_ON_LEAVE_COMBAT = 2,
CREATURE_EVENT_ON_TARGET_DIED = 3,
CREATURE_EVENT_ON_DIED = 4,
CREATURE_EVENT_ON_TARGET_PARRIED = 5,
CREATURE_EVENT_ON_TARGET_DODGED = 6,
CREATURE_EVENT_ON_TARGET_BLOCKED = 7,
CREATURE_EVENT_ON_TARGET_CRIT_HIT = 8,
CREATURE_EVENT_ON_PARRY = 9,
CREATURE_EVENT_ON_DODGED = 10,
CREATURE_EVENT_ON_BLOCKED = 11,
CREATURE_EVENT_ON_CRIT_HIT = 12,
CREATURE_EVENT_ON_HIT = 13,
CREATURE_EVENT_ON_ASSIST_TARGET_DIED = 14,
CREATURE_EVENT_ON_FEAR = 15,
CREATURE_EVENT_ON_FLEE = 16,
CREATURE_EVENT_ON_CALL_FOR_HELP = 17,
CREATURE_EVENT_ON_LOAD = 18, -- this is for when the creature is spawned it starts the script
CREATURE_EVENT_ON_REACH_WP = 19, -- this is for when the NPC reaches a waypoint
CREATURE_EVENT_ON_LOOT_TAKEN = 20, -- this is for when its loot is well looted
CREATURE_EVENT_ON_AIUPDATE = 21, -- Dunno what this is 0_0
CREATURE_EVENT_ON_EMOTE = 22, -- this is when a specific emote the npc does happens
CREATURE_EVENT_COUNT, -- this is for a timer e.g. 40000 milliseconds or 40 seconds
2 -- CASTING A SPELL!!!

Lets use our script from before

Quote:
function Random_OnCombat(pUnit, Event)

pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
end

function Random_OnLeave
pUnit:RemoveEvent()
end

function Random_OnDie
end

RegisterUnitEvent(99999, 1, "Random_OnCombat")
RegisterUnitEvent(99999, 2, "Random_OnLeave")
RegisterUnitEvent(99999, 4, "Random_OnDie)
and lets say you arent happy with just text and you want a spell casted...DONE!

There is one simple way to do this, that is to make a new function or event and have it cast the spell but register it elsewhere...i know your like WHA??? but it will make sense in a moment

E.G.

Quote:
function Random_OnCombat(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
pUnit:RegisterEvent("test_spell", 1000, 0) -- This makes it so that after he talks it goes down to test spell and does that event. The 1000 is a time in milliseconds to when the event is done and the 0 is how many times it is done 0 being a default of 1 time.
end

function test_spell(pUnit, Event)
pUnit:FullCastSpellOnTarget(11, pUnit:GetClosestPlayer()) -- This casts frostbolt of ages, the 11 is the spell ID and the pUnit:GetClosestPlayer()) is what the NPC targets and casts the spell on
end

function Random_OnLeave
pUnit:RemoveEvent()
end

function Random_OnDie
end

RegisterUnitEvent(99999, 1, "Random_OnCombat")
RegisterUnitEvent(99999, 2, "Random_OnLeave")
RegisterUnitEvent(99999, 4, "Random_OnDie)
there are two ways to cast a spell one is for AOE and one is for target spells

pUnit:FullCastSpellOnTarget() is for Target spells and
pUnit:FullCastSpell() is for AOE spells like arcane explosion


How to make your script loop

This enables a smaller better script that goes on until the npc dies. What i will do is loop it from 1st spell to 2nd spell to 1st spell and so forth

E.G.

Quote:
function Random_OnCombat(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Enter Custom Text Here")
pUnit:RegisterEvent("test_spell", 1000, 0)
end

function test_spell(pUnit, Event)
pUnit:FullCastSpellOnTarget(11, pUnit:GetClosestPlayer())
pUnit:RegisterEvent("test_spell2", 1000, 0) -- This uses the test_spell 2 event
end

function test_spell2(pUnit, Event)
pUnit:FullCastSpell(40647)
pUnit:RegisterEvent("test_spell", 1000, 0) -- this will use the test_spell event and loop it.
end

function Random_OnLeave
pUnit:RemoveEvent()
end

function Random_OnDie
end

RegisterUnitEvent(99999, 1, "Random_OnCombat")
RegisterUnitEvent(99999, 2, "Random_OnLeave")
RegisterUnitEvent(99999, 4, "Random_OnDie)
You can use this on any number of spells, its like a circle chain you register the next event then at the last one you register the first thus creating a loop

PHASES!!

Now onto phases.... Phases make your script much more eye-pleaseing and basically fun!

Now phases are simple and fun, you can make your NPC morph display IDs or mod the scale. You can even make them cast a spell and morph and change their scale at the same time!!

The way phases work is that at a certain Health percentage the npc triggers the event below.

Quote:
function TEST_Morph1(pUnit,Event)
if pUnit:GetHealthPct() <= 75 then -- this checks to see if the NPC has 75 percent health
pUnit:RemoveEvents() -- this removes the GethealthPct command so it stops checking
pUnit:SetModel(18945) -- this changes the display ID
pUnit:SendChatMessage(12, 0, "You think you are a match for me? Pfft, what about if I do.... THIS?") -- this sends the chat message
pUnit:SetScale(0.1) -- this sets the scale!
Now you can add anything below pUnit:RemoveEvents() like pUnit:FullCastSpell(SPELL ID) and much more!!

Lua random math function!!!!


This is very useful if you want a boss fight never to be the same!! It is a little more complex but useful once you get the jist of it!

I will just show you through an example in one of my scripts!

Quote:
function Leviathan_Talk(pUnit, Event)

Choice=math.random(1, 3)

if Choice==1 then -- this is saying that if it chooses number 1 then it will send a chat message and cast a spell!

pUnit:SendChatMessage(14, 0, "You are quite strong my friend! Feel the
power of the elements!")

pUnit:FullCastSpell(31895)

end -- this end is for the 1st choice's If command

if Choice==2 then -- this one is saying if it chooses choice 2 it will send a chat message and cast an AOE spell.

pUnit:SendChatMessage(14, 0, "If you run, I might just spare your lives!")

pUnit:FullCastSpell(31895)

end -- this end is for the 2nd choice's If command

if Choice==3 then

pUnit:SendChatMessage(14, 0, "The power i have, It will be enough to crush
you like little bugs!")

pUnit:FullCastSpell(31895)

end -- this end is for the 3rd choice's If command

end -- this end is for the function at the very top of math.random
Now for how to input your script.

THIS IS THE REALLY EASY PART lol

1.find your arcemu core or repack. Usually located it C:\

2. Open it up

3. go into your arcemu folder if not already there

4. find the folder named SCRIPTS NOT! script_bin!

5. Open scripts up.

6. copy your .Lua file into there.

DONE!!

I hoped you enjoyed this... I know i did
Reply With Quote


Donate to remove ads, get your "DONATOR title, and get access to the MMOwned community's elite Shoutbawx.

  #2  
Old 07-15-2009
Vragoth's Avatar
Vragoth is offline.
Knight-Lieutenant
  
 
Join Date: Nov 2008
Posts: 242
Reputation: 28
Points: 702, Level: 1
Points: 702, Level: 1 Points: 702, Level: 1 Points: 702, Level: 1
Level up: 61%, 198 Points needed
Level up: 61% Level up: 61% Level up: 61%
Activity: 1.8%
Activity: 1.8% Activity: 1.8% Activity: 1.8%
This could be very helpful for people who are just starting =) Nice guild btw
__________________


Rep anyone who helps you or posts something usefull!
Reply With Quote
  #3  
Old 07-22-2009
stoneharry's Avatar
stoneharry is offline.
Is Bored
  
 
Join Date: Sep 2007
Location: England
Posts: 1,260
Nominated 38 Times in 2 Posts
Nominated TOTM/W Award(s): 1
Reputation: 545
Points: 8,075, Level: 10
Points: 8,075, Level: 10 Points: 8,075, Level: 10 Points: 8,075, Level: 10
Level up: 44%, 625 Points needed
Level up: 44% Level up: 44% Level up: 44%
Activity: 30.9%
Activity: 30.9% Activity: 30.9% Activity: 30.9%

Looks like an alright guide, but no rep for asking me to rep you on msn.
__________________
My only form of communication is [Only registered and activated users can see links. ] or private message me on here.
Reply With Quote
  #4  
Old 07-22-2009
L0st's Avatar
L0st is offline.
Sergeant Major
  
 
Join Date: Mar 2009
Location: Ohio
Posts: 147
Reputation: 69
Points: 1,312, Level: 2
Points: 1,312, Level: 2 Points: 1,312, Level: 2 Points: 1,312, Level: 2
Level up: 83%, 88 Points needed
Level up: 83% Level up: 83% Level up: 83%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

simple and nice.
__________________
Need help with your PS (private server) well PM me and I'll do the best I can to help you out.

~-L0sT-~
Reply With Quote
  #5  
Old 07-22-2009
Dibes's Avatar
Dibes is offline.
Sergeant
  
 
Join Date: May 2008
Posts: 46
Reputation: 16
Points: 649, Level: 1
Points: 649, Level: 1 Points: 649, Level: 1 Points: 649, Level: 1
Level up: 50%, 251 Points needed
Level up: 50% Level up: 50% Level up: 50%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

thanks, i would like to talk to you i have a few questions
Reply With Quote
  #6  
Old 07-25-2009
L0st's Avatar
L0st is offline.
Sergeant Major
  
 
Join Date: Mar 2009
Location: Ohio
Posts: 147
Reputation: 69
Points: 1,312, Level: 2
Points: 1,312, Level: 2 Points: 1,312, Level: 2 Points: 1,312, Level: 2
Level up: 83%, 88 Points needed
Level up: 83% Level up: 83% Level up: 83%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

Me (fillah)
__________________
Need help with your PS (private server) well PM me and I'll do the best I can to help you out.

~-L0sT-~
Reply With Quote
  #7  
Old 07-26-2009
Sazs is offline.
New User
  
 
Join Date: Jan 2008
Posts: 5
Reputation: 1
Points: 332, Level: 1
Points: 332, Level: 1 Points: 332, Level: 1 Points: 332, Level: 1
Level up: 83%, 68 Points needed
Level up: 83% Level up: 83% Level up: 83%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Really just an amazing guide!

I'm using a trinity and not arcemu, and i haven't been able to find the location of the scripts, do anybody know how i add a script to the server when it's trinity? :b
Reply With Quote
  #8  
Old 07-27-2009
Dibes's Avatar
Dibes is offline.
Sergeant
  
 
Join Date: May 2008
Posts: 46
Reputation: 16
Points: 649, Level: 1
Points: 649, Level: 1 Points: 649, Level: 1 Points: 649, Level: 1
Level up: 50%, 251 Points needed
Level up: 50% Level up: 50% Level up: 50%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

Quote:
Originally Posted by Sazs View Post
Really just an amazing guide!

I'm using a trinity and not arcemu, and i haven't been able to find the location of the scripts, do anybody know how i add a script to the server when it's trinity? :b
trinity uses C++ not Lua sorry lol
Reply With Quote
  #9  
Old 07-27-2009
Wheeze201's Avatar
Wheeze201 is offline.
Lieutenant Commander
  
 
Join Date: Apr 2007
Posts: 626
Reputation: 51
Points: 2,273, Level: 4
Points: 2,273, Level: 4 Points: 2,273, Level: 4 Points: 2,273, Level: 4
Level up: 25%, 527 Points needed
Level up: 25% Level up: 25% Level up: 25%
Activity: 0.3%
Activity: 0.3% Activity: 0.3% Activity: 0.3%

It's an OK guide.

But it could be more colorful and just in general better.
__________________
Server ad's in sigs have to be approved by an admin.
Reply With Quote
  #10  
Old 07-27-2009
Motleykhan is offline.
New User
  
 
Join Date: Jul 2009
Posts: 4
Reputation: 1
Hey good guide thx
Reply With Quote
  #11  
Old 08-02-2009
klinkers is offline.
New User
  
 
Join Date: Mar 2009
Posts: 5
Reputation: 1
Points: 117, Level: 1
Points: 117, Level: 1 Points: 117, Level: 1 Points: 117, Level: 1
Level up: 30%, 283 Points needed
Level up: 30% Level up: 30% Level up: 30%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
I tried, but it doesesnt work.. I have made the npc with entry 9002, and it looks to me as you did exept names and id's.
Someone know what im doing wrong?

Quote:
function Destruction_OnCombat(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Testing"
pUnit:RegisterEvent("Typhoon",10000, 0)
end

function Typhoon
(pUnit, Event)
pUnit:FullCastSpellOnTarget(53223, pUnit:GetClosestPlayer())
end

function Destruction_OnLeave
pUnit:RemoveEvent()
end

function Destruction:OnDie
end

RegisterUnitEvent(9002, 1,"Destruction_OnCombat")
RegisterUnitEvent(9002, 2,"Destruction_OnLeave")
RegisterUnitEvent(9002, 4,"Destruction_OnDie")
Reply With Quote
  #12  
Old 08-02-2009
dontblink438 is offline.
Master Sergeant
  
 
Join Date: Aug 2008
Posts: 131
Reputation: 10
Points: 884, Level: 1
Points: 884, Level: 1 Points: 884, Level: 1 Points: 884, Level: 1
Level up: 97%, 16 Points needed
Level up: 97% Level up: 97% Level up: 97%
Activity: 2.5%
Activity: 2.5% Activity: 2.5% Activity: 2.5%

Quote:
Originally Posted by klinkers View Post
I tried, but it doesesnt work.. I have made the npc with entry 9002, and it looks to me as you did exept names and id's.
Someone know what im doing wrong?
Line number 2 doesnt have an ending

Code:
pUnit:SendChatMessage(12, 0, "Testing"
It needs to be

Code:
pUnit:SendChatMessage(12, 0, "Testing")
(you just didnt add the last ) needed to complete the line ;D)
Reply With Quote
  #13  
Old 08-03-2009
Napk1ns's Avatar
Napk1ns is offline.
Sergeant
  
 
Join Date: Dec 2007
Location: China. Haha jk.
Posts: 66
Reputation: 8
Points: 471, Level: 1
Points: 471, Level: 1 Points: 471, Level: 1 Points: 471, Level: 1
Level up: 15%, 429 Points needed
Level up: 15% Level up: 15% Level up: 15%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Code:
function Destruction:OnDie
end
needs to be

Code:
function Destruction_OnDie
end
Reply With Quote
  #14  
Old 08-05-2009
WarOwner is offline.
New User
  
 
Join Date: Aug 2009
Posts: 4
Reputation: 2
Points: 41, Level: 1
Points: 41, Level: 1 Points: 41, Level: 1 Points: 41, Level: 1
Level up: 11%, 359 Points needed
Level up: 11% Level up: 11% Level up: 11%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

This guide really is amazing!!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On



All times are GMT -4. The time now is 01:56 AM.




Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493