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

Start Equipment

UpAndDown

New Member
Joined
Mar 12, 2009
Messages
66
Reaction score
0
Hello, I want people to start with equipment, but that they get it only once ofcourse. For some reason the sample chars won't give over the equipment..

So I want to use a firstitem script on creaturescripts. But it's not working, I'm not getting any items when I'm creating a new character.

Code:
local firstItems =
{
        2120,
        5710,
        2000
}
local Eq = {
        knight = {8602, 2439, 8601, 2465, 2478, 2643, 2481, 2509},
        sorcerer = {2643, 2468, 8819, 8820, 2190, 2175},
        druid = {2643, 2468, 8819, 8820, 2182, 2175},
        paladin = {2643, 2465, 2478, 2389, 2511, 2480}
}

function onLogin(cid)
 if getPlayerStorageValue(cid, 30001) == -1 then
        if isKnight(cid) == TRUE then
                for i = 1, table.maxn(Eq.knight) do
                        doPlayerAddItem(cid, Eq.knight[i], 1)
                end
 if getPlayerStorageValue(cid, 30001) == -1 then
        elseif isSorcerer(cid) == TRUE then
                for i = 1, table.maxn(Eq.sorcerer) do
                        doPlayerAddItem(cid, Eq.sorcerer[i], 1)
                end
 if getPlayerStorageValue(cid, 30001) == -1 then
        elseif isDruid(cid) == TRUE then
                for i = 1, table.maxn(Eq.druid) do
                        doPlayerAddItem(cid, Eq.druid[i], 1)
                end
 if getPlayerStorageValue(cid, 30001) == -1 then
        elseif isPaladin(cid) == TRUE then
                for i = 1, table.maxn(Eq.paladin) do
                        doPlayerAddItem(cid, Eq.paladin[i], 1)
                end
        end
end

This is the script I'm using, any suggestions? :)

Thanks in advance,
UpAndDown!
 
Try this instead:
PHP:
function onLogin(cid)
 if getPlayerStorageValue(cid, 30001) == -1 then
        if isKnight(cid) == TRUE then
                for i = 1, table.maxn(Eq.knight) do
                        doPlayerAddItem(cid, Eq.knight[i], 1)
                end
        elseif isSorcerer(cid) == TRUE then
                for i = 1, table.maxn(Eq.sorcerer) do
                        doPlayerAddItem(cid, Eq.sorcerer[i], 1)
                end
        elseif isDruid(cid) == TRUE then
                for i = 1, table.maxn(Eq.druid) do
                        doPlayerAddItem(cid, Eq.druid[i], 1)
                end
        elseif isPaladin(cid) == TRUE then
                for i = 1, table.maxn(Eq.paladin) do
                        doPlayerAddItem(cid, Eq.paladin[i], 1)
                end
				end
			return TRUE
		end
end

There ya go :p
 
Last edited:
It's not working, and I also don't get any error at all. :/
Kinda annoying as new players get owned by rats! :p

Hope you can help me! :)

EDIT; also when I used this one, my GOD couldn't logon anymore!
 
PHP:
local Eq = {
        knight = {8602, 2439, 8601, 2465, 2478, 2643, 2481, 2509},
        sorcerer = {2643, 2468, 8819, 8820, 2190, 2175},
        druid = {2643, 2468, 8819, 8820, 2182, 2175},
        paladin = {2643, 2465, 2478, 2389, 2511, 2480}
}

function onLogin(cid)
    if getPlayerStorageValue(cid, 30001) == -1 then
        if isKnight(cid) then
                for i = 1, table.maxn(Eq.knight) do
                        doPlayerAddItem(cid, Eq.knight[i], 1)
                end
        elseif isSorcerer(cid) then
                for i = 1, table.maxn(Eq.sorcerer) do
                        doPlayerAddItem(cid, Eq.sorcerer[i], 1)
                end
        elseif isDruid(cid) then
                for i = 1, table.maxn(Eq.druid) do
                        doPlayerAddItem(cid, Eq.druid[i], 1)
                end
        elseif isPaladin(cid) then
                for i = 1, table.maxn(Eq.paladin) do
                        doPlayerAddItem(cid, Eq.paladin[i], 1)
                end
        end
    end
	return TRUE
