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

    Eluna[Boss give item from list on Die]


    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    Guys I have a doubt, how can I make a creature drop a item on his death for all players close to him?

  2. #2
    I believe its about the kind of loot you put on database i dont remember the name of the database but each loot has a number that u place on creature_template and there is one where u can chose what type of loot u want

  3. #3
    Web/SQL Dev & 3D Artist

    Join Date
    Oct 2010
    Location
    somewhere between <?php and ?>
    Posts
    3,097
    The easiest way to find out is by looking at items that already give the loot to each player. For example "Emblem of Frost". Look how the loot is created for that specific item. As brunolopes pointed out, You need to first set a lootid in creature_template and then you need to use that lootid in creature_loot_template and i believe you will need reference_loot_template aswell. Read the wiki page to understand how it all works.

    https://trinitycore.atlassian.net/wi.../loot+template

  4. #4
    Yes, but I don't want to use LootId, I'm creating something different with Eluna so I want to get all near players, and ad them a item, from a table, I already did everything all working, but the issue I am facing is: nearestPlayer = WorldObject:GetNearestPlayer, only works for 1 nearest player and not all players around and I haven't found a way to get all nearests players, to add them the item on boss/creature death

  5. #5
    For what you want to do, you need to use playersInRange = WorldObject:GetPlayersInRange

  6. #6
    can you give me an example of how to use? I tried and I don't know how to exactly implement it on my code

  7. #7
    Teacher of everything

    Join Date
    Sep 2011
    Location
    Wernerland
    Posts
    2,526
    Quote Originally Posted by azamaqtlol View Post
    can you give me an example of how to use? I tried and I don't know how to exactly implement it on my code
    PM'ed
    Last edited by Psykko; 09-23-2020 at 06:46 AM.

  8. #8

  9. #9

  10. #10
    Code:
    local item, range, isHostile, isDead = 12345, 50, 0, 0
    
    local players = creature:GetPlayersInRange(range, isHostile, isDead)
    
    if(players) then
    	for _, player in pairs(players) do
    		player:AddItem(item)
    	end
    end

  11. #11
    Is this something like what ur after?

    Code:
    local chance = 0.30
    
    local DropSolo = {51800, 51803, 50793, 51011, 51384, 51788}
    
    math.randomseed(os.time())
    
    function BonechewerHungerer(event, creature, killer)
        local item, range, isHostile, isDead = 12345, 50, 0, 0
        local players = creature:GetPlayersInRange(range, isHostile, isDead)
    
    
    
        
            if (players) then
                for _, player in pairs(players) do
                    for _, v in pairs(DropSolo) do
                        if (math.random() < chance) then
                        player:AddItem(v)
                    end
                end
            end
        end
    end
    --[[    players = creature:GetPlayersInRange(150)
        playerIndex = #players
        target = players[playerIndex]
        for _, Solo in pairs {DropSolo} do
            if (math.random() < chance) then
                target:AddItem(DropSolo[math.random(#DropSolo)], 1)
                creature:RemoveEvents()
            end
        end
    end ]]
    RegisterCreatureEvent(17259, 4, BonechewerHungerer)

  12. #12
    Funserver Grandmaster

    Join Date
    Nov 2007
    Location
    Lua/C++/.DBC/SQL Developer
    Posts
    3,053

    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    sounds to me you'd have to add the items to a table and do the above script or whatever. A much simpler alternative is just to have the boss drop a badge or token and give it the flag that allows everyone to loot them and set up a vendor.

 

 

Posting Permissions

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