PDA

View Full Version : Is My LUA Boss script right?



Milation
02-09-08, 09:25 PM
Written By Havokk
function Super Boss_OnCombat(Unit, Event)
Unit:SendChatMessage(12, 0, "Haha you fools")
Unit:RegisterEvent("Super Boss_Haha", 2000, 0)
Unit:RegisterEvent("Super Boss_Haha", 2000, 0)
Unit:RegisterEvent("Super Boss_Super Boss",1000,0)
Unit:RegisterEvent("Super Boss_Super Boss",1000,0)
Unit:RegisterEvent("Super Boss_Super Boss",1000,0)
function Super Boss_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
function Super Boss_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
function Super Boss_OnDied(Unit, Event)
Unit:RemoveEvents()
end
function Super Boss_OnKilledTarget(Unit, Event)
end
RegisterUnitEvent(50000, 1, "Super Boss_OnCombat")
RegisterUnitEvent(50000, 2, "Super Boss_OnLeaveCombat")
RegisterUnitEvent(50000, 3, "Super Boss_OnKilledTarget")
RegisterUnitEvent(50000, 4, "Super Boss_OnDied")

Chmun
02-09-08, 11:06 PM
Dont think so... WigSplitta can confirm this

insomnicide
03-09-08, 01:12 AM
Written By Havokk
function Super Boss_OnCombat(Unit, Event)
Unit:SendChatMessage(12, 0, "Haha you fools")
Unit:RegisterEvent("Super Boss_Haha", 2000, 0)
Unit:RegisterEvent("Super Boss_Haha", 2000, 0)
Unit:RegisterEvent("Super Boss_Super Boss",1000,0)
Unit:RegisterEvent("Super Boss_Super Boss",1000,0)
Unit:RegisterEvent("Super Boss_Super Boss",1000,0)
function Super Boss_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
function Super Boss_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
function Super Boss_OnDied(Unit, Event)
Unit:RemoveEvents()
end
function Super Boss_OnKilledTarget(Unit, Event)
end
RegisterUnitEvent(50000, 1, "Super Boss_OnCombat")
RegisterUnitEvent(50000, 2, "Super Boss_OnLeaveCombat")
RegisterUnitEvent(50000, 3, "Super Boss_OnKilledTarget")
RegisterUnitEvent(50000, 4, "Super Boss_OnDied")


The reason why its wrong is because you have events registered, but you dont have the events themselves. Plus, you only need to register an even once, not three times.

StickyIcky
03-09-08, 01:16 AM
Uhm Ghost...I only know C++...i dont **** around with LUA lol

Knaur
03-09-08, 10:58 AM
also you should rename all Super Boss to SuperBoss or something
cause lua dont like spaces mostly.

and you should maybe upgrade your lua code a bit

to pUnit instead of Unit, some cores read pUnit better than Unit of some reason

try this one:


Written By Havokk
function SuperBoss_OnCombat(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Haha you fools")
pUnit:RegisterEvent("SuperBoss_Haha", 2000, 0)
pUnit:RegisterEvent("Super Boss_SuperBoss",1000,0)
end

function SuperBoss_Haha(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Haha Hihi Hoho")
end

function SuperBoss_SuperBoss(pUnit, Event)
pUnit:SendChatMessage(12, 0, "Im Da Almigthy Super Boss")
end

function SuperBoss_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end

function SuperBoss_OnDied(pUnit, Event)
pUnit:RemoveEvents()
end

function SuperBoss_OnKilledTarget(pUnit, Event)
pUnit:RemoveEvents()
end

RegisterUnitEvent(50000, 1, "SuperBoss_OnCombat")
RegisterUnitEvent(50000, 2, "SuperBoss_OnLeaveCombat")
RegisterUnitEvent(50000, 3, "SuperBoss_OnKilledTarget")
RegisterUnitEvent(50000, 4, "SuperBoss_OnDied")


ofcourse he will not do any spells and so on with your script,
only talk. since you didnt add any spells or spell commands here
also every event must have a unique name

Boxxy
03-09-08, 03:45 PM
Luas experts here and yes thats wrong XD /\/\