• 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] Making itiems

zajacmp3

New Member
Joined
Jan 5, 2009
Messages
35
Reaction score
0
Location
Poland, Gdansk
Heya Guys ; D
You helped me a lot last time when I asked you for a script for removing the wall so maybe you could help me now : )
I'm too dump to make this script (still learning).
I have an idea and I wish to use it on my OTS : )
Its a system where a player must make a weapon for himself not loot it or buy.
It should be simple for some of You.
Here is an example how should it work.
beztytuuhu0.jpg

When I put this itiems and pull the lever on anvil should appear a sword and the itiems dissapear.

I fell confused to ask for this : P Can it work anyway? XD
 
Heya Guys ; D
You helped me a lot last time when I asked you for a script for removing the wall so maybe you could help me now : )
I'm too dump to make this script (still learning).
I have an idea and I wish to use it on my OTS : )
Its a system where a player must make a weapon for himself not loot it or buy.
It should be simple for some of You.
Here is an example how should it work.
beztytuuhu0.jpg

When I put this itiems and pull the lever on anvil should appear a sword and the itiems dissapear.

I fell confused to ask for this : P Can it work anyway? XD

so you want the parchment and the ?hell steel? to disappear when the lever is pulled and a weapon appear on the anvil?, how many weapons are you doing to have available to make? its completely possible to make..i'll work on a sample for you and post it
 
Maybe this work...

Code:
[COLOR="Blue"][COLOR="DarkGreen"]function[/COLOR] onUse[COLOR="DarkGreen"]([/COLOR]cid[COLOR="DarkGreen"],[/COLOR] item[COLOR="DarkGreen"],[/COLOR] fromPosition[COLOR="DarkGreen"],[/COLOR] itemEx[COLOR="DarkGreen"],[/COLOR] toPosition[COLOR="DarkGreen"])[/COLOR]

local steelID [COLOR="DarkGreen"]=[/COLOR] 5887 --piece of royal steel
local parchmentID [COLOR="DarkGreen"]=[/COLOR] 5956 --parchment

[COLOR="DarkGreen"]if[/COLOR] item.uid [COLOR="DarkGreen"]==[/COLOR] 15000 and item.itemid [COLOR="DarkGreen"]==[/COLOR] 1945 [COLOR="DarkGreen"]then[/COLOR]

steelPos [COLOR="DarkGreen"]=[/COLOR] [COLOR="DarkGreen"]{[/COLOR]x[COLOR="DarkGreen"]=[/COLOR]10[COLOR="DarkGreen"],[/COLOR] y[COLOR="DarkGreen"]=[/COLOR]51[COLOR="DarkGreen"],[/COLOR] z[COLOR="DarkGreen"]=[/COLOR]7[COLOR="DarkGreen"],[/COLOR] stackpos[COLOR="DarkGreen"]=[/COLOR]2[COLOR="DarkGreen"]}[/COLOR]
parchmentPos [COLOR="DarkGreen"]=[/COLOR] [COLOR="DarkGreen"]{[/COLOR]x[COLOR="DarkGreen"]=[/COLOR]12[COLOR="DarkGreen"],[/COLOR] y[COLOR="DarkGreen"]=[/COLOR]51[COLOR="DarkGreen"],[/COLOR] z[COLOR="DarkGreen"]=[/COLOR]7[COLOR="DarkGreen"],[/COLOR] stackpos[COLOR="DarkGreen"]=[/COLOR]2[COLOR="DarkGreen"]}[/COLOR]

weaponPos [COLOR="DarkGreen"]=[/COLOR] [COLOR="DarkGreen"]{[/COLOR]x[COLOR="DarkGreen"]=[/COLOR]11[COLOR="DarkGreen"],[/COLOR] y[COLOR="DarkGreen"]=[/COLOR]51[COLOR="DarkGreen"],[/COLOR] z[COLOR="DarkGreen"]=[/COLOR]7[COLOR="DarkGreen"],[/COLOR] stackpos[COLOR="DarkGreen"]=[/COLOR]2[COLOR="DarkGreen"]}[/COLOR] --position where the weapon will be created