end

;)
 
I still don't get any equipment when I logon to a new character. I'm using TFS 0.3.2 if that matters...

I really need this as fast as possible! :p

But thanks alot for your efforts anyways..

EDIT; still cant logon god btw with this script.
 
PHP:
function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		for i = PLAYERLOSS_EXPERIENCE, PLAYERLOSS_ITEMS do
			doPlayerSetLossPercent(cid, i, loss)
		end
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "PlayerDeath")
	
	if getPlayerGroupId(cid) < 4 and getPlayerStorageValue(cid, 30001) == -1 then

		local container = doPlayerAddItem(cid, 2000, 1)
		doAddContainerItem(bag, 2120, 1)
		doAddContainerItem(bag, 5710, 1)
		
		if isSorcerer(cid) then

		doPlayerAddItem(cid, 2175, 1)
		doPlayerAddItem(cid, 2190, 1)
		doPlayerAddItem(cid, 8819, 1)
		doPlayerAddItem(cid, 8820, 1)
		doPlayerAddItem(cid, 2468, 1)
		doPlayerAddItem(cid, 2643, 1)
		setPlayerStorageValue(cid, 30001, 1)

		elseif isDruid(cid) then

		doPlayerAddItem(cid, 2175, 1)
		doPlayerAddItem(cid, 2182, 1)
		doPlayerAddItem(cid, 8819, 1)
		doPlayerAddItem(cid, 8820, 1)
		doPlayerAddItem(cid, 2468, 1)
		doPlayerAddItem(cid, 2643, 1)
		setPlayerStorageValue(cid, 30001, 1)

		elseif isPaladin(cid) then
		
		doPlayerAddItem(cid, 2509, 1)
		doPlayerAddItem(cid, 2389, 5)
		doPlayerAddItem(cid, 2660, 1)
		doPlayerAddItem(cid, 2480, 1)
		doPlayerAddItem(cid, 8923, 1)
		doPlayerAddItem(cid, 2643, 1)
		setPlayerStorageValue(cid, 30001, 1)

		elseif isKnight(cid) then

		doPlayerAddItem(cid, 2513, 1)
		doPlayerAddItem(cid, 8602, 1)
 		doPlayerAddItem(cid, 2465, 1)
		doPlayerAddItem(cid, 2481, 1)
		doPlayerAddItem(cid, 2478, 1)
		doPlayerAddItem(cid, 2643, 1)
		setPlayerStorageValue(cid, 30001, 1)
		end
		
	end
	return TRUE
end

If this one doesn't work, then I really don't know what could work =/
 
Your creaturescripts.xml should look like this:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
	<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
	<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
	<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
	<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
</creaturescripts>
 
Make sure your God char has a vocation. If he has no vocation then he wouldn't be able to.

Also you didn't the ==TRUE for the isVoc functions, try this:
PHP:
local Eq = {
        knight = {8602, 2439, 8601, 2465, 2478, 2643, 2481, 2509},
        sorcerer = {2643, 2468, 8819, 8820, 2190, 2175},
        druid = {2643, 2468, 8819, 8820, 2182, 2175},
        paladin = {2643, 2465, 2478, 2389, 2511, 2480}
}

