Amiroslo
Excellent OT User
- Joined
- Jul 28, 2009
- Messages
- 6,768
- Solutions
- 5
- Reaction score
- 769
This is the best reborn system you will ever use [If you use it correctly OFC].
I have had this system in my OT. I had to work a lot on it. It saves rebs in the DB.
What this system includes:
Reborns gets saved into your DB.
Check your reborns by talkaction.
Check others reborn by looking at them [onlook function]
Reborn using NPC
Remove/Add rebs from DB [This wont change his current hp/mana, just the rebs number]
How TO?:
1- Open data/lib/050-function and add this on top:
Now go to data/creaturescripts/ and open creaturescripts.xml and add:
Now go to data/creaturescripts/scripts and CREATE a new file called reblook.lua and this in it:
Now go to data/creaturescripts/scripts/ and open login.lua and add this:
OVER
Now head to data/npc/ and CREATE a new file called Reborn Statue.xml and add this inside:
Now go to data/npc/scripts/ and CREATE a new file called reb.lua and add this in it:
Now go to data/talkactions/talkactions.xml open it and add:
Now go to data/talkactions/scripts/ and CREATE a new file called rebtalk.lua and add this in it:
Goto your phpmyadmin and select your DB and add this colum:
Restart your server and REMEMBER to add the NPC in the map. It may be invsible in RME but it will show in game.
Tested on 0.3.6pl1 and works 100%
Thank you![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I have had this system in my OT. I had to work a lot on it. It saves rebs in the DB.
What this system includes:
Reborns gets saved into your DB.
Check your reborns by talkaction.
Check others reborn by looking at them [onlook function]
Reborn using NPC
Remove/Add rebs from DB [This wont change his current hp/mana, just the rebs number]
How TO?:
1- Open data/lib/050-function and add this on top:
Code:
--Rebirth function by Amiroslo
function getRebornsDone(cid)
local Info = db.getResult("SELECT `reborns` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local reborns= Info:getDataInt("reborns")
return reborns
end
return LUA_ERROR
end
function doAddReborns(cid) -- Adds 1 reb
db.executeQuery("UPDATE `players` SET `reborns` = `reborns` + 1 WHERE id = " .. getPlayerGUID(cid) .. ";")
end
function doRemoveReborns(cid) -- Removes 1 reb
db.executeQuery("UPDATE `players` SET `reborns` = `reborns` - 1 WHERE id = " .. getPlayerGUID(cid) .. ";")
end
Code:
<event type="look" name="rebirth" event="script" value="reblook.lua"/>
Now go to data/creaturescripts/scripts and CREATE a new file called reblook.lua and this in it:
Code:
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) then
doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and "\nShe" or "\nHe") .. " has: ["..getRebornsDone(thing.uid).."] Rebirths.")
return true
end
if(thing.uid == cid) then
doPlayerSetSpecialDescription(thing.uid, "\nYou have done: ["..getRebornsDone(thing.uid).."] Rebirths.")
end
return true
end
Now go to data/creaturescripts/scripts/ and open login.lua and add this:
Code:
registerCreatureEvent(cid, "rebirth")
Code:
registerCreatureEvent(cid, "Mail")
Now head to data/npc/ and CREATE a new file called Reborn Statue.xml and add this inside:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Reborn Statue" script="reb.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look typeex="8780"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you want to {reborn}?!"/>
<parameter key="message_farewell" value="Farewell!"/>
</parameters>
</npc>
Now go to data/npc/scripts/ and CREATE a new file called reb.lua and add this in it:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local level = 999999
local maxReborns = 10000
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 greetCallback(cid)
Topic[cid] = nil
return true
end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif Topic[cid] then
if msgcontains(msg, 'yes') then
if getRebornsDone(cid) < maxReborns then
doAddReborns(cid) -- adds 1 reborn
local g = getPlayerGUID(cid)
npcHandler:releaseFocus(cid)
doRemoveCreature(cid)
db.executeQuery('UPDATE players SET level=100,experience=15219400 WHERE id=' .. g)
else
npcHandler:say('You reached maximum amount of reborns.', cid)
end
else
npcHandler:say('Maybe next time.', cid)
end
Topic[cid] = nil
else
if msgcontains(msg, 'reborn') then
if getPlayerLevel(cid) >= level then
npcHandler:say('Are you sure that you want to make reborn?',cid)
Topic[cid] = 1
else
npcHandler:say('You don\'t have enough level. ['..level..']',cid)
Topic[cid] = nil
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Now go to data/talkactions/talkactions.xml open it and add:
Code:
<talkaction log="no" words="!reborns;!reborn" event="script" value="rebtalk.lua"/>
Now go to data/talkactions/scripts/ and CREATE a new file called rebtalk.lua and add this in it:
Code:
function onSay(cid, words, param)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Youve done ' .. (getRebornsDone(cid)) .. ' reborns.')
return true
end[/COLOR]
Goto your phpmyadmin and select your DB and add this colum:
Code:
ALTER TABLE `players` ADD `rebirth` int(10) unsigned NOT NULL DEFAULT '0';
Restart your server and REMEMBER to add the NPC in the map. It may be invsible in RME but it will show in game.
Tested on 0.3.6pl1 and works 100%
Thank you
Last edited: