Are you because your scripts wont on your server. You could be missing a vital part of your script that I don't think many people here have covered.
Code:
function Thor_OnCombat(Unit, Event)
Unit:SendChatMessage(12, 0, "I am the god THOR! Prepare for the fight of your life!")
Unit:RegisterEvent("Thor_Frostbolt", 20000, 50)
Unit:RegisterEvent("Thor_Earthquake", 40000, 2)
end
function Thor_Frostbolt(Unit, Event)
Unit:CastSpellOnTarget(SpellID, Unit:GetRandomPlayer(4))
end
function Thor_Earthquake(Unit, Event)
Unit:CastSpell(6)
end
function Thor_OnDied(Unit, Event)
RemoveEvents()
end
function Thor_OnKilledTarget(Unit, Event)
end
function Thor_OnLeaveCombat(Unit, Event)
end
RegisterUnitEvent(13398, 1, "Thor_OnCombat")
RegisterUnitEvent(13398, 2, "Thor_OnLeaveCombat")
RegisterUnitEvent(13398, 3, "Thor_OnKilledTarget")
RegisterUnitEvent(13398, 4, "Thor_OnDied")
That is an exam script that i am almost dont with just waiting to get the spell ID's. Well, here is the break down.
Code:
function Thor_OnCombat(Unit, Event)
YOU MUST HAVE function there! Thor is the NPC/Bosses name. and (Unit, Event) must be there. After the name and the _ is OnCombat, this tells the NPC when to do carry out this part of the script below.
Code:
Unit:SendChatMessage(12, 0, "I am the god THOR! Prepare for the fight of your life!")
Unit:RegisterEvent("Thor_Frostbolt", 20000, 50)
Unit:RegisterEvent("Thor_Earthquake", 40000, 2)
end
Ok, the Unit:SendChatMessage is self-explanatory and will make the NPC talk when he enters combat. I forgot to mention that the (12, 0 . and the 12 makes the NPS yell and the 0 makes the language universal meaning every1 can understand. Unit:RegisterEvent("Thor_Frostbolt", 20000, 50) will make Thor cast frostbolt every 20 seconds 50 times(the 20000 is in miliseconds). The Unit:RegisterEvent("Thor_Earthquake", 40000, 2) is an AoE spell, he will cast earthquake every 40 seconds 2 times. The Unit:Register Events will be explained below. The end is needed at the end of every different phase.
Code:
function Thor_Frostbolt(Unit, Event)
Unit:CastSpellOnTarget(SpellID, Unit:GetRandomPlayer(4))
end
function Thor_Earthquake(Unit, Event)
Unit:CastSpell(6)
end
This is where the register event in the script above come from(The Unit:RegisterEvent)s. Like b4 function is always needed. The NPC name. Now frostbolt is the spell and the spellID has not been found yet. now the get randomplayer(4) is player it will target. The CastSpellOnTarget makes the spell an instant cast.
Code:
- GetRandomPlayer(0) this is a Random Player
- GetRandomPlayer(1) this is a Random guy in Short-Range
- GetRandomPlayer(2) this is aRandom guy in Mid-Range
- GetRandomPlayer(3) this is a Random guy in Long-Range
- GetRandomPlayer(4) = Random guy with Mana
- GetRandomPlayer(5) = Random guy with Rage
- GetRandomPlayer(6) = Random guy With Energy
- GetRandomPlayer(7) = Random guy WILL NOT BE Main-Tank
- GetMainTank()
- GetClosestPlayer()
- GetAddTank()
These are the Targets. you need end at the end of this phase.
Now, the function is needed Thor=NPC name. Earthquake=Spell name. Now, the Unit:CastSpell and not CastSpellOnTarget makes this spell an AoE. and (6) is the spellID. Once again the end is needed to end the phase.
Code:
function Thor_OnDied(Unit, Event)
RemoveEvents()
end
Ok this script will tell the server that Thor has died and will stop looking for more phases.
Code:
function Thor_OnKilledTarget(Unit, Event)
end
function Thor_OnLeaveCombat(Unit, Event)
end
These are needed and must be here even if they are not being used.
Code:
RegisterUnitEvent(13398, 1, "Thor_OnCombat")
RegisterUnitEvent(13398, 2, "Thor_OnLeaveCombat")
RegisterUnitEvent(13398, 3, "Thor_OnKilledTarget")
RegisterUnitEvent(13398, 4, "Thor_OnDied")
This the most important part of a script. It is needed to tell the server that the script is over. the 13398 is the NPC_ID. the 1,2,3,4 are telling the server which phase to register. The "Thor_On what ever is stated above". Thor=NPC name and the Onw/e is the phase in which the script must register.
Code:
RegisterUnitEvents events:
type:
1 = Enter Combat <Needed
2 = Leave Combat <Needed
3 = Killed Target <Needed
4 = Died <Needed
5 = AI Tick
6 = Spawn
7 = Gossip Talk
8 = Reach Waypoint
9 = On Leave Limbo
10 = Player Enters Range
Is a list of which numbers there to put in the register events. I am unsure what On Leave Limbo is and Reach Waypoint you shouldnt mess around with unless you are really good. Gossip Talk is when you click on the guy and the little brown box comes up with info, but a different function is needed to carry Gossip out.
Thank you for reading this guide, i did my best but still need to go and read it through again.