Witam, więc tak jak w temacie daje wszystkie nowe potiony
Pierwszy potion to ten co nas ulecza.
Robimy notatnik a w nim wpisujemy:
function onUse(cid, item, frompos, item2, topos)
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253} player = getThingfromPos(playerpos) ml = getPlayerMagLevel(cid) lvl = getPlayerLevel(cid) voc = getPlayerVocation(cid) ex = getPlayerStorageValue(cid,4862) r1 = math.random(100,300)
params = { [1]=cid, [2]=lvl, [3]=voc, [4]=ml }
if item2.itemid == 1 then if item.itemid == 7636 then doPlayerSendCancel(cid,"It is empty.") else if item2.uid == cid then if ex == -1 then doPlayerAddHealth(cid,r1) doSendMagicEffect(playerpos,12) addEvent(ums,1000,params) setPlayerStorageValue(cid,4862, 1) doTransformItem(item.uid,7636) doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE) else doPlayerSendCancel(cid,'You are exhausted!') doSendMagicEffect(playerpos,2) end else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7636) doDecayItem(splash) end end else if item.itemid == 7636 then doPlayerSendCancel(cid,"It is empty.") else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7636) doDecayItem(splash) end end return 1 end
function ums(params) cid = params[1] setPlayerStorageValue(cid,4862, -1) end
Zapisujemy go jako: health.lua
Tutaj ten sam potion tylko, że silniejszy:
function onUse(cid, item, frompos, item2, topos)
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253} player = getThingfromPos(playerpos) ml = getPlayerMagLevel(cid) lvl = getPlayerLevel(cid) voc = getPlayerVocation(cid) ex = getPlayerStorageValue(cid,4862) r1 = math.random(200,600)
params = { [1]=cid, [2]=lvl, [3]=voc, [4]=ml }
if item2.itemid == 1 then if item.itemid == 7634 then doPlayerSendCancel(cid,"It is empty.") else if item2.uid == cid then if lvl >= 50 then if voc == 4 or voc == 3 or voc == 7 or voc == 8 then if ex == -1 then doPlayerAddHealth(cid,r1) doSendMagicEffect(playerpos,12) addEvent(ums,1000,params) setPlayerStorageValue(cid,4862, 1) doTransformItem(item.uid,7634) doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE) else doPlayerSendCancel(cid,'You are exhausted!') doSendMagicEffect(playerpos,2) end else doPlayerSendCancel(cid, 'This potion can only be consumed by paladins and knights of level 50 or higher.') end else doPlayerSendCancel(cid,'This potion can only be consumed by paladins and knights of level 50 or higher.') end else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7634) doDecayItem(splash) end end else if item.itemid == 7634 then doPlayerSendCancel(cid,"It is empty.") else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7634) doDecayItem(splash) end end return 1 end
function ums(params) cid = params[1] setPlayerStorageValue(cid,4862, -1) end
Zapisujemy jako health2.lua
Tutaj ten sam potion tylko, że najsilniejszy:
function onUse(cid, item, frompos, item2, topos)
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253} player = getThingfromPos(playerpos) ml = getPlayerMagLevel(cid) lvl = getPlayerLevel(cid) voc = getPlayerVocation(cid) ex = getPlayerStorageValue(cid,4862) r1 = math.random(400,800)
params = { [1]=cid, [2]=lvl, [3]=voc, [4]=ml }
if item2.itemid == 1 then if item.itemid == 7635 then doPlayerSendCancel(cid,"It is empty.") else if item2.uid == cid then if lvl >= 80 then if voc == 4 or voc == 8 then if ex == -1 then doPlayerAddHealth(cid,r1) doSendMagicEffect(playerpos,12) addEvent(ums,1000,params) setPlayerStorageValue(cid,4862, 1) doTransformItem(item.uid,7635) doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE) else doPlayerSendCancel(cid,'You are exhausted!') doSendMagicEffect(playerpos,2) end else doPlayerSendCancel(cid, 'This potion can only be consumed by knights of level 80 or higher.') end else doPlayerSendCancel(cid,'This potion can only be consumed by knights of level 80 or higher.') end else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7635) doDecayItem(splash) end end else if item.itemid == 7635 then doPlayerSendCancel(cid,"It is empty.") else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7635) doDecayItem(splash) end end return 1 end
function ums(params) cid = params[1] setPlayerStorageValue(cid,4862, -1) end
Zapisujemy jako: health3.lua
Teraz potion na manę
Tworzymy notatnik a w notatniku wpisujemy:
function onUse(cid, item, frompos, item2, topos)
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253} player = getThingfromPos(playerpos) ml = getPlayerMagLevel(cid) lvl = getPlayerLevel(cid) voc = getPlayerVocation(cid) ex = getPlayerStorageValue(cid,4862) r1 = math.random(50,150)
params = { [1]=cid, [2]=lvl, [3]=voc, [4]=ml }
if item2.itemid == 1 then if item.itemid == 7636 then doPlayerSendCancel(cid,"It is empty.") else if item2.uid == cid then if ex == -1 then doPlayerAddMana(cid,r1) doSendMagicEffect(playerpos,12) addEvent(ums,1000,params) setPlayerStorageValue(cid,4862, 1) doTransformItem(item.uid,7636) doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE) else doPlayerSendCancel(cid,'You are exhausted!') doSendMagicEffect(playerpos,2) end else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7636) doDecayItem(splash) end end else if item.itemid == 7636 then doPlayerSendCancel(cid,"It is empty.") else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7636) doDecayItem(splash) end end return 1 end
function ums(params) cid = params[1] setPlayerStorageValue(cid,4862, -1) end
Zapisujemy go jako: mana.lua
Tutaj też potion na manę tylko, że silniejszy:
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253} player = getThingfromPos(playerpos) ml = getPlayerMagLevel(cid) lvl = getPlayerLevel(cid) voc = getPlayerVocation(cid) ex = getPlayerStorageValue(cid,4862) r1 = math.random(100,300)
params = { [1]=cid, [2]=lvl, [3]=voc, [4]=ml }
if item2.itemid == 1 then if item.itemid == 7634 then doPlayerSendCancel(cid,"It is empty.") else if item2.uid == cid then if lvl >= 50 then if voc == 1 or voc == 2 or voc == 3 or voc == 5 or voc == 6 or voc == 7 then if ex == -1 then doPlayerAddMana(cid,r1) doSendMagicEffect(playerpos,12) addEvent(ums,1000,params) setPlayerStorageValue(cid,4862, 1) doTransformItem(item.uid,7634) doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE) else doPlayerSendCancel(cid,'You are exhausted!') doSendMagicEffect(playerpos,2) end else doPlayerSendCancel(cid, 'This potion can only be consumed by paladins, druids and sorcerers of level 50 or higher.') end else doPlayerSendCancel(cid,'This potion can only be consumed by paladins, druids and sorcerers of level 50 or higher.') end else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7634) doDecayItem(splash) end end else if item.itemid == 7634 then doPlayerSendCancel(cid,"It is empty.") else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7634) doDecayItem(splash) end end return 1 end
function ums(params) cid = params[1] setPlayerStorageValue(cid,4862, -1) end
Zapisujemy jako: mana2.lua
Tutaj też potion na manę tylko, że najsilniejszy:
function onUse(cid, item, frompos, item2, topos)
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253} player = getThingfromPos(playerpos) ml = getPlayerMagLevel(cid) lvl = getPlayerLevel(cid) voc = getPlayerVocation(cid) ex = getPlayerStorageValue(cid,4862) r1 = math.random(150,450)
params = { [1]=cid, [2]=lvl, [3]=voc, [4]=ml }
if item2.itemid == 1 then if item.itemid == 7635 then doPlayerSendCancel(cid,"It is empty.") else if item2.uid == cid then if lvl >= 80 then if voc == 1 or voc == 2 or voc == 5 or voc == 6 then if ex == -1 then doPlayerAddMana(cid,r1) doSendMagicEffect(playerpos,12) addEvent(ums,1000,params) setPlayerStorageValue(cid,4862, 1) doTransformItem(item.uid,7635) doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE) else doPlayerSendCancel(cid,'You are exhausted!') doSendMagicEffect(playerpos,2) end else doPlayerSendCancel(cid, 'This potion can only be consumed by druids and sorcerers of level 80 or higher.') end else doPlayerSendCancel(cid,'This potion can only be consumed by druids and sorcerers of level 80 or higher.') end else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7635) doDecayItem(splash) end end else if item.itemid == 7635 then doPlayerSendCancel(cid,"It is empty.") else splash = doCreateItem(1903,item.type,topos) doTransformItem(item.uid,7635) doDecayItem(splash) end end return 1 end
function ums(params) cid = params[1] setPlayerStorageValue(cid,4862, -1) end
Zapisujemy jako: mana3.lua
Teraz inne:
mastermind potion.lua
local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) -- 10 minutes setConditionParam(condition, CONDITION_PARAM_STAT_MAGICPOINTS, 3) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)
function onUse(cid, item, frompos, item2, topos) if not(isSorcerer(cid) or isDruid(cid)) then doCreatureSay(cid, "Only sorcerers and druids may drink this fluid.", TALKTYPE_ORANGE_1) return TRUE end
if(doTargetCombatCondition(0, cid, condition, CONST_ME_MAGIC_RED) == LUA_ERROR) then return FALSE end
doCreatureSay(cid, "You feel smarter.", TALKTYPE_ORANGE_1) doRemoveItem(item.uid) return TRUE end
berserk potion.lua
local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 5) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10) function onUse(cid, item, frompos, item2, topos) if(doTargetCombatCondition(0, cid, condition, CONST_ME_MAGIC_RED) == LUA_ERROR) then return FALSE end
doRemoveItem(item.uid) return TRUE
end
bullseye potion.lua
local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, 30 * 60 * 1000) -- 30 minutes setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, 5) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)
function onUse(cid, item, frompos, item2, topos) if(doTargetCombatCondition(0, cid, condition, CONST_ME_MAGIC_RED) == LUA_ERROR) then return FALSE end
doRemoveItem(item.uid) return TRUE end
demonic blood.lua
local POTIONS = {7588, 7589}
function onUse(cid, item, frompos, item2, topos) local rand = math.random(1,#POTIONS)
doTransformItem(item.uid, POTIONS[rand]) doSendMagicEffect(getThingPos(item.uid), CONST_ME_MAGIC_RED) return TRUE end
Teraz do Actions.xml dodajemy:
<action itemid="7439" script="berserk potion.lua" /> <action itemid="7440" script="mastermind potion.lua" /> <action itemid="7443" script="bullseye potion.lua" />
<action itemid="7618" script="health.lua" /> <action itemid="7588" script="health2.lua" /> <action itemid="7591" script="health3.lua" /> <action itemid="7620" script="mana.lua" /> <action itemid="7589" script="mana2.lua" /> <action itemid="7590" script="mana3 .lua" /> <action itemid="6558" script="demonic blood.lua" />
|