Quick Lua script checkover needed menu

User Tag List

Results 1 to 3 of 3
  1. #1
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick Lua script checkover needed

    Hey,

    I finished a script which start's when a new Dwarf character enters the world for the first time. It mounts the character on a dragon mount and sends them along a flight path until it lands.
    The script worked fine the first time but I can't get it to work again, I havent edited it since it worked either.
    I am requesting that somebody that knows more than me about Lua check over my script and help correct any errors.

    Code:
    local PlayerA = nil -- This will be the player we use to do the event
    
    function Player_OnFirstEnterWorld(event, pPlayer) -- When they first enter world
        if PlayerA == nil then -- If a player is not being used currently, a bug check so that we do not do it two times
        local race = pPlayer:GetPlayerRace() -- We get the race of the person that we shall use
        if race == 3 then -- THIS IS THE DWARF RACE, change to what you want.
            pPlayer:MovePlayerTo(pPlayer:GetX(),pPlayer:GetY(),pPlayer:GetZ()+0.1, pPlayer:GetO(), 12288) -- Move him slightly to play client side effects and shizzle
            PlayerA = pPlayer -- Here we tell the script we are now using a player
    		local Taxi = LuaTaxi:CreateTaxi()
    		Taxi:AddPathNode(1, 7004.322754, -4489.964355, 775.313782)
    		Taxi:AddPathNode(1, 7257.313965, -4375.766113, 740.363281)
    		Taxi:AddPathNode(1, 7497.269531, -4221.551270, 713.837646)
    		Taxi:AddPathNode(1, 7617.333984, -4035.526611, 731.109924)
    		Taxi:AddPathNode(1, 7958.402344, -3876.793213, 715.259521)
    		Taxi:AddPathNode(1, 8045.714355, -3859.658691, 696.492920)
    		pPlayer:StartTaxi(Taxi, 6378)
    		pPlayer:SendChatMessage(1, 6, "Finally I'm almost at the camp!")
            else
            PlayerA = nil -- if the player is not the race we wanted, reset it
            end
        else -- if the event is in use
        end
    end
    
    RegisterServerHook(3, "Player_OnFirstEnterWorld")
    
    function MassDespawnAndResetoajphae(pUnit, Event)
        PlayerA = nil -- All we need to do is say that the slot for a creating character is nil again
    end
    -Credit's to Stoneharry for (http://www.mmowned.com/forums/world-...om-intros.html) which the script is based uppon.

    Quick Lua script checkover needed
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    You can remove the whole PlayerA variable system, because I found out since making that you can carry over variables.

    RegisterTimedEvent("Function", timer, amount, pPlayer)
    ^
    Like so.

    You don't even use it.

    That whole script can be compressed into:

    Code:
    function Player_OnFirstEnterWorld(event, pPlayer) -- When they first enter world
        if pPlayer:GetPlayerRace() == 3 then -- THIS IS THE DWARF RACE, change to what you want.  
            local Taxi = LuaTaxi:CreateTaxi()
             Taxi:AddPathNode(1, 7004.322754, -4489.964355, 775.313782)
             Taxi:AddPathNode(1, 7257.313965, -4375.766113, 740.363281)
             Taxi:AddPathNode(1, 7497.269531, -4221.551270, 713.837646)
             Taxi:AddPathNode(1, 7617.333984, -4035.526611, 731.109924)
             Taxi:AddPathNode(1, 7958.402344, -3876.793213, 715.259521)
             Taxi:AddPathNode(1, 8045.714355, -3859.658691, 696.492920)
             pPlayer:StartTaxi(Taxi, 6378)
         end
    end
    
    RegisterServerHook(3, "Player_OnFirstEnterWorld")

  3. #3
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Stoneharry, the script works beautifully now!

    Edit: Gotta spread before I'm able to rep you again.

Similar Threads

  1. Lua Script Help needed
    By denniskramer in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 11-29-2008, 07:04 PM
  2. Noob LUA script, need some help.
    By pancakebuddy in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 05-14-2008, 08:33 AM
  3. [Request] I need some help with lua script (boss on death)
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 03-03-2008, 03:47 PM
  4. Need LUA Scripting Help ?
    By Snailz in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 02-04-2008, 12:36 PM
  5. Simple Lua Script , not working need help!
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 16
    Last Post: 12-30-2007, 02:06 PM
All times are GMT -5. The time now is 11:46 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search