[Guide] How to make a lua teleporter menu

These ads disappear when you log in.

Page 1 of 4 1234 LastLast
Results 1 to 15 of 60
  1. #1
    Djfrederick's Avatar Banned
    Reputation
    127
    Join Date
    Sep 2008
    Posts
    380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)

    [Guide] How to make a lua teleporter

    How to make a Lua Teleporter by djfrederick

    First of all, i haven't seen this guide by searching or looking backwards in posts.

    Lua scripting is pretty easy. Lua is a functional programming language used to do alot of things. I want you to take a look at this list if you look down. This is the hold ''Lua scripting list'' with all the differend commands. It could be a good idea to save the list, to next time you wanner make a lua script:


    Code:
    .:GOSSIP STUFF:.
    
    :GossipCreateMenu -- I have 
    :GossipMenuAddItem -- no clue
    :GossipSendMenu --on how to work
    :GossipComplete --with 
    :GossipSendPOI -- gossip. Go to http://luaplusplus.org/forum/index.php?page=Thread&threadID=29 for tut.
    
    .:GET STUFF:.
    
    :GetMainTank() --Returns main tank.
    :GetAddTank() --Returns offtank.
    :GetX() --Gets unit's X cordinate.
    :GetY() --Gets unit's Y cordinate.
    :GetZ() --Gets unit's Z cordinate.
    :GetO() --Gets unit's O cordinate.
    :GetTauntedBy() --Gets the target the unit was taunted by.
    :GetSoulLinkedWith() --Gets the unit that it is soullinked with.
    :GetItemCount(xxxx) -- Get the amount of "xxxx" items in the player's inventory. Replace the XXXX with the itemid.
    :GetName() --Gets the name of the unit.
    :GetHealthPct() --Gets the health percent of the unit.
    :GetManaPct() --Gets the mana percent of the unit.
    :GetInstanceID() --Gets the instance id of the unit(if in an instance)
    :GetClosestPlayer() --Gets the closest player.
    :GetSpellId(spellid) -- This returns the spell as unit(planned for spell editing).
    :GetRandomPlayer(flag)
    RANDOM_ANY = 0,
    
    RANDOM_IN_SHORTRANGE = 1,
    
    RANDOM_IN_MIDRANGE = 2,
    
    RANDOM_IN_LONGRANGE = 3,
    
    RANDOM_WITH_MANA = 4,
    
    RANDOM_WITH_RAGE = 5,
    
    RANDOM_WITH_ENERGY = 6,
    
    RANDOM_NOT_MAINTANK= 7 
    :GetRandomFriend() --Gets a random friend(friendly to the unit)
    :GetUnitBySqlId(sqlid) -- use this to return a unit BY SQL ID. .go info or .npc info can provide u w/ sql id
    :GetUnitByGUID(guid) -- This returns a unit that has that guid.
    :GetPlayerClass() --Gets the player's class, will return in number form.
    :GetHealth() --Gets the unit's health, returns the exact health
    :GetMaxHealth() --Gets the unit's max health.
    :GetCreatureNearestCoords() -- similar to getgameobjectnearestcoords but for creatures.
    :GetCreatureGuid() -- absolete
    :GetGameObjectGuid() -- absolete
    :GetPlayerCountInRadius() -- this will lagg the client when called, don't use it, use GetInRangePlayerCount() instead.
    :GetGameObjectNearestCoords(x,y,z,gameobjectid) -- This returns the GO as a unit if it is found.
        Usage:
            local door = Unit:GetGameObjectNearestCoords(x,y,z,doorid)
            if door ~= nil then
                door:SetUInt32Value(GAMEOBJECT_STATE,1) -- close the door
            end
    :GetDistance(target) -- use this to check the distance from this unit to the target specified, it does not scale to yards.
    :GetGUID() -- returns a uint64 guid number that is unique to every player/creature/go/(item?).
    :GetZoneId() -- returns the zone id that the unit is currently in.
    :GetMaxMana() -- This returns the maximum mana the unit CAN have.
    :GetMana() -- This returns the exact mana the unit has. Use this w/ getpowertype to check if the unit as mana to begin with.
    :GetCurrentSpellId() -- if a unit is casting a spell, this will return the spellid of the spell that is unit is casting.
    :GetInstanceID() -- returns the instance id number if the unit/player/go is in an instance.
    :GetSpawnX() -- returns the x spawn point coord.
    :GetSpawnY() -- " " y " ".
    :GetSpawnZ() -- " " z " ".
    :GetSpawnO() -- " " o " ".
    :GetInRangePlayersCount() -- if the unit has inrangeplayers, this will return how many of those players are there.
    :GetAIState() -- returns the ai state that the unit is in, in number form.
    :GetAITargets() -- this will return a table containing a list of targets that the unit has(threat table);
    :GetInRangeObjects() -- returns a table containing a list of inrange gameobjects.
    :GetInRangeObjectCount() -- returns the number of gameobjects near the unit/go/player.
    :GetAITargetsCount() -- self explainatory.
    :GetPowerType() -- this returns the power type IN STRING FORM,"Health", "Mana", "Rage", etc.
    :GetInRangeFriends() -- Use this to return units that are friendly to the unit. It returns in  a table.
    :GetPlayerLevel() -- Don't have to explain this one.
    :GetStealthLevel() -- This returns the stealth points the unit has if any.
    :GetFaction() -- returns the faction number.
    :GetNextTarget() -- returns current target?
    :GetUInt32Value(field) -- check core to see how they are used.
    :GetUInt64Value(field) -- check core to see how they are used.
    :GetMapId() -- returns mapid.
    
    .:BOOLS(Is? commands):.
    
    :IsPlayer() -- same as IsCreature but for players instead, use to check if the current unit is a player.
    :IsCreature() -- if the current unit it is called on is a creature, it returns true/false if its not.
    :IsInCombat() returns true/false if the unit is in combat/not in combat.
    :IsCasting() -- if unit is casting a spell it returns true/false if the unit is not.(Maybe be not functional)
    :IsAlive() -- reverse of isdead(), returns true if the unit is alive/false if the unit is dead.
    :IsDead() -- is dead check. If the unit is dead, it will return true/false if its not.
    :IsInWorld() -- kind of a safe check to see if the current unit exists in the world, returns true/false
    :IsPlayerMoving() -- this is for players, returns true/false if the player is moving/not moving
    :IsCreatureMoving() -- same but for creatures, returns true/false if creature is moving/notmoving
    :IsInFront(target) -- it returns true/false if the current unit is in front of the target specified.
    :IsInBack(target) -- explainatory.
    :IsPacified() -- if unit is pacified true/false if not.
    :IsInWater() -- for players only, checks if the player is in water.
    :NoRespawn() -- set to 1 to disable respawn, 0 to allow respawning, for creatures only.
    :IsStealthed() -- If unit is stealthed, true/false if not.
    :IsPlayerAttacking() -- true/false if player is attacking, player only command.
    
    .:OTHERS:.
    
    :SendChatMessage(type,language,message) -- Type is the chat type e.g. Say,Yell,RaidWarning, chat.h has a list of them; language is pretty obvious.
        Usage:
            function SayThis(Unit,event)
                local plr = Unit:GetMainTank()
                if plr ~= nil then
                    Unit:SendChatMessage(14(yell),0(Universal lang),plr:GetName()..", you cannot resist me!")
                end
            end
    :MoveTo(x,y,z,o) -- pretty self explainatory. Use .gps while ingame to retrieve coords, O is just orientation.
        Usage:
            function MoveTo(Unit,event)
                Unit:MoveTo(Unit:GetSpawnX(),Unit:GetSpawnY(),Unit:GetSpawnZ(),Unit:GetSpawnO()) --  makes the unit move to its spawn points.
            end
    :CastSpell(spellid) -- Just fill in the spell id which you want to the current unit to cast. This will cast the spell on caller of this function and ignore cast time.
        Usage:
            function CastSpell(Unit,event)
                Unit:CastSpell(5) -- death touch xd
            end
    :CastSpellOnTarget(spellid,target) -- first blank is spellid just like above, 2nd is target, there is a bug w/ this function that it causes it not to cast on the target.
        Use FullCastSpellOnTarget(spellid,target) if you want to cast on a target.
    :FullCastSpell(spellid) -- This does the same as castspell except with casttime.
    :FullCastSpellOnTarget -- Fully casts the spell with cast time but on a target(if target is the unit, just use castspell or fullcastspell)
    :SpawnGameObject(entry_id,x,y,z,duration)-- spawns a gameobject from the entry id given at the location vector given
        Usage:
            Unit:SpawnGameObject(166434(random no.),Unit:GetX(),Unit:GetY(),Unit:GetZ(),0(0 duration to make the go not despawn. Add duration in milisecs to make it despawn after x seconds))
    :SpawnCreature(entryid,x,y,z,faction,duration) -- Unlike spawngameobject, creatures use factions. This decides whether they are friendly/hated towards the player and other stuff like if you kill it what rep u get.
        Usage:
            Unit:SpawnCreature(randomnumberhere,Unit:GetX(),Unit:GetY(),Unit:GetZ(),14,5000(despawn after 5 secs))
    :RegisterEvent(string,delay,repeats) -- registers a function to call on the unit, note that only creatures can use this, not gameobjects.
        Usage:
            Unit:RegisterEvent("KillYou",5000, 1)
            whereas
            function KillYou(Unit,event)
                Unit:FullCastSpellOnTarget(5,Unit:GetRandomPlayer(0))
            end
    :RemoveEvents() -- this has no arguments and removes all registered functions.
        Usage:
            function OnCreatureDied(Unit,event)
                Unit:RemoveEvents()-- when the creature is dead, remove all functions so it doesn't do anything.
            end
    :SendBroadcastMessage(string) -- this is a player only command. The player who called it, displays a message that you typed in there
        Usage:
            function Error(Unit,event)
                local tank = Unit:GetMainTank()
                tank:SendBroadCastMessage("You are now tanking "..Unit:GetName())
            end
    :SendAreaTriggerMessage(stringfunc) I have never used this and don't know its effects.
    :KnockBack() -- neither this.
    :MarkQuestObjectiveAsComplete(questid,objective) -- Never used this.
    :LearnSpell(spellid) -- This is a player only command, it teaches the player unit that it is called on the spellid
        Usage:
            local plr = Unit:GetClosestPlayer()
            plr:LearnSpell(5) -- learn death touch xd
    :UnlearnSpell(spellid) -- This just removes a spell already known from the player.
        Usage
            local plr = Unit:GetClosestPlayer()
            plr:UnlearnSpell(5) -- noooes gief death touch!!
    :HasFinishedQuest(questid)-- this is a boolean like others to come. It checks whether the player has finished the quest provided w/ the id, if not, it pushes false.
        Usage:
            local plr = Unit:GetClosestPlayer()
            if plr:HasFinishedQuest(questid) == true then
                do this if the player has completed the quest
            end
    :ClearThreatList() -- this maybe confused to wipethreatlist. What it does is set all threat levels to 1, This means the creature will still aggro, but aggro can be easily taken away.
    :ChangeTarget(target) -- This causes the Unit to change the target, it is basically SetNextTarget(target).
    :Emote(emoteid) -- Use this to get the unit to do a certain emote.
    :Despawn(delay,respawn)-- Note this is a creature only one, if you filled the first blank, it will delay the alloted time filled before despawning, if you filled second, it will respawn the unit after the alloted time.
    :PlaySoundToSet(soundid) -- Look in soundentries.dbc for various sounds to play. .playall(soundid) can come in handy to differenciate.
    :RemoveAura(spellid) -- If a spell has an aura, this will remove that aura.
        Usage:
            Unit:RemoveAura(41431) -- noes, gief bubble plis
    :StopMovement(delaytime) -- This will make the unit stop moving for the time specified. A creature only command.
    :AddItem(itemid) -- This is a player only command, use it to add an item to a players inventory.
    :RemoveItem(itemid) -- Use to take a way and item from a players invent.
    :CreateCustomWaypointMap() -- This creates a custom waypoint map, whether u call this or not, createwaypoint will create one automatically.
    :CreateWaypoint(x,y,z,waittime,moveflags,displayid) -- x,y,z are the coords, waittime is the delay for it to not move,moveflags are either 0 for walk, 256 for run, or 768 for fly, displayid is how you want the waypoints to look like(Like mini models).
    :DestroyCustomWaypointMap() -- use it to destroy all waypoints that the unit has. Only works for creatures.
    :MoveToWaypoint(waypointid) -- When you create ur first waypoint, they are numberd in order start from 1. 0 and 1 do the same thing. Use it to make a unit move to various waypoints.
    :TeleportUnit(mapid,x,y,z) -- This teleport's a PLAYER only unit to the location specified.
    :ClearHateList() -- this is a duplicate of ClearThreatList(). They do the same thing.
    :WipeHateList() -- This removes ALL Threat off the mob, this will cause the mob to leavecombat and return to spawn.
    :WipeTargetList() -- This just does the same as WipeHateList(), causes the mob to reset.
    :WipeCurrentTarget() -- This will cause the unit to disengaged the current player and target a new.
    :CastSpellAoF(x,y,z,spellid) -- This is for aoe spell types. Currently bugged since the spell does no dmg.
    :RemoveAllAuras() -- removes ALL auras, positive or negative on the current unit.
    :StopChannel() -- If the unit is channeling a spell, it stops it.
    :ChannelSpell(guid,spellid) -- Use this to make a unit channel, guid is the target's guid u wish and spellid is the spell u want to channel.
        Usage:
            local plr = Unit:GetRandomPlayer()
            if plr ~= nil then
                Unit:ChannelSpell(plr:GetGUID(),spellid) -- channel a certain spell on the player.
            end
    :ReturnToSpawnPoint() -- makes a unit go back to its spawn point.
    :HasAura(auraid) -- this is a boolean, returns true if the unit has the auraid given, or false if not.
    :Land() -- Use this to land units that are already flying.
    :CancelSpell() -- This cancels the units current spell?
    :AdvanceSkill(skillid,amounttoincrement) -- use it the same way u use gm command.
    :AddSkill(skillid) -- use to add a skill to player if the player doesn't already have it.
    :RemoveSkill(skillid) -- explainatory.
    :PlaySpellVisual(guid,spellid) -- doesn't seem to work.
    :RemoveThreatByPtr(target) -- Removes all threat if any, on the current target specified
    :EventCastSpell(target,sp,delay,repeats) -- this casts a spell over and over on the target specified, delay is amount to wait before recasting, repeats is how many times.
    :AttackReaction(target,dmg,spell) -- This creates fake threat towards the unit specified
        Usage:
            local plr = Unit:GetRandomPlayer(0)
            Unit:AttackReaction(plr, 1, 0) -- If the unit doesn't have any aggro, it will now aggro this player.
    :Root() -- this unlike stopmovement(), disables all movement.
    :Unroot() -- allows movement again.
    :Heal(target,spellid,amount) -- The current unit heals the target specified for the amount and spell id.
    :Energize(target,spellid,amount,type) -- Restore mana/rage/focus/hp?
    :Strike(target,dmg,sp,adddmg,exclusivedmg,pct_dmg_mod) -- I dono xD
    :Kill(target) -- this pretty much calls a dealdamage that deals damage equivalent to the Units hp.
    :DealDamage(target,damage,spellid) -- Use this to deal modified dmg to the target specified.
    :RessurectPlayer() -- player only command, rez the player!
    :RemoveFromWorld() -- use this for both creatures/gos to remove that unit from the world.
    :ModThreat(target, amount) -- modifies threat of the target, if any, to the amount specified.
    :AddAssitTarget(target) -- Use this in conjunction w/ onassisttarget died event to call stuff.
    :RemoveAurasByMechanic(mechanicid,hostileonly) -- This removes all auras depending on what mechanic,(sleep,fear,etc), hostileonly is a bool, put 1 to remove only hostile auras, 0 for all pos and nega auras
    :RemoveStealth() -- if the unit is in stealth, it removes it from stealth.
    :RegisterAIUpdateEvent(miliseconds) -- This creates an ai update event to use w/ ONAIUPDATEVENT.
    :ModifyAIUpdateEvent(newtime) -- changes the prev time to the one provided.
    :RemoveAIUpdateEvent() -- similar to RemoveEvents() but only removes aiupdate event.
    :DeleteWaypoint(wpid) -- if the unit has that wpid, it deletes it.
    
    .:SET STUFF:.
    
    :SetMana(newmana) -- Sets the units current mana to this.
    :SetMaxMana(maxmana) -- sets the maximum mana the unit can have, to this.
    :SetHealth(newhp) -- explainatory.
    :SetMaxHealth(newmaxhp) -- explainator.
    :SetFieldFlags() -- absolete, use SetUInt32/64Value(field,value)
    :SetFlying() -- if the unit can hover, it sets to hover.
    :SetCombatCapable(1/0) -- 1 disables combat, 0 re-enables combat.
    :SetCombatMeleeCapable(1/0) - 1 disables melee ability, 0 enables it.
    :SetCombatRangedCapable(1/0) -- and so on.
    :SetCombatSpellCapable(1/0) -- and so on.
    :SetCombatTargetingCapable(1/0) -- Disables targeting, only disables new targeting, if the unit already has targgeted u, it will continue to do so.
    :SetNPCFlags() -- absolete
    :SetModel(newid) -- changes the display of the unit.
    :SetScale(newscale) -- changes the size of the unit, doesn't scale compared to scalespells.
    :SetFaction(newfaction) -- changes the faction of the unit, doesn't take effect until u rezone.
    :SetStandState(newstandstate) -- Need more info.
    :SetTauntedBy(target) -- set to be taunted by the target provided
    :SetSoulLinkedWith(target) -- set soul linked, I think this means that only that target can attack this unit.
    :SetInFront(target) -- I guess it sets the current unit to be infront of the target provided.
    :SetOutOfCombatRange(combatrange) -- this sets outofcombatrange.
    :SetMovementType(0 - walk, 256 - run, 768 - fly) - yep.
    :SetHealthPct() -- sets the PERCENT of the hp.
    :ModifyRunSpeed(float) -- changes
    :ModifyWalkSpeed(float) -- the units
    :ModifyFlySpeed(float) -- speed.
    :SetOrientation(newo) -- new direction to face.
    :SetFacing(newo) -- new direction to face, only if unit is idle.
    :SetNextTarget(target) -- make the unit target the one provided.
    :SetStealth(stealthpoints) -- makes the unit go into stealth mode, is detected depending on how many stealth points
    :SetPowerType(string) -- this uses strings to set the power type ("health,mana,rage,focus,energy")
    :SetDeathState(newdeathstate) -- sets death state
    :SetPlayerStanding(faction,value) -- sets the rep of the player related to the faction.
    :SetPlayerLevel(level) -- explainatory.
    (I didn't make this list, the credits goes to the maker)

    Read trough the list please.

    STEP 1: How to start

    Make a new .txt dokument. Name is relevant. Chance the ''.txt'' to ''.lua'' and open it as Notepad.

    Okay, we wanner make it a Teleporter NPC so start out with:
    Code:
    function On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    You always put ''3544'' first and then the rest is ''3543''.

    STEP 2: Adding some menus

    You wanner make a menu for your players and yourself to teleport to. Lets say, that i wanner make a section with only ''Northrend Locations''. Then i'll make a new line and make it look like this:
    Code:
    function On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    Keep the ''2'' there. Make a name for the section, ''1'' if its the first menu ''2'' if next, ''0'' Let it stay.

    You do the same if you wanner make a new section with locations, it could look like this:
    Code:
    function On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    And so on.

    When you are done with the locations then: ALWAYS REMEMBER TO WRITE ''end'' when you are done with a menu, and because you want people to see the menu, write:
    Code:
    unit:GossipSendMenu(player)
    end
    In the end, it should look like this:
    Code:
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    STEP 3: The player

    After you have made all the location you have to do so people can see the menu and talk to the NPC.

    Jump 1 line down in the script and type:
    Code:
    function Gossip_Submenus(unit, event, player, id, intid, code)
    Then 1 more line after that write:
    Code:
    if(intid == 999) then
    unit:GossipCreateMenu(3543, player, 0)
    Now you got the ''SubMenu''. You only have to add the locations you have made in ''Step 2''. Like this:
    Code:
    if(intid == 999) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    Again, ''2'' just have to be there, ''Name for the section'', ''1'' if its the first menu ''2'' if next, ''0'' just leave it that way.

    After the first 3 steps it should look like this:
    Code:
    function On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    function Gossip_Submenus(unit, event, player, id, intid, code)
    
    if(intid == 999) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    STEP 4: Menu and etc

    If you for example click on the ''Northrend Locations'' now, there wont happen anything. So you have to make another ''Menu'' for the ''Menu''.

    Lets say you wanner make some locations to cities, when you click on ''Northrend Locations''. You find the ''GossipMenuAddItem'' from step 2 and find this part:
    Code:
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    The number you need now is the orange one.
    You jump 1 line down and type in:

    Code:
    if(intid == 1) then
    unit:GossipCreateMenu(3543, player, 0)
    Now you have made another ''Menu'' when you click on ''Northrend Locations''.

    Then type this in again:
    Code:
    unit:GossipMenuAddItem(1, "NAME HERE", 300, 0)
    Lets say that i wanner make a tab so my players can teleport to Dragonblight. Then i write:
    Code:
    unit:GossipMenuAddItem(1, "Dragonblight", 300, 0)
    ''1'' is directly teleporting when click, Name of location, Where the spell teleports you to, ''0'' just leave it.

    Normally after you have made alot of locations in the ''Northrend Locations'' tab, you want a [Back] bottom. For this you write:
    Code:
    unit:GossipMenuAddItem(0, "[Back]", 999, 0)
    ''0'' does nothing, Name of the bottom, ''999'' is ''back'', ''0'' just leave it.

    You do the same thing with the ''Azeroth Locations'' section.

    After Step 4, it should look like this:

    Code:
    function On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    function Gossip_Submenus(unit, event, player, id, intid, code)
    
    if(intid == 999) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 1) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(1, "Drangonblight", 300, 0)
    unit:GossipMenuAddItem(0, "[Back]", 999, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 2) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(1, "Stormwind", 301, 0)
    unit:GossipMenuAddItem(0, "[Back]", 999, 0)
    unit:GossipSendMenu(player)
    end
    STEP 5: .gps and coords.

    This is the in-game part.

    Go in-game and find the place you want in Dragonblight the Teleporter teleports you to. When you have found the spot, write the command ''.gps''. You only need the MapID, X, Y, Z cords.


    Jump 1 line down again and type in:
    Code:
    if(intid == 300) then
    player:Teleport(MapID, X, Y, Z)
    unit:GossipComplete(player)
    end
    The ''300'' is the
    Code:
    unit:GossipMenuAddItem(1, "Drangonblight, 300, 0)
    other number in the GossipMenuAddItem for Dragonblight.

    Do the same thing for the ''Stormwind'' location in the ''Azeroth Locations'' section.

    When you are done with Step 5, it should look something like this:

    Code:
    function On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    function Gossip_Submenus(unit, event, player, id, intid, code)
    
    if(intid == 999) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 1) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(1, "Drangonblight", 300, 0)
    unit:GossipMenuAddItem(0, "[Back]", 999, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 2) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(1, "Stormwind", 301, 0)
    unit:GossipMenuAddItem(0, "[Back]", 999, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 300) then
    player:Teleport(MapID, X, Y, Z)
    unit:GossipComplete(player)
    end
    
    if(intid == 301) then
    player:Teleport(MapID, X, Y, Z)
    unit:GossipComplete(player)
    end
    STEP 6: Make the .sql file

    You Teleporter needs a .sql to execute to the database. There are some differend programs to do it, and you could use WoW Vendetta - Wage Your War. But i think i will use the program called: ''FlexibleDBEditor'' you can download it from here: http://www.mmowned.com/forums/progra...d-3-0-3-a.html

    If not you wanner make a hole new npc use this:
    Code:
    INSERT INTO creature_proto (entry, minlevel, maxlevel, faction, minhealth, maxhealth, mana, scale, npcflags, attacktime, mindamage, maxdamage, rangedattacktime, rangedmindamage, rangedmaxdamage, respawntime, armor, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, combat_reach, bounding_radius, auras, boss, money, invisibility_type, death_state)
    VALUES (333333, 250, 250, 35,  1000000,  1000000,  1000000,  1.5, 3, 1800, 150, 250, 1800, 500, 650, 36000, 0, 0, 0, 0, 0, 0, 0, 1, 0, "MEMO", 0, 0, 0, 0);
    INSERT INTO creature_names (entry, `name`, Subname, Flags1, type, Family, Rank, unk4, SpellDataID, male_displayid, female_displayid, unknown_float1, unknown_float2, Civilian, Leader, info_str)
    VALUES (333333,"Taxi","Djfredericks Repack",0,7,0,0,0,NULL,28213,28213,1, 1,1,NULL, '');
    ORANGE = Entry ID, BLUE = Name, WHITE = Subname, RED = DisplayID for a woman, GREEN = DisplayID for a man.

    STEP 7: DisplayID and Entry

    Go to you lua script again. Jump 1 line down and type in:
    Code:
    RegisterUnitGossipEvent(ENTRY ID, 1, "On_Gossip")
    RegisterUnitGossipEvent(ENTRY ID, 2, "Gossip_Submenus")
    Put your Entry ID from the .sql you made in, where it says: ENTRY ID

    After you have followed the hole guide, it should look something like this:

    Code:
    function On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    function Gossip_Submenus(unit, event, player, id, intid, code)
    
    if(intid == 999) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(2, "Northrend Locations", 1, 0)
    unit:GossipMenuAddItem(2, "Azeroth Locations", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 1) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(1, "Drangonblight", 300, 0)
    unit:GossipMenuAddItem(0, "[Back]", 999, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 2) then
    unit:GossipCreateMenu(3543, player, 0)
    unit:GossipMenuAddItem(1, "Stormwind", 301, 0)
    unit:GossipMenuAddItem(0, "[Back]", 999, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 300) then
    player:Teleport(MapID, X, Y, Z)
    unit:GossipComplete(player)
    end
    
    if(intid == 301) then
    player:Teleport(MapID, X, Y, Z)
    unit:GossipComplete(player)
    end
    end
    
    RegisterUnitGossipEvent(ENTRY ID, 1, "On_Gossip")
    RegisterUnitGossipEvent(ENTRY ID, 2, "Gossip_Submenus")
    NOTE: When you are done with the script then type in another ''end'' like in the script we just made. Like this:

    Code:
    if(intid == 301) then
    player:Teleport(MapID, X, Y, Z)
    unit:GossipComplete(player)
    end
    end 
    Not after:
    Code:
    RegisterUnitGossipEvent(ENTRY ID, 1, "On_Gossip")
    RegisterUnitGossipEvent(ENTRY ID, 2, "Gossip_Submenus")
    Gratz, you now made a small and simple NPC Lua Teleporter
    Don't hope it were to hard to understand for you.

    The best of luck, Djfrederick.

    These ads disappear when you log in.

  2. #2
    lowgrant's Avatar Member
    Reputation
    1
    Join Date
    Dec 2008
    Posts
    45
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Omg cool will test it


  3. #3
    Djfrederick's Avatar Banned
    Reputation
    127
    Join Date
    Sep 2008
    Posts
    380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Your welcome

  4. #4
    Djfrederick's Avatar Banned
    Reputation
    127
    Join Date
    Sep 2008
    Posts
    380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Bump, leechers?

    33 viewers and 1 reply. Even if you don't need it, you can atleast comment.

  5. #5
    Ascent[Tech]'s Avatar Corporal
    Reputation
    16
    Join Date
    Dec 2008
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Omg, this is EPIC.

    Havent seen one of these guides before. Glad you made one. Im not that good at lua scripting so this is a good starter guide for me. I love my teleporter Taxi Its just take looong time to make all the .gps's for locations

    +Rep if i could but got to spread

  6. #6
    Djfrederick's Avatar Banned
    Reputation
    127
    Join Date
    Sep 2008
    Posts
    380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    No problem, glad it was useful for somebody

  7. #7
    Thug4Life's Avatar Banned
    Reputation
    69
    Join Date
    Jul 2008
    Posts
    157
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Cheers mate!
    Worked like a charm for me ^_^

    After trying to make a Portal to the places I wanted and failed, I got sick and tired of trying, but your guide has helped me through it, (rofl I sound like an idiot) but still, thanks ^^

    I'll be Rep you if I can (Might need to Spread)

    Fixed problem. Thnx AsgardCX. Rep for you ^_^
    Last edited by Thug4Life; 12-31-2008 at 11:12 AM.

  8. #8
    AsgardCX's Avatar Master Sergeant
    Reputation
    13
    Join Date
    Dec 2008
    Posts
    114
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Thanks frederick, very usefull just made one myself. Works like a charm just some minor adjustments. +Rep to you my friend but im out of cookie's!

    Thug4life.
    Make sure your mysql service is running. Anytime thug, glad it helped.
    Last edited by AsgardCX; 12-31-2008 at 11:17 AM.
    This forums is almost as addicting as chick's n beer! :beerbang:

  9. #9
    Djfrederick's Avatar Banned
    Reputation
    127
    Join Date
    Sep 2008
    Posts
    380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    No problemo guys, glad you could use it

  10. #10
    Dweebert's Avatar Private
    Reputation
    2
    Join Date
    Dec 2008
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Awesome work on the Repack and Teleporter. Thank you for the work. I'm trying to modify the porter script to cast mongoose. I have it so it tries to cast but unsure what to replace player with. I've looked around to find what the main hand is called. Tried slotid 21 but it errors.. Any ideas how I can make an enchant from an NPC to work? Appreciate any advice.. Might be the next guide idea for ya..

  11. #11
    Gosko's Avatar Sergeant
    Reputation
    3
    Join Date
    Mar 2008
    Posts
    53
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Great guide! I would rep but I need to spread

  12. #12
    Djfrederick's Avatar Banned
    Reputation
    127
    Join Date
    Sep 2008
    Posts
    380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Originally Posted by Dweebert View Post
    Awesome work on the Repack and Teleporter. Thank you for the work. I'm trying to modify the porter script to cast mongoose. I have it so it tries to cast but unsure what to replace player with. I've looked around to find what the main hand is called. Tried slotid 21 but it errors.. Any ideas how I can make an enchant from an NPC to work? Appreciate any advice.. Might be the next guide idea for ya..
    Code:
    :CastSpell(spellid) -- Just fill in the spell id which you want to the current unit to cast. This will cast the spell on caller of this function and ignore cast time.
        Usage:
            function CastSpell(Unit,event)
                Unit:CastSpell(5) -- death touch xd
    I think thats what you are looking for

    And thanks for your nice comments!

  13. #13
    Dweebert's Avatar Private
    Reputation
    2
    Join Date
    Dec 2008
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Appreciate the reply. Here's my delima, I found a script in the repack scripts folder that has this entry in it:
    Code:
    if(intid == 9) then
    unit:FullCastSpellOnTarget(58451, player)
    unit:FullCastSpellOnTarget(48100, player)
    unit:FullCastSpellOnTarget(58453, player)
    unit:FullCastSpellOnTarget(48104, player)
    unit:FullCastSpellOnTarget(48102, player)
    unit:FullCastSpellOnTarget(58449, player)
    end
    It works perfectly. What i'm tryin g to accomplish is in the same series of that code have the npc cast an enchant. When I use
    Code:
    unit:FullCastSpellOnTarget(58449, player) with the enchant spell id
    I can see the npc trying to cast the enchant. Problem is it's trying to enchant player and not the specific item. When I place Slotid ** or MainHandSlot in place of player it Fails.
    I have browsed through lots of code trying to figure this out. It's tough when I have no real working knowledge of scripting. I have been trying to learn how scripting codes work.
    And I copied and pasted your code into that string and it fails to load the .lua in game start. I have no clue as how it's useage is supposed to be. Thanks in Advance for any input..
    Last edited by Dweebert; 01-04-2009 at 01:02 PM.

  14. #14
    Meltoor's Avatar Contributor
    Reputation
    146
    Join Date
    Jan 2007
    Posts
    292
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    I'm currently working on something, and this IS a big help for it, +2rep added.

  15. #15
    Djfrederick's Avatar Banned
    Reputation
    127
    Join Date
    Sep 2008
    Posts
    380
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Glad you liked it Meltoor

    Dweebert, i actually dont think that, that is possibel. I think you have to do so the Teleporter maybe gives the Player the item to do it, or a 2th way.

Page 1 of 4 1234 LastLast

Similar Threads

  1. [Guide] How to make a NPC cast spells. NO LUA!
    By Power of Illuminati in forum WoW EMU Guides & Tutorials
    Replies: 52
    Last Post: 05-06-2011, 07:13 AM
  2. [Guide] How to make a item to teleport you
    By *Icy* in forum WoW EMU Guides & Tutorials
    Replies: 9
    Last Post: 12-02-2008, 01:02 AM
  3. [Guide] How to make Mob say/yell something when...[No LUA needed!]
    By Appled in forum WoW EMU Guides & Tutorials
    Replies: 3
    Last Post: 10-25-2008, 08:13 AM
  4. [Guide] How to make LUA portals easy and noobie too!
    By Ellenor in forum WoW EMU Guides & Tutorials
    Replies: 15
    Last Post: 03-05-2008, 09:10 PM
  5. How to make game objects teleport with LUA!
    By Le Froid in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 01-02-2008, 06:59 PM
All times are GMT -5. The time now is 05:25 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved. Digital Point modules: Sphinx-based search