• 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!

Lua Where do i change when people die thay start with the same equipment?

Nux

Yzeria Custom War
Joined
Jan 2, 2009
Messages
1,067
Reaction score
1
Well im using Account Manager 1/1 and i want to know where i can change so when people die thay get the same equipment thay started with before..
 
Do you mean that you want them to start off with the same items every time or start off with that they died with (no loss percentage)

Im guessing the first one? As an example- You want all paladins to start with Golden Armor and 1000 bolts every time they log in?
 
That i mean is that i want for example a paladin start with the same equipment that i changed in login lua.. i mean when thay die or relog thay have the same equipment.. as thay started..
 
At first thought I personally would change

Code:
deathpercent = xx

to be 100 so every player loses all their items on death.. Then in data/creaturescripts/login.lua I would had a few lines of code that are very similar to the script from the other topic. That way everyone will start fresh depending on their vocation.

Another way to do it (If you are using the firstitems) is to go back into that login.lua and take out the line of code that checks to see if this is the first players login or not. Then it should call the firstitems again based on their vocation.

Hope it helps.

-Zeke
 
In your config.lua there should be a line similar to

Code:
deathpercent = 10

Correct? Change that value to 100 so its a 100% chance to lose your items. Everyone should drop all of their items when they die.

Now this was my mistake earlier.. but corrected now

Go into data/creaturescripts/firstitems.lua

You should see something like

Code:
local firstItems =
{
	2050,
	2382
}

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then

		local bag = doPlayerAddItem(cid, 1987, 1)
		doAddContainerItem(bag, 2674, 1)
		setPlayerStorageValue(cid, 30001, 1)

		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		if getPlayerSex(cid) == 0 then
			doPlayerAddItem(cid, 2651, 1)
		else
			doPlayerAddItem(cid, 2650, 1)
		end
	end
 	return TRUE
end

Change it to
Code:
local firstItems =
{
	2050,
	2382
}

function onLogin(cid)

		local bag = doPlayerAddItem(cid, 1987, 1)
		doAddContainerItem(bag, 2674, 1)

		for i = 1, table.maxn(firstItems) do
		   doPlayerAddItem(cid, firstItems[i], 1)
		end
		if getPlayerSex(cid) == 0 then
			doPlayerAddItem(cid, 2651, 1)
		else
			doPlayerAddItem(cid, 2650, 1)
		end
 	return TRUE
end

With those modifications first itmes will be called every time the player logs in.

According to your other thread about the starting items, you have it based on vocation. Just take out anything that is dealing with storage values.

If you would like, post your firstitems.lua here and I will modify it so that it will be called every time.

Hope it helped.
-Zeke
 
Here is my Firstitems.lua

function onLogin(cid)
if getPlayerGroupId(cid) == 1 and getPlayerStorageValue(cid, 50000) == -1 then
if isSorcerer(cid) then
local bag = doPlayerAddItem(cid, 1988, 1)

doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2554, 1)
doAddContainerItem(bag, 2268, 5)
doAddContainerItem(bag, 2273, 5)
doAddContainerItem(bag, 2293, 3)
doAddContainerItem(bag, 2313, 5)
doAddContainerItem(bag, 7590, 1)

doPlayerAddItem(cid, 2175, 1)
doPlayerAddItem(cid, 2187, 1)
doPlayerAddItem(cid, 2656, 1)
doPlayerAddItem(cid, 2662, 1)
doPlayerAddItem(cid, 2488, 1)
doPlayerAddItem(cid, 2195, 1)

setPlayerStorageValue(cid, 1000, 1)

elseif isDruid(cid) then
local bag = doPlayerAddItem(cid, 1988, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2554, 1)
doAddContainerItem(bag, 2268, 5)
doAddContainerItem(bag, 2273, 5)
doAddContainerItem(bag, 2293, 3)
doAddContainerItem(bag, 2313, 5)
doAddContainerItem(bag, 7590, 1)

doPlayerAddItem(cid, 2175, 1)
doPlayerAddItem(cid, 2187, 1)
doPlayerAddItem(cid, 2656, 1)
doPlayerAddItem(cid, 2662, 1)
doPlayerAddItem(cid, 2488, 1)
doPlayerAddItem(cid, 2195, 1)