steel [COLOR="DarkGreen"]=[/COLOR] getThingfromPos[COLOR="DarkGreen"]([/COLOR]steelPos[COLOR="DarkGreen"])[/COLOR]
parchment [COLOR="DarkGreen"]=[/COLOR] getThingfromPos[COLOR="DarkGreen"]([/COLOR]parchmentPos[COLOR="DarkGreen"])[/COLOR]

[COLOR="DarkGreen"]if[/COLOR] steel.itemid [COLOR="DarkGreen"]==[/COLOR] steelID [COLOR="DarkGreen"]and[/COLOR] parchment.itemid [COLOR="DarkGreen"]==[/COLOR] parchmentID [COLOR="DarkGreen"]then[/COLOR]

	doTransformItem[COLOR="DarkGreen"]([/COLOR]item.uid[COLOR="DarkGreen"],[/COLOR] item.itemid[COLOR="DarkGreen"]+[/COLOR]1[COLOR="DarkGreen"])[/COLOR]
	doRemoveItem[COLOR="DarkGreen"]([/COLOR]steel.uid[COLOR="DarkGreen"],[/COLOR] 1[COLOR="DarkGreen"])[/COLOR]
	doRemoveItem[COLOR="DarkGreen"]([/COLOR]parchment.uid[COLOR="DarkGreen"],[/COLOR] 1[COLOR="DarkGreen"])[/COLOR]
	doCreateItem[COLOR="DarkGreen"]([/COLOR]ID_OF_WEAPON[COLOR="DarkGreen"],[/COLOR]1[COLOR="DarkGreen"],[/COLOR]weaponPos[COLOR="DarkGreen"])[/COLOR]
else
	doPlayerSendTextMessage[COLOR="DarkGreen"]([/COLOR]cid[COLOR="DarkGreen"],[/COLOR] MESSAGE_STATUS_CONSOLE_BLUE[COLOR="DarkGreen"],[/COLOR] [COLOR="Red"]"You need a [COLOR="Blue"]" .. getItemNameById[COLOR="DarkGreen"]([/COLOR]steelID[COLOR="DarkGreen"])[/COLOR] .. "[/COLOR] and a [COLOR="Blue"]" .. getItemNameById[COLOR="DarkGreen"]([/COLOR]parchmentID[COLOR="DarkGreen"])[/COLOR] .. "[/COLOR] to create a weapon."[/COLOR][COLOR="DarkGreen"])[/COLOR]

		end
	end

else[COLOR="DarkGreen"]if[/COLOR] item.uid [COLOR="DarkGreen"]==[/COLOR] 15000 [COLOR="DarkGreen"]and[/COLOR] item.itemid [COLOR="DarkGreen"]==[/COLOR] 1946 [COLOR="DarkGreen"]then[/COLOR]

	doTransformItem[COLOR="DarkGreen"]([/COLOR]item.uid[COLOR="DarkGreen"],[/COLOR] item.itemid[COLOR="DarkGreen"]-[/COLOR]1[COLOR="DarkGreen"])[/COLOR]

end[/COLOR]
 
Sounds like an easy but extremely nice beginner script. I have no time right now to try scripting it myself at the moment. But it's surely good for learning basic lua usage.
 
Yep i have an error : / I tried to fix this but it over my mind : <
ERROR
[14/02/2029 14:09:30] Warning: [Event::loadScript] Can not load script. data/actions/scripts/new/makeitiem.lua
[14/02/2029 14:09:30] data/actions/scripts/new/makeitiem.lua:28: 'end' expected (to close 'function' at line 1) near 'elseif'

Any ideas? And thanks for help : ) I'll give u rep its all I can do for u
 
