What's new

Actions Pomysl Na Potion~Mr w 1 Dziala w 100%

Status
Not open for further replies.

Imaginium

User
Joined
Dec 25, 2013
Messages
28
Reaction score
1
Witam
Zastanawialem si? jak zrobi? Mr kt?re daje co? od .. do i wpadlem na pomysl :D Du?o ludzi tego szuka tylko w innej wersji te Mr daje Hp ,Mane lub razem jednocze?nie .
Chcialem w skrypt potions przemieni? jego warto?? id i powi?krzy? regeneracje jednak aby si? nie ko?czylo . Tych Mr jest 9 od najmniejszej regeneracji do najwi?kszej.
Wszystko zrobilem na pocz?tku byly bl?dy ale si? udalo :)
Oto Skrypt nad kt?rym si? bawilem :
Do actions.xml
[xml] <action itemid="2297;2281;2294;2307;2306;2296;2280;2312;2298" event="script" value="liquids/xxxx.lua"/>[/xml]
Do Actions/scripts/liquids tworzymy plik xxxx.lua

[lua] local config = {
removeOnUse = "no",
usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
splashable = "no",
range = -1,
realAnimation = "no", -- make text effect visible only for players in range 1x1
multiplier = {
health = 1.0,
mana = 1.0
}
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
[2298] = {empty = 7636, splash = 42, health = {20, 50}}, -- small health potion
[2312] = {empty = 7636, splash = 42, health = {70, 150}}, -- health potion
[2294] = {empty = 7634, splash = 42, health = {190, 370}, level = 40, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
[2307] = {empty = 7635, splash = 42, health = {400, 590}, level = 50, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
[2306] = {empty = 7635, splash = 42, health = {600, 990}, level = 70, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion
[2296] = {empty = 7636, splash = 47, mana = {40, 90}}, -- mana potion
[2280] = {empty = 7634, splash = 47, mana = {90, 290}, level = 40, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
[2281] = {empty = 7635, splash = 47, mana = {300, 450}, level = 50, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

[2297] = {empty = 7635, splash = 43, health = {280, 450}, mana = {200, 280}, level = 50, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.itemid]
if(not potion) then
return false
end

if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
if(not config.splashable) then
return false
end

if(toPosition.x == CONTAINER_POSITION) then
toPosition = getThingPosition(item.uid)
end

doDecayItem(doCreateItem(POOL, potion.splash, toPosition))
if(not potion.empty or config.removeOnUse) then
return true
end

if(fromPosition.x ~= CONTAINER_POSITION) then
doCreateItem(potion.empty, fromPosition)
else
doPlayerAddItem(cid, potion.empty, 1)
end

return true
end

if(hasCondition(cid, CONDITION_EXHAUST)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end

if(((potion.level and getPlayerLevel(itemEx.uid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(itemEx.uid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doCreatureSay(itemEx.uid, "xxxx..." .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
return true
end

if(config.range > 0 and cid ~= itemEx.uid and getDistanceBetween(getThingPosition(cid), getThingPosition(itemEx.uid)) > config.range) then
return false
end

local health = potion.health
if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.multiplier.health))) then
return false
end

local mana = potion.mana
if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.multiplier.mana))) then
return false
end

doSendMagicEffect(getThingPosition(itemEx.uid), CONST_ME_MAGIC_BLUE)
if(not config.realAnimation) then
doCreatureSay(itemEx.uid, "xxxx...", TALKTYPE_ORANGE_1)
else
for i, tid in ipairs(getSpectators(getThingPosition(itemEx.uid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "xxxx...", TALKTYPE_ORANGE_1, false, tid)
end
end
end

doAddCondition(cid, exhaust)
if(not potion.empty or config.removeOnUse) then
return true
end

if(fromPosition.x ~= CONTAINER_POSITION) then
doCreateItem(potion.empty, fromPosition)
else
end

return true
end[/lua]


Je?eli chcemy zmieni? nazwe a musimy to wyszukujemy ka?de id itemu i wklejamy to :

[xml] <item id="xxxx" article="an" name="xxxx">
<attribute key="weight" value="220" />
<attribute key="description" value="This potion can only be consumed by xxxx of level xxx or higher." />[/xml]



W miejsce xxxx wpisujemy nazwe itema / id itema / od jakiego lvla . ( latwo si? zori?towa? ) .

To Na Tyle ~~ Nie Pozwalam Wstawia? Przer?bki Na Inne Fora ! ~~
:wink:

Notka moderatorska:
Wstawiaj?c kody u?ywamy znacznik?w!
 

Dantez

Moim sekretem jest ciasto
Joined
May 22, 2008
Messages
1,206
Reaction score
202
Odp: Pomysl Na Potion~Mr w 1 Dziala w 100%

Nie ?eby co?, ale na tym forum masz specjalne tagi do kod?w...
 

DanJ93

ElfBot Helper
Joined
Jan 18, 2009
Messages
2,631
Reaction score
200
Odp: Pomysl Na Potion~Mr w 1 Dziala w 100%

Nie ?eby co?, ale to jest przecie? skrypt na poty, pewnie tylko ID zmienione
 

xNordik

Advanced User
Joined
Dec 28, 2010
Messages
338
Reaction score
33
Age
24
Odp: Pomysl Na Potion~Mr w 1 Dziala w 100%

Code:
~~ Nie Pozwalam Wstawia? Przer?bki Na Inne Fora ! ~~
Po wrzuceniu przerobionego skryptu na poty, ok.

Mo?e du?o si? nie napracowa?e?, ale zawsze te 30 sekund na zmianie id w zwyk?ym kodzie. By? mo?e (cho? w?tpi?) komu? si? przyda.
Spr?buj napisa? co? sam, bo jak w powitaniu napisa?e? ?e jeste? niby skrypterem to raczej nie powinno ci sprawi? problem?w : )
Powodzenia.
 

Imaginium

User
Joined
Dec 25, 2013
Messages
28
Reaction score
1
Odp: Pomysl Na Potion~Mr w 1 Dziala w 100%

Nie zmieni?em tylko id jak by? wstawi?l ten skrypt to zrobi?em wi?cej poprawek i doda?em poty,mr,uh w 1 do tego doklei?em balansu troch? :)
 

sprytnaaaaa

Advanced User
Joined
Apr 20, 2011
Messages
342
Reaction score
4
Odp: Pomysl Na Potion~Mr w 1 Dziala w 100%

No jak by? m?g? doda? jeszcze aby potka po 100 uzyciu ubiera?a jeden soulth :D jak dasz rade :p
 
Status
Not open for further replies.
Top