setPlayerStorageValue(cid, 1000, 1)

elseif isPaladin(cid) then
local bag = doPlayerAddItem(cid, 1988, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2554, 1)
doAddContainerItem(bag, 7591, 1)
doAddContainerItem(bag, 2268, 1)
doAddContainerItem(bag, 2313, 1)

doPlayerAddItem(cid, 2455, 1)
doPlayerAddItem(cid, 2547, 100)
doPlayerAddItem(cid, 2656, 1)
doPlayerAddItem(cid, 2491, 1)
doPlayerAddItem(cid, 2488, 1)
doPlayerAddItem(cid, 2195, 1)

setPlayerStorageValue(cid, 1000, 1)

elseif isKnight(cid) then
local bag = doPlayerAddItem(cid, 1988, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 2554, 1)
doAddContainerItem(bag, 2313, 1)
doAddContainerItem(bag, 7591, 1)
doAddContainerItem(bag, 2304, 1)

doPlayerAddItem(cid, 2519, 1)
doPlayerAddItem(cid, 2407, 1)
doPlayerAddItem(cid, 2487, 1)
doPlayerAddItem(cid, 2491, 1)
doPlayerAddItem(cid, 2488, 1)
doPlayerAddItem(cid, 2195, 1)

setPlayerStorageValue(cid, 1000, 1)
end
end
return TRUE
end

And i want to say that there is no
deathpercent
in my config.lua..
 
Last edited:
I took the liberty of cleaning up your code a little bit..

Code:
function onLogin(cid)
	if getPlayerGroupId(cid) == 1 then
		if (isSorcerer(cid) or isDruid(cid)) then
			local bag = doPlayerAddItem(cid, 1988, 1)
			doAddContainerItem(bag, 2268, 5)
			doAddContainerItem(bag, 2273, 5)
			doAddContainerItem(bag, 2293, 3)
			doAddContainerItem(bag, 2313, 5) 
			doAddContainerItem(bag, 7590, 1) 

			doPlayerAddItem(cid, 2175, 1)
			doPlayerAddItem(cid, 2187, 1)
			doPlayerAddItem(cid, 2656, 1)
			doPlayerAddItem(cid, 2662, 1)

		elseif (isPaladin(cid) or isKnight(cid)) then
			local bag = doPlayerAddItem(cid, 1988, 1)
			doAddContainerItem(bag, 7591, 1)
			doAddContainerItem(bag, 2313, 1)
			doPlayerAddItem(cid, 2491, 1)

			if isPaladin(cid) then
				doAddContainerItem(bag, 2268, 1) 
				doPlayerAddItem(cid, 2455, 1)
				doPlayerAddItem(cid, 2547, 100)
				doPlayerAddItem(cid, 2656, 1)

			elseif isKnight(cid) then
				doAddContainerItem(bag, 2304, 1)
				doPlayerAddItem(cid, 2519, 1)
				doPlayerAddItem(cid, 2407, 1)
				doPlayerAddItem(cid, 2487, 1)
			end
		end

		doAddContainerItem(bag, 2120, 1)
		doAddContainerItem(bag, 2554, 1)
		doPlayerAddItem(cid, 2488, 1)
		doPlayerAddItem(cid, 2195, 1)
	end
return TRUE
end

Now about the death percent. What disto are you using?
 
Well tnx for cleaning it up.. well im using

[8.41/42] The Forgotten Server 0.3.4PL2 (Crying Damson)
 
I dont know anything about Crying Damson, I am still using MS 2.3 Although I am going to be looking into upgrading to 3.4 tonight when I have some free time!

I would recommend looking in your config.lua in your vocations.lua or any file in that /xml folder.

Looking for anyting to deal with losspercent or deathpercent.

Anyone who is using 3.4 have any idea where it is located?
 
Yeah its 8.42, If you are thinking of moving to MS 2.3, I would not recommend it. Stay with 3.4 and just wait till someone can answer where the death loss is or wait until I get home tonight and I will look it up when I see if I want to upgrade or not.

-Zeke
 
Back
Top