Yep i have an error : / I tried to fix this but it over my mind : <
ERROR
[14/02/2029 14:09:30] Warning: [Event::loadScript] Can not load script. data/actions/scripts/new/makeitiem.lua
[14/02/2029 14:09:30] data/actions/scripts/new/makeitiem.lua:28: 'end' expected (to close 'function' at line 1) near 'elseif'

Any ideas? And thanks for help : ) I'll give u rep its all I can do for u

assuming its the same code that was posted above
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local steelID = 5887 --piece of royal steel
local parchmentID = 5956 --parchment

if item.uid == 15000 and item.itemid == 1945 then

	steelPos = {x=10, y=51, z=7, stackpos=2}
	parchmentPos = {x=12, y=51, z=7, stackpos=2}

	weaponPos = {x=11, y=51, z=7, stackpos=2} --position where the weapon will be created

	steel = getThingfromPos(steelPos)
	parchment = getThingfromPos(parchmentPos)

	if steel.itemid == steelID and parchment.itemid == parchmentID then

		doTransformItem(item.uid, item.itemid+1)
		doRemoveItem(steel.uid, 1)
		doRemoveItem(parchment.uid, 1)
		doCreateItem(ID_OF_WEAPON,1,weaponPos)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need a " .. getItemNameById(steelID) .. " and a " .. getItemNameById(parchmentID) .. " to create a weapon.")

	end

elseif item.uid == 15000 and item.itemid == 1946 then
	doTransformItem(item.uid, item.itemid-1)
end
return TRUE
end

not sure if his script either works, but that wont give you your error anymore
 
I had to change stack pos to number "3" from 2 to get this working.

But i imagined this system as one that player can make few itiems under one lever from other materials. I tried to modify this script (still learning, too dump) but i maked a mess : D
My modifications
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition) 

local steelID = 5887 --piece of royal steel 
local parchmentID = 5956 --parchment 
local hellsteelID = 5888
local paperID = 7703

if item.uid == 6000 and item.itemid == 1945 then 

    steelPos = {x=566, y=826, z=6, stackpos=3} 
    parchmentPos = {x=566, y=824, z=6, stackpos=3}
    hellsteelPos = {x=566, y=826, z=6, stackpos=3}
    paperPos = {x=566, y=824, z=6, stackpos=3}

    weaponPos = {x=566, y=825, z=6, stackpos=3} --position where the weapon will be created 

    steel = getThingfromPos(steelPos)
    parchment = getThingfromPos(parchmentPos)
    hellsteel = getThingfromPos(hellsteelPos)
    paper = getThingfromPos(paperPos)

    if steel.itemid == steelID and parchment.itemid == parchmentID then 

        doTransformItem(item.uid, item.itemid+1) 
        doRemoveItem(steel.uid, 1) 
        doRemoveItem(parchment.uid, 1) 
        doCreateItem(2377,1,weaponPos)
        
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need a " .. getItemNameById(steelID) .. " and a " .. getItemNameById(parchmentID) .. " to create a weapon.") 
    end

    else
    if hellsteel.itemid == hellsteelID and paper.itemid == peprID then

        doTransformItem(item.uid, item.itemid+1) 
        doRemoveItem(hellsteel.uid, 1) 
        doRemoveItem(paper.uid, 1) 
        doCreateItem(2382,1,weaponPos) 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need a " .. getItemNameById(hellsteelID) .. " and a " .. getItemNameById(paperID) .. " to create a weapon.") 

    end 

elseif item.uid == 6000 and item.itemid == 1946 then 
    doTransformItem(item.uid, item.itemid-1) 
end 
return TRUE 
end

A bit of a stupid ; D after my modification a had this error (maybe it will be usefull, dunno)
[14/02/2029 17:22:39] Warning: [Event::loadScript] Can not load script. data/actions/scripts/new/makeitiem.lua
[14/02/2029 17:22:39] data/actions/scripts/new/makeitiem.lua:45: 'end' expected (to close 'if' at line 8) near 'elseif'
And again I ask you to help me : P And if you could say what did i done wrong in my modification. Maybe i have bad course of reflection?
 
Back
Top