function onLogin(cid)
 if getPlayerStorageValue(cid, 30001) == -1 then
        if isKnight(cid) then
                for i = 1, table.maxn(Eq.knight) do
                        doPlayerAddItem(cid, Eq.knight[i], 1)
                end
        elseif isSorcerer(cid) then
                for i = 1, table.maxn(Eq.sorcerer) do
                        doPlayerAddItem(cid, Eq.sorcerer[i], 1)
                end
        elseif isDruid(cid) then
                for i = 1, table.maxn(Eq.druid) do
                        doPlayerAddItem(cid, Eq.druid[i], 1)
                end
        elseif isPaladin(cid) then
                for i = 1, table.maxn(Eq.paladin) do
                        doPlayerAddItem(cid, Eq.paladin[i], 1)
                end
			end
		end
	return TRUE
end
 
Make sure your God char has a vocation. If he has no vocation then he wouldn't be able to.

Also you didn't the ==TRUE for the isVoc functions, try this:
PHP:
local Eq = {
        knight = {8602, 2439, 8601, 2465, 2478, 2643, 2481, 2509},
        sorcerer = {2643, 2468, 8819, 8820, 2190, 2175},
        druid = {2643, 2468, 8819, 8820, 2182, 2175},
        paladin = {2643, 2465, 2478, 2389, 2511, 2480}
}

function onLogin(cid)
 if getPlayerStorageValue(cid, 30001) == -1 then
        if isKnight(cid) then
                for i = 1, table.maxn(Eq.knight) do
                        doPlayerAddItem(cid, Eq.knight[i], 1)
                end
        elseif isSorcerer(cid) then
                for i = 1, table.maxn(Eq.sorcerer) do
                        doPlayerAddItem(cid, Eq.sorcerer[i], 1)
                end
        elseif isDruid(cid) then
                for i = 1, table.maxn(Eq.druid) do
                        doPlayerAddItem(cid, Eq.druid[i], 1)
                end
        elseif isPaladin(cid) then
                for i = 1, table.maxn(Eq.paladin) do
                        doPlayerAddItem(cid, Eq.paladin[i], 1)
                end
			end
		end
	return TRUE
end

That 'doesn't' work for him, and you have just copied my earlier post -.-
(http://otland.net/f16/start-equipment-29920/#post299740)
 
Haha yes, I didn't see any difference between his and yours either. I have tried to get your way to work, but since I have to copy it to a cenOS dedicated, I forgot the command how to do it.. so I'll ask my father tomorrow.

So I'll try that tomorrow, if anyone has another idea with the firstitems.lua that would be great! :)
 
I just tested it on localhost, and it's working now. However, I get the items EVERY time I relog. I want people to only get it once...

How to fix this? :)
 
Ooops, forgot to make it set the storage value and not only check it :p
Use this:
PHP:
local Eq = {
        knight = {8602, 2439, 8601, 2465, 2478, 2643, 2481, 2509},
        sorcerer = {2643, 2468, 8819, 8820, 2190, 2175},
        druid = {2643, 2468, 8819, 8820, 2182, 2175},
        paladin = {2643, 2465, 2478, 2389, 2511, 2480}
}

function onLogin(cid)
 if getPlayerStorageValue(cid, 30001) == -1 then
        if isKnight(cid) then
                for i = 1, table.maxn(Eq.knight) do
                        doPlayerAddItem(cid, Eq.knight[i], 1)
                end
        elseif isSorcerer(cid) then
                for i = 1, table.maxn(Eq.sorcerer) do
                        doPlayerAddItem(cid, Eq.sorcerer[i], 1)
                end
        elseif isDruid(cid) then
                for i = 1, table.maxn(Eq.druid) do
                        doPlayerAddItem(cid, Eq.druid[i], 1)
                end
        elseif isPaladin(cid) then
                for i = 1, table.maxn(Eq.paladin) do
                        doPlayerAddItem(cid, Eq.paladin[i], 1)
                end
			end
		setPlayerStorageValue(cid, 30001, 1)
		end
	return TRUE
end
 
I'll check later if it works, but I'll rep both of you!

Thanks for fast help ;)

You must spread some Reputation around before giving it to Bintzer again.
??? :(
 
Back
Top