• 01-04.05.2026 - DOUBLE EXP / SKILL EVENT!

Skrypty & Kody Bonus hp i MP items

Zapalniczka

Active User
Zarejestrowany
Dołączył
Luty 2, 2015
Posty
132
Liczba reakcji
2
Pomocy!! potrzebuje skypt na bonus hp ktory daje 15% hp,a po uzyciu zmienia sie na pusta butelke
 
Odp: Bonus hp i MP items

Pierwszy skrypcik lua :P

[lua]<action itemid="8205" event="script" value="liquids/maxhp.lua"/>[/lua]

[lua]local config = {
removeOnUse = "no",
vial = 7636,
splash = "no",
hppercent = 15
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)

function onUse(cid, item, fromPosition, itemEx, toPosition)
local health = getCreatureMaxHealth(cid)
if(not isPlayer(itemEx.uid) or (cid ~= itemEx.uid)) then
if(config.splash) then
return true
end

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

doDecayItem(doCreateItem(POOL, config.splash, toPosition))
doRemoveItem(item.uid, 1)
if(not config.vial or config.removeOnUse) then
return true
end

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

return true
end

if(not setCreatureMaxHealth(cid, health+((health*(config.hppercent/100))))) then
return false
end

for i, tid in ipairs(getSpectators(getThingPosition(itemEx.uid), 1, 1)) do
if(isPlayer(tid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Dodano 15% hp!")
end
end

doRemoveItem(item.uid, 1)
if(not config.vial or config.removeOnUse) then
return true
end

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

return true
end[/lua]
 
Ostatnia edycja:
Odp: Bonus hp i MP items

Dzieki :)\

---------- Tre?? dodana o 15:12 ----------

Dzieki :D a jeszcze jedno pytanko mozna tak zrobic zeby znikalo hp co dodalismy tym itemem za 10 min i zeby ext byl uzycia 15 min
 
Odp: Bonus hp i MP items

local config = {
removeOnUse = "no",
vial = 7636,
splash = "no",
hppercent = 15
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)

function onUse(cid, item, fromPosition, itemEx, toPosition)
local health = getCreatureMaxHealth(cid)
if(not isPlayer(itemEx.uid) or (cid ~= itemEx.uid)) then
if(config.splash) then
return true
end

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

doDecayItem(doCreateItem(POOL, config.splash, toPosition))
doRemoveItem(item.uid, 1)
if(not config.vial or config.removeOnUse) then
return true
end

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

return true
end

if(not setCreatureMaxHealth(cid, health-((health*(config.hppercent/100))))) then
return false
end

for i, tid in ipairs(getSpectators(getThingPosition(itemEx.uid), 1, 1)) do
if(isPlayer(tid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Odje?o 15% hp!")
end
end

doRemoveItem(item.uid, 1)
if(not config.vial or config.removeOnUse) then
return true
end

if(fromPosition.x ~= CONTAINER_POSITION) then
doCreateItem(config.vial, fromPosition)
else
doPlayerAddItem(cid, config.vial, 1)
end
return true
end

Masz tutaj kod na to, ?e gdy klikniesz na przedmiot odejmie Ci 15 % hp.
 
Odp: Bonus hp i MP items

Masz tutaj kod na to, ?e gdy klikniesz na przedmiot odejmie Ci 15 % hp.

Przecie? on chce, aby dodatkowe hp znika?o po 10min a nie ?aden 2 przedmiot, kt?ry odejmie -_-
@ Topic Jestem w trakcie tworzenia, edytuj? post gdy sko?cz?.
@ Edit Saiyans King zrobi? to lepiej tak?e nie mam po co wrzuca? :P
 
Ostatnia edycja:
Odp: Bonus hp i MP items

BuchaLL wiem, ?e chce ale na to, ?e odejmie po 10 minutach, ale mo?e zawsze si? przyda?.
 
Odp: Bonus hp i MP items

Dzieki :)\

---------- Tre?? dodana o 15:12 ----------

Dzieki :D a jeszcze jedno pytanko mozna tak zrobic zeby znikalo hp co dodalismy tym itemem za 10 min i zeby ext byl uzycia 15 min
[LUA]local config = {
removeOnUse = false,
vial = 7636,
yourself = true,
hppercent = 15,
mppercent = 15,
storageExh = 66,
exhaustion = 15 * 60 --15*60s
}

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SUBID, 666) --jakies fajne subid
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXHEALTHPERCENT, 100+config.hppercent)
setConditionParam(condition, CONDITION_PARAM_STAT_MAXMANAPERCENT, 100+config.mppercent)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) --10*60s*1000ms = 10min
setCombatCondition(combat, condition)

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(exhaustion.get(cid, config.storageExh)) then
doPlayerSendCancel(cid, "You are exhausted.")
return true
end

if(itemEx.itemid == 1 and itemEx.type == 1) then
if((config.yourself and itemEx.uid == cid) or not config.yourself) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
doAddCondition(itemEx.uid, condition)
if(config.removeOnUse) then
doRemoveItem(item.uid)
exhaustion.set(cid, config.storageExh, config.exhaustion)
return true
end

doTransformItem(item.uid, config.vial)
else
doPlayerSendCancel(cid, "You can only use it on yourself.")
return true
end
else
doPlayerSendCancel(cid, "You can only use it on players.")
return true
end

exhaustion.set(cid, config.storageExh, config.exhaustion)
return true
end[/LUA]
 
Odp: Bonus hp i MP items

moze ktos napisac npc ktory by napelnil te bonusy za 10g?

---------- Tre?? dodana o 18:12 ----------

ale i tak dziekuje za wszystko ;) tylko zeby jeszcze napisal gorny post ^
 
Ostatnia edycja:
Odp: Bonus hp i MP items

elf.lua
[lua]<npc name="Elf" script="data/npc/scripts/wymien.lua" walkinterval="3000" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="159" head="132" body="110" legs="60" feet="99" addons="3" corpse="2212"/>
<parameters>
</parameters>
</npc>[/lua]

wymien.lua
[lua]local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function say(param)
npcHandler:say(param.text,param.cid)
end
function delayedSay(text, delay, cid)
if(not npcHandler:isFocused(cid)) then
return FALSE
else
local param = {cid = cid, text = text}
local delay = delay or 0
addEvent(say, delay, param)
end
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'napelnij') then
selfSay("Czy posiadasz pusta butelke by ja napelnic?", cid)
talkState[talkUser] = 1
elseif msgcontains(msg, 'tak') and talkState[talkUser] == 1 then
if getPlayerItemCount(cid, 7636) >= 1 then
doPlayerRemoveItem(cid, 7636, 1)
doPlayerAddItem(cid, 8205, true)
selfSay("Buletka napelniona!", cid)
else
selfSay("Nie posiadasz butelki do napelnienia!", cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())[/lua]
 
Odp: Bonus hp i MP items

dziekuje tobie :3 i dla all
 
Ostatnia edycja:
Back
Do góry