To m?j pierwszy skrypt wi?c prosz? o wyrozumia?o?? ;p Skrypt polega na losowym odnawianiu many z przedzia?u 10 do maxhp-currenthp (to samo z man?) kosztem souli. Ciekawe dla projekt?w RPG.
komendy: !heal / !mana
A tutaj efekt podczas u?ycia scrolla:
W talkactions/scripts dodaj healtandmana.lua:
W talkactions.xml dodaj:
Dodam tak?e scroll'a, kt?ry odnawia o 20 nasze punkty soul. Mo?na doda? do loota potwork?w.
W actions/scripts/tools dodaj soulscroll.lua:
W actions.xml dodaj linijk?:
komendy: !heal / !mana


A tutaj efekt podczas u?ycia scrolla:

W talkactions/scripts dodaj healtandmana.lua:
PHP:
-- uh/mana with commands in-game
-- Created by Layflette/Fec/3dzio (Big thanks to Limos!)
function onSay(cid, words, param)
local hpSoul, manaSoul = 9, 7
local playerInfo = {getCreatureHealth(cid), getCreatureMaxHealth(cid), getPlayerMana(cid), getPlayerMaxMana(cid), getPlayerSoul(cid)}
if words == "!heal" then
if playerInfo[1] < playerInfo[2] then
if playerInfo[5] > hpSoul then
doCreatureAddHealth(cid, math.random(10, playerInfo[2] - playerInfo[1]))
doPlayerAddSoul(cid, -hpSoul)
doCreatureSay(cid, "Sweet!", TALKTYPE_ORANGE_1) --works with tfs 0.2x mystic spirit
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You need more soul to heal yourself!")
end
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your health is full!")
end
elseif words == "!mana" then
if playerInfo[3] < playerInfo[4] then
if playerInfo[5] > manaSoul then
doPlayerAddMana(cid, math.random(7, playerInfo[2] - playerInfo[1]))
doPlayerAddSoul(cid, -manaSoul)
doCreatureSay(cid, "Glummp!", TALKTYPE_ORANGE_1) --works with tfs 0.2x mystic spirit
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You need more soul to restore your mana!")
end
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your mana is full!")
end
end
return TRUE
end
PHP:
<talkaction words="!heal" script="healtandmana.lua"/>
<talkaction words="!mana" script="healtandmana.lua"/>
Dodam tak?e scroll'a, kt?ry odnawia o 20 nasze punkty soul. Mo?na doda? do loota potwork?w.
W actions/scripts/tools dodaj soulscroll.lua:
PHP:
-- soul scroll
-- Created by Layflette/Fec/3dzio
function onUse(cid, item, fromPosition, itemEx, toPosition)
local addSoul = 20
local soul = getPlayerSoul(cid)
if item.itemid == 5956 then
if getPlayerSoul(cid) < 100 then
doPlayerAddSoul(cid, addSoul)
doSendMagicEffect(getPlayerPosition(cid), 4)
doPlayerRemoveItem(cid,5956,1)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You don't need more souls!")
end
end
return TRUE
end
W actions.xml dodaj linijk?:
PHP:
<action itemid="5956" script="tools/soulscroll.lua"/>