• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

no deathloss

Rexanilator

New Member
Joined
Oct 3, 2009
Messages
297
Reaction score
2
I would like a script that would make it so that noob characters would have no deathloss until they are like level 50 or so.

Can someone make me a script or show me how to edit a script to make this happen?

Thanks!
 
add in login.lua:
Lua:
	if getPlayerLevel(cid) < 50 then
		for i = 0, 4 do
			doPlayerSetLossPercent(cid, i, 0)
		end
	end

	registerCreatureEvent(cid, "Deathloss")
add in creaturescripts.xml:
XML:
	<event type="advance" name="Deathloss" event="script" value="deathloss.lua"/>
create data/creaturescripts/scripts/deathloss.lua:
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
	if newLevel >= 50 then
		for i = 0, 4 do
			if getPlayerLossPercent(cid, i) == 0 then
				doPlayerSetLossPercent(cid, i, 100)
			end
		end
	end

	return true
end
 
add in login.lua:
Lua:
	if getPlayerLevel(cid) < 50 then
		for i = 0, 4 do
			doPlayerSetLossPercent(cid, i, 0)
		end
	end

	registerCreatureEvent(cid, "Deathloss")
add in creaturescripts.xml:
XML:
	<event type="advance" name="Deathloss" event="script" value="deathloss.lua"/>
create data/creaturescripts/scripts/deathloss.lua:
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
	if newLevel >= 50 then
		for i = 0, 4 do
			if getPlayerLossPercent(cid, i) == 0 then
				doPlayerSetLossPercent(cid, i, 100)
			end
		end
	end

	return true
end

And what happens if i advanced to lvl 51 but i'm full blessed?
 
Well it worked when I tested it on a lvl 20 noob - but today - it drops all players who die under lvl 50 to lvl 1. Please help to fix this issue.
 
Login.lua under this line
Code:
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end
paste
Code:
	if getPlayerLevel(cid) < 50 then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
	end
 
It still kicked my lvl 20 noob back to lvl 1...

Here is the code for my login.lua:

Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 8)
	end
	if getPlayerLevel(cid) < 50 then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, "Deathloss")
	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "BountyHunter")
	registerCreatureEvent(cid, "Idle")
	registerCreatureEvent(cid, "Aura")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	return true
end
 
It still kicked my lvl 20 noob back to lvl 1...

Here is the code for my login.lua:

Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 8)
	end
	if getPlayerLevel(cid) < 50 then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, "Deathloss")
	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "BountyHunter")
	registerCreatureEvent(cid, "Idle")
	registerCreatureEvent(cid, "Aura")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	return true
end

I got that 1lvl problem too and it was something with blessings. I can't remember what I did but I got it working.
 
As I said I dunno exactly but if I remember right I had to remove scripts (scripts and npcs which will sell them for players) and set player blessings to 0 in database. Maybe you can try it :)
Sql command
SQL:
UPDATE players SET blessings = 0;
 
Lua:
local corpse_ids = {
        [0] = 3065, -- female
        [1] = 3058 -- male
}
function onStatsChange(cid, attacker, type, combat, value)
        if combat == COMBAT_HEALING then
                return true
        end
 
        if getCreatureHealth(cid) > value then
                return true
        end
     if getPlayerLevel(cid) <= 50 then
	            doItemSetAttribute(doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), "description", "You recognize "..getCreatureName(cid)..". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".\n") 
                doRemoveConditions(cid)
                 doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
                  doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
				doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), FALSE)
                doSendMagicEffect(getCreaturePosition(cid), 10)
			    if getCreatureSkullType(cid) ~= 1 and getCreatureSkullType(cid) ~= 4 and getCreatureSkullType(cid) ~= 5 then
			        doPlayerSendTextMessage(attacker,MESSAGE_STATUS_WARNING,"The murder of "..getCreatureName(cid).." was unjustified.")
					db.executeQuery("UPDATE `killers` SET `unjustified` = `unjustified` + '1' WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(attacker) .. ")")
				end
			
 end
         return false
 
end

go to creature.xml
Code:
<event type="statschange" name="frag" event="script" value="xxxx.lua"/>

in login.lua
Code:
registerCreatureEvent(cid, "frag")
 
Back
Top