• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

getCharges setCharges?

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
Is there any way to save the charges to an item that does not have the charges attribute?
I'll use in this script (wrap and unwrap with charges back):

LUA:
local wrapId = 26054
    local string = 'Unwrap it to create a <'..item:getName()..'>.'
    local stor = item:getId()
    if wrapId ~= 0 then      
        item:transform(wrapId)
        item:setAttribute(1, stor)
        item:setAttribute(4, string)
        item:getPosition():sendMagicEffect(CONST_ME_POFF)      
    end

tfs 1.2
 
-- Setting charges
local charges = item:getCharges()
-- here you'll transform it.
item:setAttribute("attack", charges ) -- set previous charge count in the new transformed item, that doesn't have charges

when you transform back all you have to do is use the attack attribute
 

Similar threads

Back
Top