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

Solved How to make it so you "use" a pick "on" item

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
What do you have to put in actions.xml and what do you have to put in the script to make it so you have to "use with" a pick on "the item" to make the function go through.

This is what the first few lines of my script look like

Code:
if item.itemid == bigrock and getPlayerItemCount(cid,2553) >= 1 and getPlayerSkill(cid, SKILL_FIST) >= 1 then                                   
			doPlayerAddSkillTry(cid, SKILL_FIST, 10)

I have in it that you need a pick in your backpack but I want to make it so you have to use the pick on the rock itself not just "use" the rock.'

Here is my actions.xml line

Code:
	<action actionid="4001" script="lightblue1.lua"/>

And yes, I did try adding "if item.uid = 2553 and item.itemid == bigrock....." and it did not work. I tried putting itemid = 2553 in actions.xml and that didnt work :(
 
Last edited:
LUA:
if item.actionid == 2553 and getPlayerItemCount(cid,2553) >= 1 and getPlayerSkill(cid, SKILL_FIST) >= 1 then                                   
			doPlayerAddSkillTry(cid, SKILL_FIST, 10)
Also try to use action ID on your rock.

LUA:
 <action itemid="2553" script="lightblue1.lua"/>

Actually i have no idea if it works, give it a try.

You cud post your whole script and i knew better.
 
Here is my actions.xml
Code:
	<!-- Mining System -->
	<action actionid="4001" script="lightblue1.lua"/>
Here is

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

bigrock = 8634
smallrock = 8638
posa = {x=1094,y=1060,z=6}                                                                                        		
chance = math.random(0,100000)

function goto(cid, item)
	--addEvent(restore, (1000 * 60 * 148),(1000 * 60 * 296) , cid) 
	addEvent(restore, (math.random(1000,2000)),(math.random(3000,10000)), cid) --test mode
	return true
end

function restore(cid, item1, item2)
		doRemoveItem(getTileItemById(posa, smallrock).uid)         
		doCreateItem(bigrock,posa)	                              
		doSetItemActionId(getTileItemById(posa, bigrock).uid, 4001) 												
			return true
end	

if item.itemid == bigrock and getPlayerItemCount(cid,2553) >= 1 and getPlayerSkill(cid, SKILL_FIST) >= 1 then                                   
			doPlayerAddSkillTry(cid, SKILL_FIST, 10)
			doRemoveItem(getTileItemById(posa, bigrock).uid)
			doCreateItem(smallrock,posa)
	
			addEvent(goto, 1, 5, cid)                               --jump to "goto"
			doSendMagicEffect(getPlayerPosition(cid), 13)	        --send magic effect	
			
if chance >= 95000 and chance <= 100000 then 
	doPlayerRemoveItem(cid, 2553, 1)
doCreatureSay(cid, "Uh oh, your pick broke!", TALKTYPE_ORANGE_1)
return false
end
if chance >= 50000 and chance <= 94999 then
	doPlayerAddItem(cid, 2255,1)
doCreatureSay(cid, "You found some trashy copper.", TALKTYPE_ORANGE_1)	
return false
end
if chance >= 20000 and chance <= 49999 then
	doPlayerAddItem(cid, 2254,1)
doCreatureSay(cid, "You found some dirty copper.", TALKTYPE_ORANGE_1) 
return false
end
if chance >= 5000 and chance <= 19999 then
	doPlayerAddItem(cid, 2253,1)
doCreatureSay(cid, "You found some dull copper.", TALKTYPE_ORANGE_1) 
return false
end
if chance >= 0 and chance <= 4999 then
	doPlayerAddItem(cid, 2252,1)
doCreatureSay(cid, "You found some decent copper.", TALKTYPE_ORANGE_1) 	
return false
end	
	
				return true
			end
			
				return true
			end
 
Here is my actions.xml
Code:
	<!-- Mining System -->
	<action actionid="4001" script="lightblue1.lua"/>
Here is

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

bigrock = 8634
smallrock = 8638
posa = {x=1094,y=1060,z=6}                                                                                        		
chance = math.random(0,100000)

function goto(cid, item)
	--addEvent(restore, (1000 * 60 * 148),(1000 * 60 * 296) , cid) 
	addEvent(restore, (math.random(1000,2000)),(math.random(3000,10000)), cid) --test mode
	return true
end

function restore(cid, item1, item2)
		doRemoveItem(getTileItemById(posa, smallrock).uid)         
		doCreateItem(bigrock,posa)	                              
		doSetItemActionId(getTileItemById(posa, bigrock).uid, 4001) 												
			return true
end	

if item.itemid == bigrock and getPlayerItemCount(cid,2553) >= 1 and getPlayerSkill(cid, SKILL_FIST) >= 1 then                                   
			doPlayerAddSkillTry(cid, SKILL_FIST, 10)
			doRemoveItem(getTileItemById(posa, bigrock).uid)
			doCreateItem(smallrock,posa)
	
			addEvent(goto, 1, 5, cid)                               --jump to "goto"
			doSendMagicEffect(getPlayerPosition(cid), 13)	        --send magic effect	
			
if chance >= 95000 and chance <= 100000 then 
	doPlayerRemoveItem(cid, 2553, 1)
doCreatureSay(cid, "Uh oh, your pick broke!", TALKTYPE_ORANGE_1)
return false
end
if chance >= 50000 and chance <= 94999 then
	doPlayerAddItem(cid, 2255,1)
doCreatureSay(cid, "You found some trashy copper.", TALKTYPE_ORANGE_1)	
return false
end
if chance >= 20000 and chance <= 49999 then
	doPlayerAddItem(cid, 2254,1)
doCreatureSay(cid, "You found some dirty copper.", TALKTYPE_ORANGE_1) 
return false
end
if chance >= 5000 and chance <= 19999 then
	doPlayerAddItem(cid, 2253,1)
doCreatureSay(cid, "You found some dull copper.", TALKTYPE_ORANGE_1) 
return false
end
if chance >= 0 and chance <= 4999 then
	doPlayerAddItem(cid, 2252,1)
doCreatureSay(cid, "You found some decent copper.", TALKTYPE_ORANGE_1) 	
return false
end	
	
				return true
			end
			
				return true
			end

kinda oddly scripted i must say.
You can try replacing
LUA:
bigrock = 8634
smallrock = 8638
posa = {x=1094,y=1060,z=6}                                                                                        		
chance = math.random(0,100000)
with this

LUA:
local bigrock = 8634
local smallrock = 8638
local posa = {x=1094,y=1060,z=6}                                                                                        		
local chance = math.random(0,100000)
Or just try this:
LUA:
function onUse(cid, item, frompos, item2, topos)

local bigrock = 8634
local smallrock = 8638
local posa = {x=1094,y=1060,z=6}                                                                                        		
local chance = math.random(0,100000)

function goto(cid, item)
	--addEvent(restore, (1000 * 60 * 148),(1000 * 60 * 296) , cid) 
	addEvent(restore, (math.random(1000,2000)),(math.random(3000,10000)), cid) --test mode
	return true
end

function restore(cid, item1, item2)
		doRemoveItem(getTileItemById(posa, smallrock).uid)         
		doCreateItem(bigrock,posa)	                              
		doSetItemActionId(getTileItemById(posa, bigrock).uid, 4001) 												
			return true
end	

if(isInArray(bigrock, itemEx.itemid)) and getPlayerItemCount(cid,2553) >= 1 and getPlayerSkill(cid, SKILL_FIST) >= 1 then                                   
			doPlayerAddSkillTry(cid, SKILL_FIST, 10)
			doRemoveItem(getTileItemById(posa, bigrock).uid)
			doCreateItem(smallrock,posa)
	
			addEvent(goto, 1, 5, cid)                               --jump to "goto"
			doSendMagicEffect(getPlayerPosition(cid), 13)	        --send magic effect	
			
if chance >= 95000 and chance <= 100000 then 
	doPlayerRemoveItem(cid, 2553, 1)
doCreatureSay(cid, "Uh oh, your pick broke!", TALKTYPE_ORANGE_1)
return false
end
if chance >= 50000 and chance <= 94999 then
	doPlayerAddItem(cid, 2255,1)
doCreatureSay(cid, "You found some trashy copper.", TALKTYPE_ORANGE_1)	
return false
end
if chance >= 20000 and chance <= 49999 then
	doPlayerAddItem(cid, 2254,1)
doCreatureSay(cid, "You found some dirty copper.", TALKTYPE_ORANGE_1) 
return false
end
if chance >= 5000 and chance <= 19999 then
	doPlayerAddItem(cid, 2253,1)
doCreatureSay(cid, "You found some dull copper.", TALKTYPE_ORANGE_1) 
return false
end
if chance >= 0 and chance <= 4999 then
	doPlayerAddItem(cid, 2252,1)
doCreatureSay(cid, "You found some decent copper.", TALKTYPE_ORANGE_1) 	
return false
end	
	
				return true
			end
			
				return true
			end
 
I repped you Wavoz but it still does not solve my problem where I want the player to have to take the pick and "use with" it on the rock instead of just using the rock and having a pick on them.
 
I repped you Wavoz but it still does not solve my problem where I want the player to have to take the pick and "use with" it on the rock instead of just using the rock and having a pick on them.

LUA:
 <action itemid="2553" script="lightblue1.lua"/>

Didn't work like this?
 
I put that in my actions.xml and put this

Code:
if item.itemid == bigrock and item.aid == 4001 and getPlayerItemCount(cid,2553) >= 1 and getPlayerSkill(cid, SKILL_FIST) >= 1 then

in my script and i get no errors and nothing happens when I use the pick on the crystal.
 
Back
Top