strutZ
Australian OT Member {AKA Beastn}
- Joined
- Nov 16, 2014
- Messages
- 1,391
- Solutions
- 7
- Reaction score
- 550
Here is the talkaction script I made that will revive a player when killed. This script requires @Colors REVIVE SYSTEM to work. All you need to do is configure the top half of the script. No need to touch anything else.
Enjoy.
data/talkactions/talkactions.xml
data/talkactions/scripts/revive_spell.lua
CREDITS
@RazorBlade
@Colors
Enjoy.
data/talkactions/talkactions.xml
Code:
<talkaction words="return" separator=" " script="revive_spell.lua" />
data/talkactions/scripts/revive_spell.lua
Code:
-- CONFIG --
local deathGroupId = 4 -- Add your death ID from your revive script here
local cost = 80 -- Add the spell mana cost here
local vocs = {2, 6} -- Add the vocation numbers you want to be able to use the spell.
local cooldown = 30 -- Add your cooldown in seconds.
-- END CONFIG --
-- CORE CODE --
function onSay(player, words, param)
local target = Creature(param)
if not target then
player:sendCancelMessage("A player with this name cannot be found.")
return false
end
if isInArray(vocs, player:getVocation():getId()) then
if player:getStorageValue(987654) >= os.time() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are still drained from your last revive!")
return false
end
if player:getMana() < cost then
player:sendCancelMessage("You dont have enough mana.")
return false
else
if target:getGroup():getId() == deathGroupId then
target:applyDeathAttributes(false)
target:removeCondition(CONDITION_OUTFIT)
target:addHealth(target:getMaxHealth())
target:addMana(target:getMaxMana())
player:addMana(-cost)
player:setStorageValue(987654, os.time() + cooldown)
return true
end
end
else
player:sendCancelMessage("Only Druids can cast this spell.")
return false
end
end
CREDITS
@RazorBlade
@Colors