- Strona Główna Belxena 8.4 RPG http://www.belxena.pun.pl/index.php - Skrypty Lua & XML http://www.belxena.pun.pl/viewforum.php?id=13 - [8.4] Hodowanie kwiatów http://www.belxena.pun.pl/viewtopic.php?id=19 |
Macgates - 2009-05-01 23:00:39 |
Twórcą scryptów jest AGS z Meksyku. Kod: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. Kod:<movevent event="AddItem" tileitem="1" itemid="7655" script="seeds.lua" /> 3) Teraz skocz jeszcze dalej do movements/scripts/ Kod: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 3) Teraz skocz jeszcze dalej do movements/scripts/ Kod: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. Kod:<action itemid="7734" script="flowerpot.lua" /> 5) Przejdź do folderu actions/scripts Kod: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 |