Skrypt nie mój
Krótko o działaniu.
Aby rozpocząć cały proces hodowania roślinki musisz położyć nasionka na doniczce. Następnie użyć konewki na świeżo zasadzonych nasionkach w doniczce (tzn. podlać). Następnie trzeba podlewać kwiatuszka co 24h. Są trzy etapy rozwoju kwiatka. Nie koniecznie po każdym podlaniu kwiatek podrośnie (ehh, natura). Gdy już rozwinie się do pięknego kwiatu wystarczy jak podlejesz go raz na 3 dni. Jak zapomnisz - uschnie.
Schemat rozwoju wygląda tak:
1) Zacznij od edycji pliku items.xml
Chodzi tu głównie o ustawienie czasu w jakim roślinki się rozwijają oraz krótka informacja o itemie.
Spoiler:
<item id="7655" name="flower pot">
<attribute key="description" value="You should try planting some seeds."/>
<attribute key="weight" value="150"/>
</item>
<item id="7665" name="flower pot">
<attribute key="description" value="Something has been planted in there, but you cannot see what it is yet."/>
<attribute key="weight" value="150"/>
</item>
<item id="7670" name="flower pot">
<attribute key="description" value="The plant in there sprouted, but only gardeners might recognise what it will develop into."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7678"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7673" name="flower pot">
<attribute key="description" value="Something has been planted in there, but you cannot see what it is yet."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7679"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7674" name="withered plant">
<attribute key="description" value="This plant urgently needs some water, else it will wither away and disappear completely."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7675" name="withered plant">
<attribute key="description" value="This plant urgently needs some water, else it will wither away and disappear completely."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7676" name="withered plant">
<attribute key="description" value="This plant urgently needs some water, else it will wither away and disappear completely."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7677" name="withered plant">
<attribute key="description" value="This plant urgently needs some water, else it will wither away and disappear completely."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="0"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7678" name="flower pot">
<attribute key="description" value="The plant in there sprouted, but only gardeners might recognise what it will develop into."/>
<attribute key="weight" value="150"/>
</item>
<item id="7679" name="flower pot">
<attribute key="description" value="Something has been planted in there, but you cannot see what it is yet."/>
<attribute key="weight" value="150"/>
</item>
<item id="7680" name="flower pot">
<attribute key="description" value="The plant in it seems to be a lizard tongue fern."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7681"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7681" name="flower pot">
<attribute key="description" value="The plant in it seems to be a lizard tongue fern."/>
<attribute key="weight" value="150"/>
</item>
<item id="7682" name="flower pot">
<attribute key="description" value="The plant in it seems to be a dryad's heart flower."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7683"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7683" name="flower pot">
<attribute key="description" value="The plant in it seems to be a dryad's heart flower."/>
<attribute key="weight" value="150"/>
</item>
<item id="7684" name="flower pot">
<attribute key="description" value="The plant in it seems to be a midnight bloom flower."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7685"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7685" name="flower pot">
<attribute key="description" value="The plant in it seems to be a midnight bloom flower."/>
<attribute key="weight" value="150"/>
</item>
<item id="7686" name="flower pot">
<attribute key="description" value="The plant in it seems to be an ember queen flower."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7687"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7687" name="flower pot">
<attribute key="description" value="The plant in it seems to be an ember queen flower."/>
<attribute key="weight" value="150"/>
</item>
<item id="7688" name="flower pot">
<attribute key="description" value="There is a fully grown lizard tongue plant in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7689"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7689" name="flower pot">
<attribute key="description" value="There is a fully grown lizard tongue plant in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7674"/>
<attribute key="duration" value="259200"/>
</item>
<item id="7690" name="flower pot">
<attribute key="description" value="There is a fully grown dryad's heart flower in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7691"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7691" name="flower pot">
<attribute key="description" value="There is a fully grown dryad's heart flower in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7675"/>
<attribute key="duration" value="259200"/>
</item>
<item id="7692" name="flower pot">
<attribute key="description" value="There is a fully grown midnight bloom flower in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7693"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7693" name="flower pot">
<attribute key="description" value="There is a fully grown midnight bloom flower in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7676"/>
<attribute key="duration" value="259200"/>
</item>
<item id="7694" name="flower pot">
<attribute key="description" value="There is a fully grown ember queen flower in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7695"/>
<attribute key="duration" value="86400"/>
</item>
<item id="7695" name="flower pot">
<attribute key="description" value="There is a fully grown ember queen flower in it."/>
<attribute key="weight" value="150"/>
<attribute key="decayTo" value="7677"/>
<attribute key="duration" value="259200"/>
</item>
2) Następnie przejdź do folderu movements.
Otwórz movements.xml i dodaj gdzie chcesz:
Spoiler:
<movevent event="AddItem" tileitem="1" itemid="7655" script="seeds.lua" />
3) Teraz skocz jeszcze dalej do movements/scripts/
Utwórz tu plik seeds.lua, a jako jego zawartość wklej:
Spoiler:
function onAddItem(moveitem, tileitem, position)
if tileitem.itemid == 7655 then
doRemoveItem(moveitem.uid,1)
doTransformItem(tileitem.uid,tileitem.itemid+10)
doSendMagicEffect(position,CONST_ME_MAGIC_BLUE)
end
return 1
end
4) Teraz pora na actions.
Przejdź do folderu actions i otwórz plik actions.xml
Wklej tam, również gdzie chcesz:
Spoiler:
<action itemid="7734" script="flowerpot.lua" />
5) Przejdź do folderu actions/scripts
i utwórz plik flowerpot.lua, a w nim:
Spoiler:
local CHANCES = 50
local WATERINGCAN_ID = 7734
local WATERED = {7673, 7670, 7680, 7682, 7684, 7686, 7688, 7690, 7992, 7994}
local PLANTSPECIES = {7680, 7682, 7684, 7682}
local PLANTADVANCES = {[7679] = {7670, 7673}, [7681] = {7689, 7680}, [7683] = {7691, 7682}, [7685] = {7693, 7684}, [7687] = {7695, 7686}}
local LASTSTADIUM = {7689, 7691, 7693, 7695}
local WHITEREDPLANTS = {[7674] = 7689, [7675] = 7691, [7676] = 7693, [7677] = 7695}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local RANDOM = math.random(100)
if WHITEREDPLANTS[itemEx.itemid] ~= nil then
doCreatureSay(cid,"You finally remembered to water your plant and it recovered.",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,WHITEREDPLANTS[itemEx.itemid])
elseif itemEx.itemid == 7655 then
doCreatureSay(cid,"You should plant some seeds first.",TALKTYPE_ORANGE_1)
elseif itemEx.itemid == 7665 then
doCreatureSay(cid,"You watered your plant.",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,itemEx.itemid+8)
elseif isInArray(WATERED,itemEx.itemid) == TRUE then
doCreatureSay(cid,"Your plant doesn't need water.",TALKTYPE_ORANGE_1)
elseif PLANTADVANCES[itemEx.itemid] ~= nil then
if RANDOM <= CHANCES then
doTransformItem(itemEx.uid,PLANTADVANCES[itemEx.itemid][1])
doCreatureSay(cid,"Your plant has grown to the next stage!",TALKTYPE_ORANGE_1)
else
doTransformItem(itemEx.uid,PLANTADVANCES[itemEx.itemid][2])
doCreatureSay(cid,"You watered your plant.",TALKTYPE_ORANGE_1)
end
elseif itemEx.itemid == 7678 then
if RANDOM <= CHANCES then
doCreatureSay(cid,"Your plant has grown to the next stage!",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,PLANTSPECIES[math.random(4)])
else
doCreatureSay(cid,"You watered your plant.",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,itemEx.itemid-8)
end
elseif isInArray(LASTSTADIUM, itemEx.itemid) == TRUE then
doCreatureSay(cid,"You watered your plant.",TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid,itemEx.itemid-1)
else
return 0
end
doDecayItem(itemEx.uid)
return 1
end
Offline