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

Storage / Advance

ximishe

New Member
Joined
Mar 23, 2010
Messages
49
Reaction score
1
I have small problem. I made my own blacksmith skill but..

function onSay(cid, words, param)
if (getPlayerStorageValue(cid, 30400) == 0) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need to learn recpie')
elseif getPlayerItemCount(cid, 2195) == 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'No materials for this recpie')
elseif (getPlayerStorageValue(cid, 30400) == 1) and getPlayerItemCount(cid, 2195) >= 1 then
doSendMagicEffect(getPlayerPosition(cid),12)
doPlayerAddItem(cid,2400,1)
doPlayerRemoveItem(cid,2195,1)
doPlayerSendTextMessage(cid,22,"you created magic sword!")
end
return 1
end

can someone edit my script?
I wanna add this:
1. When item making then storageid going +1, like skill up in proffesion + text "you advanced in blacksmithing"
2. Storageid / skill maximum is level 200. Later no advances.

I hope this is possible here. Recipe needs lv 30 blacksmithing so... needs storage 30430 - 30600 no higher.. bcs other quest would make skills max :p
 
Hey men thanks, but i have one question.. Max skill is 200? or no limited skill in this script?
ahh.. i wrote not all and i see this :) < > :D Thanks men

One question this all skills are saved in one storage number right? but this numer have own Value ?
So i can use 30401 now to make next profession storage?

Hmm i have next problem, i starting scripting so... I don't know advanced (,; etc... :p
I wanna make a talkaction to say !skills
Then script looking for:
Storage 30400 - blacksmithing
Storage 30401 - letherworking
and more..
But idk how to do it... to make script to say if 30400 example with value 9 then "Blacksmithing 9".

:D

I made own commands for every profession like:
!blacksmithing
!leatherworking
etc :)
 
Last edited by a moderator:
talkactions/scripts/checkstats.lua:
Lua:
function onSay(cid, words, param, channel)
local MAXLV = 200 -- What is the max level of blacksmith and leather working?
local blacksmith = 30400
local leatherwork = 30401
local getB = getPlayerStorageValue(cid, blacksmith)
local getL = getPlayerStorageValue(cid, leatherwork)
if getL > -1 and getB > -1 then
	doPlayerPopupFYI(cid, "Blacksmithing lv. ".. getB .."/".. MAXLV .."\n Leather working lv. ".. getL .."/".. MAXLV ..".")
elseif getL > -1 then
	doPlayerPopupFYI(cid, "Leather working lv. ".. getL .."/".. MAXLV ..".")
elseif getB > -1 then
	doPlayerPopupFYI(cid, "Blacksmithing lv. ".. getB .."/".. MAXLV ..".")
else
	doPlayerPopupFYI(cid, "You don't have any profession.")
end
	return true
end

actions/scripts/recipe.lua:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local S = 30400
local getS = getPlayerStorageValue(cid,S)
	if getS < 0 then
		setPlayerStorageValue(cid, S, 0)
		doPlayerSendTextMessage(cid, 22, "You can now smith!")
		doSendMagicEffect(getCreaturePosition(cid), 12)
		doRemoveItem(item.uid,1)
	else
		doSendMagicEffect(getCreaturePosition(cid), 2)
		doPlayerSendCancel(cid, "You can already smith.")
	end
	return true
end

