• 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!

Transform item upon creation

Ratser

Retired // Making time for yoloswagmod
Joined
Feb 11, 2009
Messages
482
Reaction score
36
How can I transform an item inmediatly when it's created (/i [item] or with a chest)?

e.g.
Code:
-- Function missing. Dunno what to use
	if(doPlayerAddItemEx(cid, XXXX, true)) then
		doTransformItem(item.uid, XXXX)
	end
 
Something like this
Lua:
function onThink(item, interval, lastExecution)
for _, pid in ipairs(getPlayersOnline()) do
    if getPlayerItemCount(pid,9999) > 0 then
       doTransformItem(item.uid,8390)
    end
end
return true
end

or

Lua:
function onThink(interval, lastExecution)
for _, pid in ipairs(getPlayersOnline()) do
    if doPlayerRemoveItem(pid,9999,1) then
       doPlayerAddItem(pid,8390,1)
    end
end
return true
end

I find the 2nd one more attractive(lol)
 
Last edited:
I was thinking to do it like this...but isn't there a way to do it without cycling through all players?
 
Looping all players + high execution interval (1) = Too much resources used

I thought 'onAddItem' would suit this...but that function has other uses.

BTW, santigggg this is the last part of the "claw of 'The Noxious Spawn'" script. It'll check if the player has itemid = "10309" (glowing claw, may only be glowing when it's in the ring slot) in a slot other than the slot ring and automatically transform it to "10310" (normal claw).

EDIT: Yeh. The second script works (the first one doesn't because 'item' is not a valid parameter in onThink), but it transforms the itemid = "10309" when it's used normally (not /i or chest obtained). Isn't there a way to do it like the sample script I posted?
If it's not possible then, how can I make a cancel message appear (something like "Sorry, not possible.") when someone tries to use /i (without modifying the talkaction) or tries to obtain this item in a chest.
 
Last edited:
Back
Top