Jump to content

Equip Items by Slot


Ivandrago

Recommended Posts

Posted

Hi, I've a doubt, I searched in the Eluna Engine API, for functions, where I could make a gossip, and when a naked player choose an option, the entire gear be equipped on him by each slot, but I failed in the use of the functions, how exactly it works?

Can someone show me an example of it? I tried with player:EquipItem(ID, SLOT) but I got this error "EquipItem' on bad self (bad argument : Player expected, got table)"

 

Posted

Well rochet, I just did a "short" code, because I was afraid of it to not work, btw, It's here what I tried. Should work like this, you farm tokens, and use this NPC, the npc will check the token, remove it, and then equip the item on the player.

I did 2 tries:
1. I just put the player:EquipItem(ID, SLOT), so I thought the player should "receive" the item first, to be equipped, so I put the player:AddItem, but also no results


 

local UnitEntry = 700056

function Custom_Specialization_Show(unit, player, creature)
    if  player:GetClass() == 1 then -- Warrior
        player:GossipMenuAddItem(3,"|cff00ff00|TInterface\\icons\\ability_warrior_innerrage:30|t|r Use Dreadnaught - SBC Specialization",0,100)
        player:GossipMenuAddItem(3,"|cff00ff00|TInterface\\icons\\ability_rogue_eviscerate:30|t|r Use Gladiator - SBC Specialization",0,101)
        player:GossipMenuAddItem(3,"|cff00ff00|TInterface\\icons\\ability_warrior_defensivestance:30|t|r Use Warbringer - SBC Specialization",0,102)
        end
player:GossipSendMenu(1, creature)
end

function Custom_Specialization_Apply(event, player, unit, sender, intid, code)
if (intid == 100) then
if (player:HasItem(32569, 1)) then  
    player:RemoveItem(32569, 1)
    player:AddItem(51227, 1)
if (player:HasItem(51227, 1)) then
    Player:EquipItem(51227, 0)
    end
end
end
end

RegisterCreatureGossipEvent(UnitEntry, 1, Custom_Specialization_Show)
RegisterCreatureGossipEvent(UnitEntry, 2, Custom_Specialization_Apply)    

 

Posted

The problem is that you used Player instead of player. (case sensitive)

Player is a global table that contains all player methods. player is the parameter of your Custom_Specialization_Apply function.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use