talkactions/scripts/blacksmith.lua:
Lua:
function onSay(cid, words, param, channel)
	-- Config --
	local createItem = "Plate Armor"
	local needItem = "Iron Ore"
	local needCount = 20
	local Hammer = "Iron Hammer"
	local s = 30400
	local getB = getPlayerStorageValue(cid,s)
	local MAXLV = 200
	-- Config --
		if getB >= 0 then
			if getPlayerItemCount(cid, getItemIdByName(needItem)) >= 1 then
				if getPlayerItemCount(cid, getItemIdByName(Hammer)) >= 1 then
					if getPlayerStorageValue(cid, s) <= MAXLV -1 then
						doPlayerRemoveItem(cid, getItemIdByName(needItem), needCount)
						setPlayerStorageValue(cid, s, getB+1)
						doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have smithed ".. getItemArticleById(getItemIdByName(createItem)) .." ".. getItemNameById(getItemIdByName(createItem)) .."!")
						doItemSetAttribute(doPlayerAddItem(cid, getItemIdByName(createItem), 1), 'description', "This [".. createItem .."] was made by: "..getPlayerName(cid).."")
					else
						doSendMagicEffect(getCreaturePosition(cid), 2)
						doPlayerSendCancel(cid, "You have reached the max level.")
					end
				else
					doSendMagicEffect(getCreaturePosition(cid), 2)
					doPlayerSendCancel(cid, "".. getItemArticleById(getItemIdByName(Hammer)).." ".. getItemNameById(getItemIdByName(Hammer)) .." required.")
				end
			else
				doSendMagicEffect(getCreaturePosition(cid), 2)
				doPlayerSendCancel(cid, "You don't have the required item(s). (".. needCount .." ".. getItemNameById(getItemIdByName(needItem)) .."s).")
			end
		else
			doSendMagicEffect(getCreaturePosition(cid), 2)
			doPlayerSendCancel(cid, "You need to learn the recipe.")
		end
	return true
end

This CAN be done better.
 
Last edited:
Oh thanks :d
But:
talkactions/scripts/blacksmith.lua:
'then' expected near '=' - and it can't load script ;/
 
Last edited:
Somethink not work ;/
I can't learn recpie, i made this on paper action on use..
Also when i trying to use !smith plate armor all time "you need to learn recpie" but i have this storage by my own script,
and when i checking my skills its all time 1 becouse it taking storage id not value ;/

I think it should be some like this:
local blacksmith = 30400
local getB = getPlayerStorageValue(cid, blacksmith) < this i think it taking number of storage so always be 30400, but how to make to take value number from this storagevalue?
fromPlayerStorageValue(cid, 30400, get newvalue do it is possible to do some like this?
 
Last edited:
Nono, it is taking the value. You just need to say "!smith" if it is written <words="!smith;/smith"/> in talkactions.xml.

Post all your scripts. The both talkactions and the action script.
 
Talkactions:
<talkaction words="!smith plate armor" script="blacksmithing/platearmor.lua"/> This is for your script blacksmith.lua
<talkaction words="!skills" script="profs.lua"/> This is for your checkstats.lua
Actions:
<action itemid="2550" event="script" value="professions.lua"/> this is for your recipe.lua

I changed also recipe lua to:
Lua:
function onSay(cid, words, param, channel)
	if getPlayerStorageValue(cid, 30400) < 0 then
		setPlayerStorageValue(cid, 30400, 0)
		doPlayerSendTextMessage(cid, 22, "You can now smith!")
	else
		doPlayerSendCancel(cid, "You can already smith.")
	end
	return true
end

And when i use this i can smith sword by my script:
local storage = 30400
Lua:
function onSay(cid, words, param, channel)
	if getPlayerStorageValue(cid, storage) < 0 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to learn blacksmithing first.")
		doSendMagicEffect(getPlayerPosition(cid),12)
		return true
	end
 
	if getPlayerItemCount(cid, 2225) < 2 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have the correct materials.")
		return true
	end
 
	if getPlayerStorageValue(cid, storage) < 0 and getPlayerStorageValue(cid, storage) > 10 and doPlayerRemoveItem(cid, 2225, 2) then
		doPlayerAddItem(cid, 2376, 1)
		setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 1)
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have crafted the sword!")
			return true
	end
		if getPlayerStorageValue(cid, storage) > 0 and getPlayerStorageValue(cid, storage) < 201 and doPlayerRemoveItem(cid, 2225, 2) then
		doPlayerAddItem(cid, 2376, 1)
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have crafted the sword!")
			return true
	end
	return true
end

But your script on Plate armor not work ;/
I know if skill on checkstats not work to.. Bcs, i made script to make steel shield but from skill 4, then..
I can't make shield, but when i make 3x sword then i can make shield to so my scripts works.

-----------------
edited:

Sry men i changed my script it was some wrong hah :D Your script on checkstats work! And work greatly thanks :p
 
Last edited:
Back
Top