EvenLess wrote: ↑Wed Oct 11, 2023 6:05 pm
X42ABN6 wrote: ↑Wed Oct 11, 2023 12:31 pm
Is there any way to add passive to an equipped Armor? or Cloak? or Gloves?
Cause it seems some passives from armor/cloak/gloves can't be add to a weapon.
The very short answer: Yes.
The less short answer is at the bottom.
The long answer follows here:
If you edit (Change script) on one of Zanzer's existing "Weapon Passive Enchantments", you'll see he's using
AddPassiveToWeapon()
function, with the passive unique/entry name as the argument.
Now, knowing that all Zanzer's functions are in his
Register Commands
scripts, we can see how it works.
Code: Select all
function AddPassiveToWeapon(PassiveID)
local item = GetEquippedWeapon()
return AddPassive(item, PassiveID)
end
So basically he calls another
AddPassive()
function with two arguments, where the first argument is the equipped weapon (
GetEquippedWeapon()
) and the second argument is the passive. Looking at the
AddPassiveToPlayer()
function, shows ut that it basically just the same thing, just with the first argument being the player (
GetHostCharacter()
).
Code: Select all
function AddPassiveToPlayer(PassiveID)
local player = GetHostCharacter()
return AddPassive(player, PassiveID)
end
Knowing this, we can probably deduce that we can feed the
AddPassive()
function with other ID's that just weapon and player. So let's look at Zanzer's other functions.
At the bottom we the
GetEquippedWeapon()
function, and another that sounds very similar;
GetEquippedItem()
.
Code: Select all
function GetEquippedItem(Character, Slotname)--: Item
if Slotname == nil then
Slotname = Character
Character = GetHostCharacter()
end
if Slotname == nil then
return nil
end
if Slotnames[Slotname] ~= true then
print("Slotname must be one of the following: " .. table.concat(Slotnames, ", "))
return nil
end
SetArgToString(0, Character)
SetArgToString(1, Slotname)
ClearArg(2)
ExecuteCall("GetEquippedItem")
return GetArgAsString(2)
end
This function takes two arguments; the character and the slotname. As luck will have it, Zanzer even supplied the list of slotnames just above the function.
Code: Select all
Slotnames = {
"Helmet",
"Breast",
"Cloak",
"Melee Main Weapon",
"Melee Offhand Weapon",
"Ranged Main Weapon",
"Ranged Offhand Weapon",
"Underwear",
"Boots",
"Gloves",
"Amulet",
"Ring",
"Ring2",
"Wings",
"Horns",
"Overhead",
"MusicalInstrument",
"VanityBody",
"VanityBoots"
}
So let's combine this knowledge, to getting the underwear instead of the weapon, using the
AddPassiveToWeapon()
function as a base/reference, although we're skipping creating a function, and just using the code within the function. I'll just add a couple of passives while at it.
Code: Select all
local Entity = GetEquippedItem("Underwear")
local PassiveID = {
"UND_Nere_ShieldOfScreams",
"MAG_Barkskin_Shield_Passive",
"MAG_WondrousGloves_Passive",
"MAG_ExoticMaterial_MediumArmor_Passive",
"MAG_Druid_Wildshape_SpellResistance_Passive",
"UncannyDodge"
}
AddPassive(Entity, PassiveID)
With this you can be certain no one will ever get into your underwear