jestemPolakiem
Advanced User
- Joined
- Jan 1, 2010
- Messages
- 310
- Reaction score
- 21
Upgrade Stone
napisane przez jestemPolakiem
Dla administracji :napisane przez jestemPolakiem
Wiem, ?e owy skrypt znajduj? si? na forum - ale nie dzia?a on pod najnowsz? wersj? klienta (chodzi tutaj o 8.54).
Skrypt napisany w ca?o?ci przeze mnie - nie bazuj? na podstawie tamtego skryptu.
Opis:
Dzia?anie skryptu jest proste, gracz mo?e zdoby? 4 kamienie, kt?re zwi?kszaj? :
- atak broni
- obron? broni
- obron? zbroi
- atak i obron? zbroi
Instalacja skryptu:
- W pliku config.lua, na samym ko?cu dodajemy tak? linijk?
Code:totUpgradeStoneChance = 15
- Wchodzimy w folder data/actions/scripts/ i tworzymy cztery pliki - o takich nazwach: upgstone_atk.lua, upgstone_def.lua, upgstone_arm.lua, upgstone_full.lua. P??niej w ka?dym z nich wklejamy takie skrypty
upgstone_atk.lua
Code:function onUse(PlayerID, item, fromPosition, item2, toPosition) local config = {upgradeStoneChance = (getConfigValue('totUpgradeStoneChance'))} local item_db = {atk = getItemAttribute(item2.uid, "attack"), def = getItemAttribute(item2.uid, "defense"), arm = getItemAttribute(item2.uid, "armor")} if (item2.uid ~= 0) then if (item_db.atk ~= 0) then local randChance = math.random(1, 100) if (config.upgradeStoneChance > randChance) then doItemSetAttribute(item2.uid, "attack", item_db.atk + 1) doSendAnimatedText(fromPosition, "^^ ^^", 154) doSendMagicEffect(toPosition, 28) doRemoveItem(item.uid, 1) return true else doRemoveItem(item.uid, 1) doPlayerSendTextMessage(PlayerID, MESSAGE_STATUS_CONSOLE_BLUE, "Nie powiodlo sie, sprobuj ponownie!") doSendMagicEffect(toPosition, 0) return false end else return false end end return false end
Code:function onUse(PlayerID, item, fromPosition, item2, toPosition) local config = {upgradeStoneChance = (getConfigValue('totUpgradeStoneChance'))} local item_db = {atk = getItemAttribute(item2.uid, "attack"), def = getItemAttribute(item2.uid, "defense"), arm = getItemAttribute(item2.uid, "armor")} if (item2.uid ~= 0) then if (item_db.def ~= 0) then local randChance = math.random(1, 100) if (config.upgradeStoneChance > randChance) then doItemSetAttribute(item2.uid, "defense", item_db.def + 1) doSendAnimatedText(fromPosition, "^^ ^^", 154) doSendMagicEffect(toPosition, 28) doRemoveItem(item.uid, 1) return true else doRemoveItem(item.uid, 1) doPlayerSendTextMessage(PlayerID, MESSAGE_STATUS_CONSOLE_BLUE, "Nie powiodlo sie, sprobuj ponownie!") doSendMagicEffect(toPosition, 0) return false end else return false end end return false end
Code:function onUse(PlayerID, item, fromPosition, item2, toPosition) local config = {upgradeStoneChance = (getConfigValue('totUpgradeStoneChance'))} local item_db = {atk = getItemAttribute(item2.uid, "attack"), def = getItemAttribute(item2.uid, "defense"), arm = getItemAttribute(item2.uid, "armor")} if (item2.uid ~= 0) then if (item_db.arm ~= 0) then local randChance = math.random(1, 100) if (config.upgradeStoneChance > randChance) then doItemSetAttribute(item2.uid, "armor", item_db.arm + 1) doSendAnimatedText(fromPosition, "^^ ^^", 154) doSendMagicEffect(toPosition, 28) doRemoveItem(item.uid, 1) return true else doRemoveItem(item.uid, 1) doPlayerSendTextMessage(PlayerID, MESSAGE_STATUS_CONSOLE_BLUE, "Nie powiodlo sie, sprobuj ponownie!") doSendMagicEffect(toPosition, 0) return false end else return false end end return false end
Code:function onUse(PlayerID, item, fromPosition, item2, toPosition) local config = {upgradeStoneChance = (getConfigValue('totUpgradeStoneChance'))} local item_db = {atk = getItemAttribute(item2.uid, "attack"), def = getItemAttribute(item2.uid, "defense"), arm = getItemAttribute(item2.uid, "armor")} if (item2.uid ~= 0) then if ((item_db.atk ~= 0) and (item_db.def ~= 0) then local randChance = math.random(1, 100) if (config.upgradeStoneChance > randChance) then doItemSetAttribute(item2.uid, "attack", item_db.atk + 1) doItemSetAttribute(item2.uid, "defense", item_db.def + 1) doSendAnimatedText(fromPosition, "^^ ^^", 154) doSendMagicEffect(toPosition, 28) doRemoveItem(item.uid, 1) return true else doRemoveItem(item.uid, 1) doPlayerSendTextMessage(PlayerID, MESSAGE_STATUS_CONSOLE_BLUE, "Nie powiodlo sie, sprobuj ponownie!") doSendMagicEffect(toPosition, 0) return false end else return false end end return false end
- Wchodzimy w plik data/actions/actions.xml i po linijce
Code:<actions>
Code:<action itemid="8300" event="script" value="upgstone_atk.lua" /> <action itemid="8305" event="script" value="upgstone_def.lua" /> <action itemid="8310" event="script" value="upgstone_arm.lua" /> <action itemid="8306" event="script" value="upgstone_full.lua" />
- To wszystko - tw?j skrypt zosta? zamontowany mo?esz cieszy? si? nowymi mo?liwo?ciami!
Pozdrawiam
jestemPolakiem