[Lua][ArcEmu] Need help with Lua will Rep menu

User Tag List

Results 1 to 6 of 6
  1. #1
    Pedregon's Avatar Contributor
    Reputation
    220
    Join Date
    Aug 2007
    Posts
    705
    Thanks G/R
    0/1
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua][ArcEmu] Need help with Lua will Rep

    Alright, i'm currently making a repack and I need help with a script.
    It's NOT mine, Originaly made by Dr.Cheasterfielt.

    All Credits to him.

    Here are the Scripts -

    Code:
    -- Titre: c_BG1_MOB_Manager
    -- Copyright: WowBG by Dr. Cheasterfield
    -- Description: Manager.
    
    -- Timer entre deux hook.
    local refresh=1000;
    
    function BG1_MOB_GENERIC_MANAGER_ONSPAWN(Unit, event)
    Unit:RemoveEvents();
    
    -- Temps qu'il n'y à pas de vainqueur.
    if BG1_WINNER==0 then
        -- Actualisation du score.
        BG1_SCORE_MATH_A2=(BG1_CURRENT_ALLIANCE_SCORE/BG1_MAX_SCORE)*100;
        BG1_SCORE_MATH_H2=(BG1_CURRENT_HORDE_SCORE/BG1_MAX_SCORE)*100;
        BG1_CURRENT_ALLIANCE_SCORE=BG1_CURRENT_ALLIANCE_SCORE-BG1_H2_NBR;
        BG1_CURRENT_HORDE_SCORE=BG1_CURRENT_HORDE_SCORE-BG1_A2_NBR;
        -- On enregistre les joueurs sur la map.
        MAP_INGAME_BG1=Unit:GetInRangePlayers();
        -- On enregistre les gameobjects sur la map.
        MAP_INGAME_BG1_GO=Unit:GetInRangeObjects();
        -- Messages liés aux drapeaux.
        if BG1_CTF1_CAPTURE_FLAG==1 then
            if BG1_CTF1_FLAG[table.getn(BG1_CTF1_FLAG)-2]==BG1_CTF1_CLAN then BG1_CTF1_CONDIT = "repris" else BG1_CTF1_CONDIT = "pris" end
            Unit:SendChatMessage(42, 0, BG1_CTF1_CLAN.." a "..BG1_CTF1_CONDIT.." "..BG1_CTF1_FLAG_NAME..".");
            BG1_CTF1_CAPTURE_FLAG=0;
        end
        if BG1_CTF2_CAPTURE_FLAG==1 then
            if BG1_CTF2_FLAG[table.getn(BG1_CTF2_FLAG)-2]==BG1_CTF2_CLAN then BG1_CTF2_CONDIT = "repris" else BG1_CTF2_CONDIT = "pris" end
            Unit:SendChatMessage(42, 0, BG1_CTF2_CLAN.." a "..BG1_CTF2_CONDIT.." "..BG1_CTF2_FLAG_NAME..".");
            BG1_CTF2_CAPTURE_FLAG=0;
        end
        if BG1_CTF3_CAPTURE_FLAG==1 then
            if BG1_CTF3_FLAG[table.getn(BG1_CTF3_FLAG)-2]==BG1_CTF3_CLAN then BG1_CTF3_CONDIT = "repris" else BG1_CTF3_CONDIT = "pris" end
            Unit:SendChatMessage(42, 0, BG1_CTF3_CLAN.." a "..BG1_CTF3_CONDIT.." "..BG1_CTF3_FLAG_NAME..".");
            BG1_CTF3_CAPTURE_FLAG=0;
        end
    else
        -- Message si la horde gagne.
        if BG1_CURRENT_ALLIANCE_SCORE<=0 and BG1_WINNER==0 then
            BG1_WINNER=1
            Unit:PlaySoundToSet(SOUND_HORDEWINS);
            Unit:SendChatMessage(42, 0, H2_NAME.." Win ! ");
        end
        -- Message si l'alliance gagne.
        if BG1_CURRENT_HORDE_SCORE<=0 and BG1_WINNER==0 then
            BG1_WINNER=2
            Unit:PlaySoundToSet(SOUND_ALLIANCEWINS);
            Unit:SendChatMessage(42, 0, A2_NAME.." Win ! ");
        end
    
        -- On repasse les drapeaux au neutre.
        for i=1, table.getn(MAP_INGAME_BG1_GO), 1 do
        if MAP_INGAME_BG1_GO[i]:GetEntry()==BG1_CTF1_ID or MAP_INGAME_BG1_GO[i]:GetEntry()==BG1_CTF2_ID or MAP_INGAME_BG1_GO[i]:GetEntry()==BG1_CTF3_ID then
            MAP_INGAME_BG1_GO[i]:SetUInt32Value(GAMEOBJECT_DISPLAYID,MODEL_NEUTRAL);
            MAP_INGAME_BG1_GO[i]:SetUInt32Value(GAMEOBJECT_FACTION,GAMEOBJECT_FACTION_NEUTRAL);
            MAP_INGAME_BG1_GO[i]:Update(MAP_INGAME_BG1[1]);
        end
        -- Distribution des récompenses.
        for i=1, table.getn(BG1_SCORE), 1 do
            local xp=BG1_SCORE[i]:GetPlayerLevel();
            BG1_SCORE[i]:GiveXP(xp*BG1_XP_RATE);
        end
        -- Reinitialisation des variables.
            BG1_A2_NBR=0;
            BG1_H2_NBR=0;
            BG1_CURRENT_ALLIANCE_SCORE=BG1_MAX_SCORE;
            BG1_CURRENT_HORDE_SCORE=BG1_MAX_SCORE;
            BG1_WINNER=0;
            BG1_CTF1_FLAG={};
            BG1_CTF2_FLAG={};
            BG1_CTF3_FLAG={};
            BG1_SCORE={};
    end
    end
    
    -- Refreshing timer
    Unit:RegisterEvent("BG1_MOB_GENERIC_MANAGER_ONSPAWN", refresh, 1);
    end
    
    RegisterUnitEvent(BG1_MOB_GENERIC_MANAGER, 18, "BG1_MOB_GENERIC_MANAGER_ONSPAWN");
    Code:
    -- Titre: c_BG1_MOB_Register
    -- Copyright: WowBG by Dr. Cheasterfield
    -- Description: Register.
    
    -- Timer entre deux hook.
    local refresh=1000;
    
    -- Initialisation de la variable de temps entre deux appels.
    REGISTER_BG1_NEXT_CALL=REGISTER_BG1_CALL_TIME;
    
    function BG1_MOB_GENERIC_REGISTER_ONSPAWN(Unit,event)
    Unit:RemoveEvents();
    
    -- Temps avant prochain appel.
    REGISTER_BG1_NEXT_CALL=REGISTER_BG1_NEXT_CALL-refresh;
    if REGISTER_BG1_NEXT_CALL==0 then
    REGISTER_BG1_NEXT_CALL=REGISTER_BG1_CALL_TIME;
    
    -- Condition de lancement.
    if table.getn(REGISTER_BG1_A2)>=BG1_MIN_PLAYER and table.getn(REGISTER_BG1_H2)>=BG1_MIN_PLAYER then
    for i=1, table.getn(REGISTER_BG1), 1 do
    
    -- Annonce aux joueurs inscrits.
    REGISTER_BG1[i]:PlaySoundToPlayer(5495);
    REGISTER_BG1[i]:SummonRequest(REGISTER_BG1[i]:GetGUID(), 12, 0, 0, -9071.36, 428.149, 93.0561);
    
    -- On vide les tables d'inscriptions.
    REGISTER_BG1_A2={}
    REGISTER_BG1_H2={}
    end
    
    -- Annonce écrite.
    Unit:SendChatMessage(14, 0, REGISTER_BG1_NAME.." is waiting for you !");
    
    -- On vide la liste des inscrits.
    REGISTER_BG1={};
    end
    end
    -- Refreshing timer
    Unit:RegisterEvent("BG1_MOB_GENERIC_REGISTER_ONSPAWN", refresh, 1);
    end
    
    function BG1_MOB_GENERIC_REGISTER_ONGOSSIP(Unit,event,player)
    Unit:GossipCreateMenu(100, player, 0);
    Unit:GossipMenuAddItem(0, "##"..REGISTER_BG1_NAME.."##", 0, 0);
    Unit:GossipMenuAddItem(0, "Player(s) who is/are wainting: "..table.getn(REGISTER_BG1), 1, 0);
    Unit:GossipMenuAddItem(0, "Player(s) listed: "..table.getn(MAP_INGAME_BG1), 1, 0);
    Unit:GossipMenuAddItem(0, "Next call: "..(REGISTER_BG1_NEXT_CALL/1000).."sec", 1, 0);
    Unit:GossipMenuAddItem(0, "###########################", 2, 0);
    -- Si aucun joueurs n'est inscrit, on evite la boucle.
    if table.getn(REGISTER_BG1)==0 then
    Unit:GossipMenuAddItem(0, "Join the list !", 3, 0);
    else
    -- Le joueur est-il inscrit ?
    for i=1, table.getn(REGISTER_BG1), 1 do
    if player==REGISTER_BG1[i] then
    Unit:GossipMenuAddItem(0, "Left the fight", 4, 0);
    break
    elseif i==table.getn(REGISTER_BG1) then Unit:GossipMenuAddItem(0, "Join the list !", 3, 0);
    end
    end
    end
    Unit:GossipSendMenu(player)
    end
    
    function BG1_MOB_GENERIC_REGISTER_ONSELECT(Unit,Event,player,MenuId,id,Code)
    player:GossipComplete()
    -- On selectionne le niveau du joueur.
    local race=player:GetTeam();
    -- On selectionne la classe du joueur.
    local class=player:GetPlayerClass();
    -- On selectionne le niveau du joueur.
    local level=player:GetPlayerLevel();
    -- Rejoindre la file d'attente.
    if id==3 then
    table.insert(REGISTER_BG1,player);
    player:SendBroadcastMessage("You join the fight for: "..REGISTER_BG1_NAME);
    if race == 1 then table.insert(REGISTER_BG1_H2,player); else table.insert(REGISTER_BG1_A2,player); end
    end
    -- Quitter la file d'attente.
    if id==4 then for i=1, table.getn(REGISTER_BG1), 1 do if player==REGISTER_BG1[i] then table.remove(REGISTER_BG1,i); player:SendBroadcastMessage("You left the fight for: "..REGISTER_BG1_NAME); end end end
    end
    
    RegisterUnitGossipEvent(BG1_MOB_GENERIC_REGISTER, 1, "BG1_MOB_GENERIC_REGISTER_ONGOSSIP")
    RegisterUnitGossipEvent(BG1_MOB_GENERIC_REGISTER, 2, "BG1_MOB_GENERIC_REGISTER_ONSELECT")
    RegisterUnitEvent(BG1_MOB_GENERIC_REGISTER, 18, "BG1_MOB_GENERIC_REGISTER_ONSPAWN")
    Problems;



    + 4 rep for help :]
    Leecher - 08-30-2007 - Contributor - 07-23-2008
    Donator - 06-19-2009
    My website



    [Lua][ArcEmu] Need help with Lua will Rep
  2. #2
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would suggest PMing him yourself, he will be able to fix this straight away. It seems that it is not being given a value when its needed.




  3. #3
    Pedregon's Avatar Contributor
    Reputation
    220
    Join Date
    Aug 2007
    Posts
    705
    Thanks G/R
    0/1
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    He hasn't been online. :/
    Leecher - 08-30-2007 - Contributor - 07-23-2008
    Donator - 06-19-2009
    My website



  4. #4
    Kiev's Avatar Contributor
    Reputation
    288
    Join Date
    Nov 2007
    Posts
    1,819
    Thanks G/R
    0/4
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would presume he has a MSN address laying around here somewhere, or atleast, a email address. That or he is curerntly working on a new project.




  5. #5
    Dynashock's Avatar Contributor

    Reputation
    176
    Join Date
    Nov 2007
    Posts
    203
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    attempt to call method 'SummonRequest' (a nil value)
    means the function SummonRequest() does not exist or does not exist for the object, in this case a player object. Either the function's name has been changed by LuaHypArc or it has not been implemented. I recall seeing a core edit in Dr. Chesterfield's release.

    The second error is a more thorough error which I cannot comment on unless I look through all of the script. This I won't do because I really do not like Dr. Chesterfield's style of writing, not to mention I can't read French.

    However, I can explain what goes wrong and why.
    Code:
    BG1_SCORE_MATH_A2=(BG1_CURRENT_ALLIANCE_SCORE/BG1_MAX_SCORE)*100;
    The Lua Engine is trying to divide BG1_CURRENT_ALLIANCE_SCORE by BG1_MAX_SCORE, but as BG1_CURRENT_ALLIANCE_SCORE is nil (it hasn't been initialised yet) or it has been cleared from the global namespace, it gives an error as it cannot divide nil by something. So something goes wrong with setting BG1_CURRENT_ALLIANCE_SCORE.
    Ignorance is bliss.

  6. #6
    Pedregon's Avatar Contributor
    Reputation
    220
    Join Date
    Aug 2007
    Posts
    705
    Thanks G/R
    0/1
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, I understand. I managed to fix the script and it no longer gives the errors.
    Thank you for your explanation. :]
    Leecher - 08-30-2007 - Contributor - 07-23-2008
    Donator - 06-19-2009
    My website



Similar Threads

  1. Need help with paypal will pay and +rep
    By karch in forum Community Chat
    Replies: 16
    Last Post: 12-07-2010, 07:49 AM
  2. Need help with PayPal Will Rep
    By The Legendary D in forum WoW Scams Help
    Replies: 5
    Last Post: 06-25-2008, 11:35 AM
  3. Need help with RWMod, will +Rep
    By Tankotron in forum WoW UI, Macros and Talent Specs
    Replies: 2
    Last Post: 06-10-2008, 07:58 PM
  4. NEED help with server plus rep
    By Denelly in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 10-30-2007, 09:12 PM
All times are GMT -5. The time now is 04:23 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search