MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides  
Homepage Register FAQ Members Mark Forums Read Advertise Marketplace FPSowned


Go Back   MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides > WoW Emulator Server > Emulator Server Guides
Reload this Page [Guide][LUA] Make a mob speak/use spell on a %!
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
[Guide][LUA] Make a mob speak/use spell on a %!
(#1)
Old
Meltoor's Avatar
Meltoor is Offline
Contributor
Rep Power: 2
Reputation: 111
Meltoor will become famous soon enoughMeltoor will become famous soon enough
 
Posts: 216
Join Date: Jan 2007
Location: Hungary
[Guide][LUA] Make a mob speak/use spell on a %! - 01-10-2008

Okay, I've found a way how to make a mob do something on a certain % with LUA.
Many people said that we need C++ for that, but that FALSE!
Here's the script!

This will make a mob speak at 75%.

You have to change the red words in it.

Code:
buffer = 0
function testmob_phase(unit)
local percento = unit:GetHealthPct()
    if buffer == 0 then
    if (percento <= 75) then
    buffer = 1
    unit:SendChatMessage(12, 0, "Speak something")
--You can insert random other commands here, such as Castspell and etc, what you want your mob to do.
end
end
end

function testmob_entercombat(unit)
    buffer = 0
    unit:RegisterEvent("testmob_phase",3000, 0)
end

function testmob_LeaveCombat(unit)
    buffer = 0
end

RegisterUnitEvent(12345, 1, "testmob_entercombat")
RegisterUnitEvent(12345, 2, "testmob_leavecombat")
Looks a bit difficult? Let me help.

testmob = the name of the function, name it whatever you want, but name it on every place.
75 = the precent of when the mob should do the action.
Speak something = The text you want the mob to say.
3000 = Important! This is the delay of checking if his hp is below the current precent or not. Don't change it, I will explain this further.

=====FAQ=====


Q: Please tell me how is this working!
A: This checks the mob's hp's precent within a delay, which is now for
3000 example
Q: Why can't we use AI_Tick?
A: I couldn't get that work, besides this would not lag the server that much since it's not trying to check it continously.
Q: What does "buffer" mean?
A: The function is being checked every
3000 (=3 sec), and let's say you're doing the boss, it gets below the HP and it would trigger the function always, meaning it would continously do the function (Speak for example).
"buffer" variable makes that it will trigger only one time, and resetting it if the mob gets out of combat/gets in combat.

I know this full thing is a bit hard-to-understand, so if you have any problem, post it in this section, I will help.

You can change the
3000 to something lower, like 1000 (so the delay would be 1sec) if you're killing a low hp mob or whatsoever, it's up to you



Last edited by Meltoor; 01-10-2008 at 06:11 PM..
Reply With Quote

Donate to remove ads.
(#2)
Old
Dee2001's Avatar
Dee2001 is Offline
Sergeant
Rep Power: 2
Reputation: 8
Dee2001 is an unknown quantity at this point
 
Posts: 54
Join Date: Aug 2007
01-10-2008

uuhhh in this code if u change the unit:SendChatMessage(12, 0, "Speak something")

too unit:castspell()



would that work ??
Reply With Quote
(#3)
Old
zerohero is Offline
Site n00b.. (A leecher if I've been here for more than a month and can't earn 5 rep)
Rep Power: 2
Reputation: 3
zerohero is an unknown quantity at this point
 
Posts: 30
Join Date: May 2007
01-10-2008

would :

buffer = 2
function testmob_phase(unit)
local percento = unit:GetHealthPct()
if buffer == 2 then
if (percento <= 75) then
buffer = 1
unit:SendChatMessage(12, 0, "Speak something")

if buffer == 2 then
if (percento <= 40) then
buffer = 1
unit:SendChatMessage(12, 0, "Speak something ELSE")
end
end
end

function testmob_entercombat(unit)
buffer = 0
unit:RegisterEvent("testmob_phase",3000, 0)
end

function testmob_LeaveCombat(unit)
buffer = 0
end

RegisterUnitEvent(12345, 1, "testmob_entercombat")
RegisterUnitEvent(12345, 2, "testmob_leavecombat")
Reply With Quote
(#4)
Old
Meltoor's Avatar
Meltoor is Offline
Contributor
Rep Power: 2
Reputation: 111
Meltoor will become famous soon enoughMeltoor will become famous soon enough
 
Posts: 216
Join Date: Jan 2007
Location: Hungary
01-10-2008

buffer = 2
function testmob_phase(unit)
local percento = unit:GetHealthPct()
if buffer == 2 then
if (percento <= 75) then
buffer = 1
unit:SendChatMessage(12, 0, "Speak something")

if buffer == 2 then
if (percento <= 40) then
buffer = 1
unit:SendChatMessage(12, 0, "Speak something ELSE")
end
end
end

function testmob_entercombat(unit)
buffer = 2
unit:RegisterEvent("testmob_phase",3000, 0)
end

function testmob_LeaveCombat(unit)
buffer = 2
end

Now it would work. But I don't advise you to change the value of the buffer since it's clearly not neccesary, also it can easily make the whole script don't work properly.




Quote:
Originally Posted by Dee2001 View Post
uuhhh in this code if u change the unit:SendChatMessage(12, 0, "Speak something")

too unit:castspell()



would that work ??
Yes, it would work. That is the point, you can add your own code!



Last edited by Meltoor; 01-10-2008 at 06:09 PM..
Reply With Quote
(#5)
Old
zerohero is Offline
Site n00b.. (A leecher if I've been here for more than a month and can't earn 5 rep)
Rep Power: 2
Reputation: 3
zerohero is an unknown quantity at this point
 
Posts: 30
Join Date: May 2007
01-10-2008

can u help me out???? i can seem to get it to work.... can u set up an example? lets say with ILLidaN? ID 22917..... thnks ( and possible make him cast healing spell???? thnkx
Reply With Quote
(#6)
Old
entrepid is Offline
Sergeant
Rep Power: 2
Reputation: 7
entrepid is an unknown quantity at this point
 
Posts: 65
Join Date: Nov 2007
01-11-2008

yea id also like to know what to do with it and how i link it to a mob
Reply With Quote
(#7)
Old
Dee2001's Avatar
Dee2001 is Offline
Sergeant
Rep Power: 2
Reputation: 8
Dee2001 is an unknown quantity at this point
 
Posts: 54
Join Date: Aug 2007
01-11-2008

how do u get a lua script to work i have scripts folder and everything. do i add the extention .LUA on the end ???
Reply With Quote
(#8)
Old
Gastricpenguin's Avatar
Gastricpenguin is Offline
Why so serious...?
Legendary User

Rep Power: 7
Reputation: 794
Gastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to behold
 
Posts: 1,654
Join Date: Feb 2007
Location: 4Chan
01-11-2008

No offense, but you totally stole my idea :P
Anyway, this is a pretty bad way of making phases between bosses. Using this method, any called functions in phase one would persist through phase 2 and so on. Using "Buffer" or "didthat" is bound to fail.

I recommend looking at my new guide and using Unit:RemoveEvents()


And the emulators shall tremble.
[Only registered and activated users can see links. ]
You are responsible for any broken rule, regardless if you "didn't know" or not.
Reply With Quote
(#9)
Old
Meltoor's Avatar
Meltoor is Offline
Contributor
Rep Power: 2
Reputation: 111
Meltoor will become famous soon enoughMeltoor will become famous soon enough
 
Posts: 216
Join Date: Jan 2007
Location: Hungary
01-12-2008

1. You are wrong, totally, using that is variable is like a switch, which you turn off when the spell was used 1time. "Unit:RemoveEvents()" is needed after every phase, that's true
2. Stole "your" idea? Since when do you think I'd steal anybody's work or anything else? EVEN I posted this a little faster then you as I know. I'm offended because of the statement.



Last edited by Meltoor; 01-12-2008 at 01:16 PM..
Reply With Quote
(#10)
Old
yojimbojk's Avatar
yojimbojk is Offline
Site n00b.. (A leecher if I've been here for more than a month and can't earn 5 rep)
Rep Power: 1
Reputation: 1
yojimbojk is an unknown quantity at this point
 
Posts: 14
Join Date: Jan 2008
01-14-2008

hmmm it doent seem to work on mine
Reply With Quote
(#11)
Old
Meltoor's Avatar
Meltoor is Offline
Contributor
Rep Power: 2
Reputation: 111
Meltoor will become famous soon enoughMeltoor will become famous soon enough
 
Posts: 216
Join Date: Jan 2007
Location: Hungary
01-14-2008

Please post your screen so I might be able to help you.


Reply With Quote
(#12)
Old
Gastricpenguin's Avatar
Gastricpenguin is Offline
Why so serious...?
Legendary User

Rep Power: 7
Reputation: 794
Gastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to beholdGastricpenguin is a splendid one to behold
 
Posts: 1,654
Join Date: Feb 2007
Location: 4Chan
01-14-2008

Jeez Meltoor, i was just kidding : /


And the emulators shall tremble.
[Only registered and activated users can see links. ]
You are responsible for any broken rule, regardless if you "didn't know" or not.
Reply With Quote
(#13)
Old
Illidan1's Avatar
Illidan1 is Offline
Shan'do
Rep Power: 4
Reputation: 243
Illidan1 has a spectacular aura aboutIllidan1 has a spectacular aura aboutIllidan1 has a spectacular aura about
 
Posts: 2,258
Join Date: Jul 2007
Location: New Zealand
01-15-2008

lol, when your Elite User gastric, every one Be leaves you.. lol


Reply With Quote
(#14)
Old
Meltoor's Avatar
Meltoor is Offline
Contributor
Rep Power: 2
Reputation: 111
Meltoor will become famous soon enoughMeltoor will become famous soon enough
 
Posts: 216
Join Date: Jan 2007
Location: Hungary
01-15-2008

Quote:
Originally Posted by Gastric View Post
Jeez Meltoor, i was just kidding : /
Hm.. mkay, I wasn't in the mood when I made ze post


Reply With Quote
(#15)
Old
Xtinction's Avatar
Xtinction is Offline
Master Sergeant
Rep Power: 1
Reputation: 11
Xtinction is on a distinguished road
 
Posts: 130
Join Date: Jan 2008
Location: in Your Closet
02-29-2008

Cool Dude nice guide
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



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


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