Jest to moja pierwsza publikacja skryptu (ale nie pierwszy skrypt), dlatego liczę na konstruktywną krytykę ;)
Postanowiłem napisać dla Was trzy przedmioty znane z byłych serwerów Sasira (Elestium itd.) - Black Skull, Addon Doll oraz Infinity Potion.
Bez zbędnego gadania przedstawiam skrypty:
Item: Addon Doll (ID: 9693)
Funkcja: Po użyciu komendy "!buyaddon <nazwa addona>" (np. !addon Mage) dodaje nam wszystkie addony z tego setu, po czym usuwa lalkę
W data/talkactions/talkations.xml dodaj:
Kod:
<talkaction words="!addon" event="script" value="addondoll.lua"/>
Kod:
function onSay(cid, words, param)
local femaleOutfits = { ["citzen"]={136}, ["hunter"]={137}, ["mage"]={138}, ["knight"]={139}, ["noblewoman"]={140}, ["summoner"]={141}, ["warrior"]={142}, ["barbarian"]={147}, ["druid"]={148}, ["wizard"]={149}, ["oriental"]={150}, ["pirate"]={155}, ["assassin"]={156}, ["beggar"]={157}, ["shaman"]={158}, ["norsewoman"]={252}, ["nightmare"]={269}, ["jester"]={270}, ["brotherhood"]={270}, ["demonhunter"]={288}, ["yalaharian"]={324} }
local maleOutfits = { ["citzen"]={128}, ["hunter"]={129}, ["mage"]={130}, ["knight"]={131}, ["nobleman"]={132},["summoner"]={133}, ["warrior"]={134}, ["barbarian"]={143}, ["druid"]={144}, ["wizard"]={145}, ["oriental"]={146}, ["pirate"]={151}, ["assassin"]={152}, ["beggar"]={153}, ["shaman"]={154}, ["norsewoman"]={251}, ["nightmare"]={268}, ["jester"]={273}, ["brotherhood"]={278}, ["demonhunter"]={289}, ["yalaharian"]={325} }
local msg = {"Command requires GOOD param!", "You dont have Addon Doll!", "Bad param!", "Full Addon Set sucesfully added!"}
local param = string.lower(param)
if(getPlayerItemCount(cid, 9693) > 0) then
if(param ~= "" and maleOutfits[param] and femaleOutfits[param]) then
doPlayerRemoveItem(cid, 9693, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[4])
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
if(getPlayerSex(cid) == 0)then
doPlayerAddOutfit(cid, femaleOutfits[param][1], 3)
else
doPlayerAddOutfit(cid, maleOutfits[param][1], 3)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[1])
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg[2])
end
end
Funkcja: Usuwa wszystkie fragi, po czym zmienia się w zwykłego skulla.
W data/actions/actions.xml dodaj:
Kod:
<action itemid="9969" event="script" value="tools/blackskull.lua"/>
Kod:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerRedSkullTicks(cid) == 0) then
doCreatureSay(cid, "You dont have any frags!", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, "Frags sucesfully removed.", TALKTYPE_ORANGE_1)
doPlayerSetRedSkullTicks(cid, -getPlayerRedSkullTicks(cid))
doTransformItem(item.uid, 2320)
end
end
Funkcja: Jako jeden potion dodaje graczowi many w zależności od profesji i poziomu. Moje najlepsze dzieło jak do tej pory.
W data/actions/actions.xml dodaj:
Kod:
<action itemid="7488" event="script" value="liquids/infinitypotion.lua" allowfaruse="1"/>
Kod:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
function onUse(cid, item, fromPosition, itemEx, toPosition)
local manaAdd = {
["Sorcerer"]={math.random(75, 125), math.random(180, 220), math.random(280, 320)}, ["Druid"]={math.random(75, 125), math.random(180, 220), math.random(280, 320)}, ["Paladin"]={math.random(75, 125), math.random(180, 220), math.random(180, 220)}, ["Knight"]={math.random(75, 125), math.random(75, 125), math.random(75, 125)},
["Master Sorcerer"]={math.random(75, 125), math.random(180, 220), math.random(280, 320)}, ["Elder Druid"]={math.random(75, 125), math.random(180, 220), math.random(280, 320)}, ["Royal Paladin"]={math.random(75, 125), math.random(180, 220), math.random(180, 220)}, ["Elite Knight"]={math.random(75, 125), math.random(75, 125), math.random(75, 125)}
}
if(isPlayer(itemEx.uid) == TRUE) then
if(hasCondition(itemEx.uid, CONDITION_EXHAUST) == FALSE) then
if(getPlayerLevel(itemEx.uid) < 50) then
doCreatureAddMana(itemEx.uid, manaAdd[getPlayerVocationName(itemEx.uid)][1])
elseif(getPlayerLevel(itemEx.uid) >= 50) and (getPlayerLevel(itemEx.uid) < 80) then
doCreatureAddMana(itemEx.uid, manaAdd[getPlayerVocationName(itemEx.uid)][2])
else
doCreatureAddMana(itemEx.uid, manaAdd[getPlayerVocationName(itemEx.uid)][3])
end
doAddCondition(itemEx.uid, exhaust)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getCreaturePosition(itemEx.uid), "Aaaah...", TEXTCOLOR_DARKYELLOW)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
else
return FALSE
end
end
Jeżeli spodobały Ci się skrypty lub masz dla mnie jakąś radę - napisz. Będę naprawdę wdzięczny. (chyba, że chcesz od razu przelać kasę na konto ;pp)
Skrypty są MOJEGO autorstwa. Nie zezwalam na umieszczanie na innych forach bez mojej zgody.
Dodam jeszcze, że działanie tablic aso~ wyjaśnił mi Tairens, a Ersiu pomógł w ósmej linijce Addon Dolla ;) Pozdro chłopaki.
edit:
Bym zapomniał - skrypty pisane pod TFS 0.3.3, były testowane.
Pozdrawiam, Visher
Zakładki