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

[Request] Possibly easy for a good coder?

Saints Anathema

Old School Doleran
Joined
Feb 24, 2009
Messages
653
Reaction score
8
Location
BC,Canada
Using Tfs 2, and i run a edited roxxors map. Decided to add some new items in monsters, was wondering if anyone knew why this wasn't working. So in this script you need a Ceremonial ankh, and when you right click on the ankh in your backpack with the required items for example 100 small topaz's it will give you the reward item. Before i changed any item id's this script worked perfectly for about 5 items

Code:
function onUse(cid, item, frompos, item2, topos)

	if item.itemid == 2354 then 
   
        if doPlayerRemoveItem(cid,6553,1) == 1 then
           doPlayerAddItem(cid,2447,1)
	doPlayerRemoveItem(cid,2354,1)
	doPlayerSendTextMessage(cid,21,"Your weapon has been upgraded!")

	elseif item.itemid == 2354 then 
   
        if doPlayerRemoveItem(cid,7407,1) == 1 then
           doPlayerAddItem(cid,8932,1)
	doPlayerRemoveItem(cid,2354,1)
	doPlayerSendTextMessage(cid,21,"Your weapon has been upgraded!")
	
	elseif item.itemid == 2354 then 
   
        if doPlayerRemoveItem(cid,8929,1) == 1 then
           doPlayerAddItem(cid,7429,1)
	doPlayerRemoveItem(cid,2354,1)
	doPlayerSendTextMessage(cid,21,"Your weapon has been upgraded!")

	elseif item.itemid == 2354 then 
   
        if doPlayerRemoveItem(cid,9970,100) == 1 then
           doPlayerAddItem(cid,8909,1)
	doPlayerRemoveItem(cid,2354,1)
	doPlayerSendTextMessage(cid,21,"Your weapon has been upgraded!")

	elseif item.itemid == 2354 then 

        if doPlayerRemoveItem(cid,5669,1) == 1 then
           doPlayerAddItem(cid,8910,1)
	doPlayerRemoveItem(cid,2354,1)
	doPlayerSendTextMessage(cid,21,"Your weapon has been upgraded!")
		
		elseif item.itemid == 2354 then 
   
        if doPlayerRemoveItem(cid,2157,100) == 1 then
           doPlayerAddItem(cid,8853,1)
	doPlayerRemoveItem(cid,2354,1)
	doPlayerSendTextMessage(cid,21,"Your weapon has been upgraded!")
		
		elseif item.itemid == 2354 then 
   
        if doPlayerRemoveItem(cid,9969,1) == 1 then
           doPlayerAddItem(cid,8890,1)
	doPlayerRemoveItem(cid,2354,1)
	doPlayerSendTextMessage(cid,21,"Your weapon has been upgraded!")
       else
           doPlayerSendCancel(cid, "You do not have any pro items to uprgade!")
       end
end
end
end
end
end
   
       return 1
   end


A very helpful member of otlands, Kokokoko had a look at my problem and came up with this script all credits go to him and my deepest thanks for the help thus far.


pro_upgrade.lua
Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)

isStacked = 0

        if itemEx.itemid == 6553 then
                reward = 2447
                count = 1

        elseif itemEx.itemid == 7407 then
                reward = 8932
                count = 1

        elseif itemEx.itemid == 8929 then
                reward = 7429
                count = 1

        elseif itemEx.itemid == 9970 then
                reward = 8909
                count = 100
                isStacked = 1

        elseif itemEx.itemid == 5669 then
                reward = 8910
                count = 1

        elseif itemEx.itemid == 2157 then
                reward = 8853
                count = 100
                isStacked = 1

        elseif itemEx.itemid == 9969 then
                reward = 8890
                count = 1

end

        if reward > 1000 and not(isPlayer(itemEx.uid)) then

        if isStacked == 1 then
                if itemEx.type >= count then
                        isStacked = 2
                else
                doPlayerSendCancel(cid, "You do not have enough material. You need " .. count .. " " .. getItemNameById(itemEx.itemid) .. " to upgrade.")
        end
                else
                        isStacked = 2
                                end

                if isStacked == 2 then
        doRemoveItem(item.uid, 1)
        doChangeTypeItem(itemEx.uid, 1)
                doTransformItem(itemEx.uid, reward)
                doSendMagicEffect(toPosition, 40)
                doSendAnimatedText(getPlayerPosition(cid), "SUCCESS!", 156)
                reward = 0
                isStacked = 0
        end
end
return TRUE
end

and then add

Code:
<action itemid="8310" script="pro_upgrade.lua"/>


kokokoko suggested instead of an ankh to use neutral matter id 8310, since it needed a Use With. Kokokoko has tested this on his server which was tfs 0.3.1

And Ive loaded it on my server, no errors in loading the script. i try neutral matter with 6553 (gore howl) and it doesn't change into the item i wanted, doesn't give me a error using the neutral matter, and no error in the server. I then went through the lua_functions since kokokoko suggested to search the lua functions to make sure they existed on tfs 2. So anyone that could possibly work with me to making this working for tfs 2, any ideas at all

Thanks in advance,
and ofcourse Rep+
 
Back
Top