Welcome to AC Web.
Results 1 to 15 of 15
  1. #1

    [Eluna]Level Scaling


    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    Hi, I was wondering if it would be possible to do a level scaling system on QuestAccept.
    For some reason, my code does not work on Npc2 and only works for NpcId(sets npc level to = playerlevel)

    And a little explanation what script should do, so basically on QuestAccept every NPC in the dungeon should be boosted to player level (Level 80) and ofc after the quest is completed mobs should scale down again to the there original level


    Code:
    local NpcId = 514
    local QuestId = 1097
    local Npc2 = 11320
    
    local function OnQuestAccept(event, player, creature, quest)
        if (quest:GetId() == QuestId) then
            creature:SetLevel(player:GetLevel())
        end
    end
    
    RegisterCreatureEvent(NpcId, 31, OnQuestAccept)
    RegisterCreatureEvent(Npc2, 31, OnQuestAccept)
    I know this code exists

    Code:
    local levelScalingSystem = {};
    
    function levelScalingSystem.CreatureSetLevel(event, player, enemy)
            if(enemy:GetObjectType() == "Creature") then
    	enemy:SetLevel(player:GetLevel())
             end
    end
    
    RegisterPlayerEvent(33, levelScalingSystem.CreatureSetLevel)
    But this only works on Entering Combat and that is not what I'm looking for.
    And I'm totally unsure if it's possible to set the entire map, in this case, map:389 to mech players level

    Thank you
    Last edited by Voltx; 09-14-2020 at 12:49 PM.

  2. #2


    Join Date
    Aug 2020
    Location
    Planet Earth
    Posts
    55
    Player_event_on_map_change = 28

  3. #3
    http://elunaluaengine.github.io/Glob...rMapEvent.html

    I'd wait for someone with better knowledge to give a reply, but you could try using 'RegisterMapEvent' either on enter or on load get the guid of all creatures in that zone/instance and then Unit:SetLevel.

  4. #4
    Quote Originally Posted by shotsofdeath98 View Post
    http://elunaluaengine.github.io/Glob...rMapEvent.html

    I'd wait for someone with better knowledge to give a reply, but you could try using 'RegisterMapEvent' either on enter or on load get the guid of all creatures in that zone/instance and then Unit:SetLevel.
    i have no idea how to do that or what guid

    i tried this

    Code:
    MapId = 389
    local function Ragefire(event, player, creature)
    
    if(player:GetMapId() == MapId)then
        creature:SetLevel(80)    
        end
    end
    
    RegisterPlayerEvent(28, Ragefire)
    and ofc it does not work because index local "creature" (a nil value) :'(

  5. #5
    Pretty sure u cant just get the map idea hope it will scale the npc up. creature:SetLevel(80) Wont work either it don't know what creature to set to level 80. U need to specify what creature u want to be set to X level. I seen a script with like
    if(enemy:GetObjectType() == "Creature") then
    enemy:SetLevel(player:GetLevel())
    This is pretty bad if u ask me. I would probably recommend phasing instead. Or if u make it so if u got the Quest in log it will level up all creatures entry Ids to X level

  6. #6
    Quote Originally Posted by Pox View Post
    Pretty sure u cant just get the map idea hope it will scale the npc up. creature:SetLevel(80) Wont work either it don't know what creature to set to level 80. U need to specify what creature u want to be set to X level. I seen a script with like


    This is pretty bad if u ask me. I would probably recommend phasing instead. Or if u make it so if u got the Quest in log it will level up all creatures entry Ids to X level
    Code:
    local QuestNpcId = 514
    local QuestId = 1097
    local Earthborer = 11320
    
    
     
    function OnQuestAccept(event, player, creature, quest)
        if(quest:GetId() == QuestId) then
          creature:SetLevel(80)
        end
    end
    
    function OnQuestAccept1(event, player, creature, quest, unit)
    
        if(creature:Getid() == Earthborer) then
          creature:SetLevel(80)
        end
    end
     
    RegisterCreatureEvent(QuestNpcId, 31, OnQuestAccept)
    RegisterCreatureEvent(Earthborer, 31, OnQuestAccept1)
    Gave this code a shot and only thing that change was the quest givers (QuestNpcId = 514) level. The level from the dungeon NPC (Earthborer = 11320) stayed the same

  7. #7


    Join Date
    Aug 2020
    Location
    Planet Earth
    Posts
    55
    Quote Originally Posted by Voltx View Post
    Code:
    local QuestNpcId = 514
    local QuestId = 1097
    local Earthborer = 11320
    
    
     
    function OnQuestAccept(event, player, creature, quest)
        if(quest:GetId() == QuestId) then
          creature:SetLevel(80)
        end
    end
    
    function OnQuestAccept1(event, player, creature, quest, unit)
    
        if(creature:Getid() == Earthborer) then
          creature:SetLevel(80)
        end
    end
     
    RegisterCreatureEvent(QuestNpcId, 31, OnQuestAccept)
    RegisterCreatureEvent(Earthborer, 31, OnQuestAccept1)
    Gave this code a shot and only thing that change was the quest givers (QuestNpcId = 514) level. The level from the dungeon NPC (Earthborer = 11320) stayed the same
    Obviously?? on the quest accept you need to get all creatures in range (http://elunaluaengine.github.io/Worl...esInRange.html) and loop it for each creature.

  8. #8
    Quote Originally Posted by 0Voltage View Post
    Obviously?? on the quest accept you need to get all creatures in range (http://elunaluaengine.github.io/Worl...esInRange.html) and loop it for each creature.

    That makes no sense to me. Since I'm kind of new to all this Lua stuff. But thank you ill try to figure something out

  9. #9


    Join Date
    Aug 2020
    Location
    Planet Earth
    Posts
    55
    I won't spoonfeed you, you are just trying to change ALL creatures' level while targeting a single one.

  10. #10
    Quote Originally Posted by 0Voltage View Post
    I won't spoonfeed you, you are just trying to change ALL creatures' level while targeting a single one.
    This works

    Code:
    local NPC_ID = 11320
    
    local Range = 500 -- Range in yards
    
    function AreaTrigger(event, creature, plr)
        if (plr:GetUnfriendlyUnitsInRange(NPC_ID, Range)) then
            creature:SetLevel(22)
        end
    end
    
    RegisterCreatureEvent(NPC_ID, 27, AreaTrigger)
    ofc it only works on one NPC even if i make a list of NPCs,

    and this code that I came up with in my head does not work as well

    Code:
    local QuestNpcId = 514
    local QuestId = 1097
    local MoltenElemental = 11321
    local Range = 400 -- Range in yards
    local Earthborer = 11320
    function OnQuestAccept(event, plr, creature, quest)
        if (quest:GetId() == QuestId) then
            -- plr:GetUnfriendlyUnitsInRange(MoltenElemental, Range)
            -- plr:GetUnfriendlyUnitsInRange(Earthborer, Range)
            creature:SetLevel(88)
        end
    end
    ----------------------------------------------------------------
    function Trigger(event, creature, plr)
        if (OnQuestAccept == true) then
            plr:GetUnfriendlyUnitsInRange(Earthborer, Range)
            creature:SetLevel(50) 
        end
    end
    
    RegisterCreatureEvent(Earthborer, 27, Trigger)
    RegisterCreatureEvent(QuestNpcId, 31, OnQuestAccept)
    #desprat #give_Up
    Last edited by Voltx; 09-15-2020 at 03:16 PM.

  11. #11
    Do a loop for the creatures


    something like this prob work

    local creaturesInRange = creature:GetCreaturesInRange(Range, nil, 0, 1)
    for _, v in pairs(creaturesInRange) do
    v:SetLevel(X)

    unsure how till will turn out if u complete the quest but I assume stuff will reset to normal. Might wanna set checks so it returns back to normal if u don't have quest active and when u reset dungeon etc if its for a dungeon. So basically u gotta have checks to make sure if player has a quest active it checks once u go in 2 dungeon it will scale it up again if u got quest. Could probably write this sentence better but too lazy ro correct myself
    Last edited by Pox; 09-15-2020 at 03:21 PM.

  12. #12
    now I'm even more lost than before. the entire script just crashed the server fuck my useless life

  13. #13
    Something like this https://pastebin.com/GLE9r27B

    u aware that hp and such still are the same by leveling it up this way
    Last edited by Pox; 09-15-2020 at 03:31 PM.

  14. #14
    Quote Originally Posted by Pox View Post
    Something like this https://pastebin.com/GLE9r27B

    u aware that hp and such still are the same by leveling it up this way

    I love you, and thank you for putting in comments so I can get a batter understanding of whats going on. <3

  15. #15

    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    I highly recommend not doing it this way tbh. Way better just to use the phasing system instead. But if ur just messing around with lua its fine i guess^^

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •