Lua COMMANDS!!!!
Here is a list of a bunch of Lua commands i use to script i really hope it
helps!!! (please comment and rate)
PlaySoundToSet(X) --> Plays a sound set X. (the sound is from NPC currently in the game, like Ragnaros)
function scriptlist(pUnit, Event)
pUnit:PlaySoundtoSet(ID GOES HERE)
end
CastSpell(X) --> Makes the NPC instantly cast spell X on itself.
function scriptlist(pUnit, Event)
pUnit:CastSpell(SPELL ID GOES HERE)
end
FullCastSpell(X) --> Makes the NPC cast a spell (X) with casting time on itself.
function scriptlist(pUnit, Event)
pUnit:FullCastSpell(SPELL ID GOES HERE) -- This fixes most bugged spells (use it alot :) )
end
RemoveAura(X) --> Removes spell X from the NPC.
function scriptlist(pUnit, Event)
pUnit:RemoveAura(SPELL AURA ID GOES HERE)
end
SendChatMessage(X, XX, XXX) --> Displays a chat message.
X: A number that tells the NPC if its supposed to /yell, /say and the like.
XX: If it is in a specific language (note: 0 is universal language)
XXX: The desired text for the NPC to say.
function scriptlist(pUnit, Event)
pUnit:SendChatMessage(12, 0, "DIBES SCRIPT LIST RULES!")
end
GetHealthPct() < X then --> If the NPC's health drops below X% a new event will begin if an event is included.
function scriptlist(pUnit, Event)
if pUnit:GetHealthPCT() < 50 then
end
end
RemoveEvents() --> Removes all current events from the NPC. (Use this if the NPC dies or leaves combat)
function scriptlist(pUnit, Event)
pUnit:RemoveEvents()
end
SetModel(X) --> Changes the Units model into X
function scriptlist(pUnit, Event)
pUnit:SetModel(DISPLAY ID GOES HERE)
end
SetScale(X) --> Changes the Units scale into X
function scriptlist(pUnit, Event)
pUnit:SetScale(2) -- Set it to whatever
end
FullCastSpellOnTarget(X, pUnit:XX) --> Casts a spell on a target player.
X: is the spellID
You can put these as XX:
function scriptlist(pUnit, Event)
pUnit:FullCastSpellOnTarget(SPELL ID, pUnit:GetRandomPlayer())
end
GetMainTank() casts spell X on the player with the highest aggro.
function scriptlist(pUnit, Event)
pUnit:FullCastSpellOnTarget(SPELL ID, pUnit:GetMainTank())
end
GetRandomPlayer(0) casts spell X on a random player within range.
function scriptlist(pUnit, Event)
pUnit:FullCastSpellOnTarget(SPELL ID, pUnit:GetRandomPlayer(0)) -- Zero is not needed
end
GetAddTank() casts spell X on the player with the second highest threat.
function scriptlist(pUnit, Event)
pUnit:FullCastSpellOnTarget(SPELL ID, pUnit:GetAddTank())
end
ClearHateList() --> Resets the NPC's threat list
function scriptlist(pUnit, Event)
pUnit:ClearHateList() -- This resets the NPC so use only when needed
end
:Despawn(X, XX) --> Despawns a mob after X miliseconds
X: The amount of miliseconds before the mob despawns
XX: The amount of miliseconds before it respawns
function scriptlist(pUnit, Event)
pUnit:Despawn(1000, 1000)
end
:CastSpellAoF(X, Y, Z, <ID OF SPELL>) --> Makes an NPC cast a spell like Blizzard at a certain location.
function scriptlist(pUnit, Event)
pUnit:CastSpellAoF(X gps, Y gps, Z gps, ID OF SPELL)
end
:GetName() : Returns the unit's name.
function scriptlist(pUnit, Event)
pUnit:GetName()
pUnit:GetX()
pUnit:GetY()
pUnit:GetZ()
pUnit:GetO()
pUnit:IsPlayer()
PUnit:IsCreature()
pUnit:HasFinishedQuest(questID)
pUnit:GetItemCount(itemID
pUnit:GetUnitBySqlId(sqlID)
pUnit::GetClosestPlayer()
pUnit:GetRandomPlayer(flags)
pUnit:GetRandomFriend()
pUnit:GetTauntedBy()
pUnit:GetSoulLinkedWith()
end
:GetX() : Returns the unit's X position.
:GetY() : Returns the unit's Y position.
:GetZ() : Returns the unit's Z position.
:GetO() : Returns the unit's orientation.
:IsPlayer() : Returns true if the unit is a player, false otherwise.
:IsCreature() : Returns true if the unit is a creature, false otherwise.
:HasFinishedQuest(questID) : Returns true or false depending on if the quest has been completed.
:GetItemCount(itemID) : Returns the number of the items a unit has.
:GetUnitBySqlId(sqlID) : Returns a unit from the sql ID.
:GetClosestPlayer() : Returns the nearest in-range unit that is a player.
:GetRandomPlayer(flags) : Returns a random in-range unit that is a player.
:GetRandomFriend() : Returns a random in-range unit that is a player and is
friendly towards the current player.
:GetMainTank() : Returns the main tank (most hated).
:GetAddTank() : Returns the add tank (second most hated).
:GetTauntedBy() : Returns the player that taunted the unit.
:GetSoulLinkedWith() : Returns the unit that is set as the soul link for this
unit.
:RegisterEvent() :
function scriptlist(pUnit, Event)
pUnit:RegisterEvent()
end
:SendBroadcastMessage(message) :
function scriptlist(pUnit, Event)
pUnit:SendBroadcastMessage("LOLZERZ") -- Not sure about this ive never used so tell me
if im wrong lol
end
:SendAreaTriggerMessage(message) :
function scriptlist(pUnit, Event)
pUnit:SendAreaTriggerMessage("LOLZERZ") -- Same with this one
end
:MoveTo(x, y, z, o) : Moves the unit to the specified position.
function scriptlist(pUnit, Event)
pUnit:MoveTo(X gps, Y gps, Z gps, O gps)
end
:SpawnGameObject(entryID, x, y, z, o, duration) : Spawns a gameobject at
the specified position, despawning after duration milliseconds.
function scriptlist(pUnit, Event)
pUnit:SpawnGameObject(ENTRY ID, X gps, Y gps, Z gps, O gps, 1000)
end
:SpawnCreature(entryID, x, y, z, o, faction, duration) : Spawns a creature at a position with specified faction, despawning after duration milliseconds.
function scriptlist(pUnit, Event)
pUnit:SpawnCreature( ENTRY ID, x, y, z, o, 21, 1000)
end
:KnockBack(dx, dy, affect1, affect2) :
I dont know how to use this soz -.-
:MarkQuestObjectiveAsComplete(questID, objective) : Marks an objective of a quest as complete.
function scriptlist(pUnit, Event)
pUnit:MarkQuestObjectiveAsComplete(999999, OBJECTIVE)
end
:LearnSpell(spellID) : Adds a spell to a unit.
function scriptlist(pUnit, Event)
player:LearnSpell(11) -- Check me on to see if player is right..?
end
:UnlearnSpell(spellID) : Removes a spell from a unit.
function scriptlist(pUnit, Event)
player:UnLearnSpell(11)
end
:StopMovement(time) : Stops a unit from moving for time milliseconds.
function scriptlist(pUnit, Event)
pUnit:StopMovement(100000) -- 100 seconds
end
:Emote(emoteID) : Tells a unit to perform an emote.
function scriptlist(pUnit, Event)
pUnit:Emote(7)
end
:AddItem(itemID, count) : Adds a quantity of items to a unit.
function scriptlist(pUnit, Event)
player:AddItem(195, 1)
end
:RemoveItem(itemID, count) : Removes a quantity of items from a unit.
function scriptlist(pUnit, Event)
player:RemoveItem(195, 1)
end
:CreateCustomWaypointMap() : Creates a custom waypoint map.
function scriptlist(pUnit, Event)
pUnit:CreateCutomWaypointMap() -- Dunno what it does have fun with it :D
end
:CreateWaypoint(x, y, z, o, waitTime, flags, modelID) : Adds a waypoint to the custom waypoint map.
function scriptlist(pUnit, Event)
pUnit:CreateWaypoint(X gps, Y gps, Z gps, O gps, 100, 35, 17)
end
:DestroyCustomWaypointMap() : Destroys a created custom waypoint map.
function scriptlist(pUnit, Event)
pUnit:DestroyCustomWaypointMap()
end
:MoveToWaypoint(waypointID) : Tells a unit to move to a particular waypoint.
function scriptlist(pUnit, Event)
pUnit:MoveToWaypoint(14) -- You have to have waypoints spawned for this to work
end
:SetMovementType(movementType) :
function scriptlist(pUnit, Event)
pUnit:SetMovementType(Dunno the Ids lol)
end
:SetCombatCapable(value) : If value is 1 the unit cannot attack.
function scriptlist(pUnit, Event)
pUnit:SetCombatCapable(1) -- Unit cant attack
end
function scriptlist(pUnit, Event)
pUnit:SetCombatCapable(0) -- Boss can attack <3
end
:SetHealthPct(value) : Sets the unit's health percentage.
function scriptlist(pUnit, Event)
pUnit:SetHealthPct(1) -- Sets it to 1%
end
:SetNPCFlags(flags) : Sets the NPC flags of a unit.
function scriptlist(pUnit, Event)
pUnit:SetNPCFlags(21)
end
:SetFaction(factionID) : Sets the faction of a unit.
:SetTauntedBy(unit) : Sets the unit that taunted the current unit.
:SetSoulLinkedWith(unit) : Sets the unit that is soul linked with this unit.
:ClearHateList() : Sets the highest hate/threat to one the hate list.
:WipeTargetList() : Clears the target list.
:WipeCurrentTarget() : Clears the current target and targets the next highest
threat.
:GetPlayerClass() : Gets the class of current target.
:SetFieldFlags() : Sets flags for current unit.
Please comment and rate!!!!
]