Lopaskurwa
Well-Known Member
- Joined
- Oct 6, 2017
- Messages
- 914
- Solutions
- 2
- Reaction score
- 50
Hi so this is system is made by "Itutorial" all credits for him. But this system have one big problem so. When you transform and revert, then quickly log out and log in again, you are the transformed version but with reduced health and mana, so you can't transform, you can only revert but since you already have reduced health reverting again will kill you.
Systems
global
transform.lua
revert.lua
effect lua
Systems
global
LUA:
exhaust_transform = {}
transform = {
[1] = {voc = 1, newVoc = 5, from_looktype = 2, looktype = 3, level = 50, rage = 3, mana = 10, addHealth = 200, addMana = 150, effect = 79, aura = nil, constant = false}
}
LUA:
function onSay(player, words, param)
local kurwa_gdzie_jest_efekt = Position(player:getPosition().x + 1, player:getPosition().y, player:getPosition().z)
local pid = player:getId()
local TRANS = transform[player:getVocation():getId()]
if not TRANS then
player:sendCancelMessage("You cannot transform.")
return false
end
if player:getLevel() < TRANS.level then
player:sendCancelMessage("You must reach level "..TRANS.level.." to transform.")
return false
end
if player:getSoul() < TRANS.rage then
player:sendCancelMessage("You need "..TRANS.rage.." to transform.")
return false
end
if player:getMana() < TRANS.mana then
player:sendCancelMessage("You need "..TRANS.mana.." to transform.")
return false
end
local outfit = player:getOutfit()
outfit.lookType = TRANS.looktype
if TRANS.constant then
player:setOutfit(outfit)
else
player:setOutfit(outfit, false)
end
player:addSoul(-TRANS.rage)
player:setMaxHealth(player:getMaxHealth() + TRANS.addHealth)
player:setMaxMana(player:getMaxMana() + TRANS.addMana)
kurwa_gdzie_jest_efekt:sendMagicEffect(TRANS.effect)
player:setVocation(TRANS.newVoc)
player:save()
return false
end
LUA:
function onSay(player, words, param, channel)
local pid = player:getId()
if exhaust_transform[pid] ~= nil then
return false
end
local TRANS = transform[player:getVocation():getId() - 4]
if not TRANS then
player:sendCancelMessage("You cannot revert.")
return false
end
local outfit = player:getOutfit()
outfit.lookType = TRANS.from_looktype
if TRANS.constant then
player:setOutfit(outfit)
else
player:setOutfit(outfit, false)
end
exhaust_transform[pid] = 1
player:setMaxHealth(player:getMaxHealth() - TRANS.addHealth)
player:setMaxMana(player:getMaxMana() - TRANS.addMana)
player:setVocation(TRANS.voc)
player:save()
addEvent(removeExhaust, 5 * 1000, pid)
return false
end
function removeExhaust(pid)
exhaust_transform[pid] = nil
end
LUA:
function onThink(interval)
local players = Game.getPlayers()
for i, v in ipairs(players) do
player = Player(v)
if player then
TRANS = transform[player:getVocation():getId()]
if TRANS then
if TRANS.aura ~= nil then
player:getPosition():sendMagicEffect(TRANS.aura)
end
end
end
end
return true
end
Last edited by a moderator: