Eduardo170
Well-Known Member
Hi guys, In the first items script nothing happens, it dont show errors, but neither does it grant the articles to new players.
problem first item solved by @d0gw4r (check out down)
2-This scripts dont rewards with items established. It also lets you open all the chests.
problem first item solved by @d0gw4r (check out down)
creaturescript.xml
login.lua
Code:
<event type="login" name="FirstItems" script="others/firstitems.lua" />
Code:
-- Without Rookgaard
local config = {
[1] = {
--equipment spellbook, wand of vortex, magician's robe, mage hat, studded legs, leather boots, scarf
items = {{2175, 1}, {2190, 1}, {8819, 1}, {8820, 1}, {2468, 1}, {2643, 1}, {2661, 1}},
--container rope, shovel, mana potion
container = {{2120, 1}, {2554, 1}, {7620, 1}}
},
[2] = {
--equipment spellbook, snakebite rod, magician's robe, mage hat, studded legs, leather boots scarf
items = {{2175, 1}, {2182, 1}, {8819, 1}, {8820, 1}, {2468, 1}, {2643, 1}, {2661, 1}},
--container rope, shovel, mana potion
container = {{2120, 1}, {2554, 1}, {7620, 1}}
},
[3] = {
--equipment dwrven shield, 5 spear, ranger's cloak, ranger legs scarf, legion helmet
items = {{2525, 1}, {2389, 5}, {2660, 1}, {8923, 1}, {2643, 1}, {2661, 1}, {2480, 1}},
--container rope, shovel, health potion, bow, 50 arrow
container = {{2120, 1}, {2554, 1}, {7618, 1}, {2456, 1}, {2544, 50}}
},
[4] = {
--equipment dwarven shield, steel axe, brass armor, brass helmet, brass legs scarf
items = {{2525, 1}, {8601, 1}, {2465, 1}, {2460, 1}, {2478, 1}, {2643, 1}, {2661, 1}},
--container jagged sword, daramian mace, rope, shovel, health potion
container = {{8602, 1}, {2439, 1}, {2120, 1}, {2554, 1}, {7618, 1}}
}
}
function onLogin(player)
local targetVocation = config[player:getVocation():getId()]
if not targetVocation then
return true
end
if player:getLastLoginSaved() ~= 0 then
return true
end
for i = 1, #targetVocation.items do
player:addItem(targetVocation.items[i][1], targetVocation.items[i][2])
end
local backpack = player:addItem(1988)
if not backpack then
return true
end
for i = 1, #targetVocation.container do
backpack:addItem(targetVocation.container[i][1], targetVocation.container[i][2])
end
return true
end
Code:
player:registerEvent("FirstItems")
2-This scripts dont rewards with items established. It also lets you open all the chests.
Code:
local storage_id = 2000
local rewards = {
[1] = {chest_uid = 2001, reward_id = 2494, reward_count = 1}, --demon armor
[2] = {chest_uid = 2002, reward_id = 2400, reward_count = 1}, --magic sword
[3] = {chest_uid = 2003, reward_id = 2431, reward_count = 1}, --stonecuter axe
[4] = {chest_uid = 2004, reward_id = 2421, reward_count = 1} --thunder hammer
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local storage = player:getStorageValue(storage_id)
if storage > 0 then
return player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
end
local reward
for i = 1, #rewards do
if rewards[i].chest_uid == item.uid then
reward = rewards[i]
break
end
end
local reward_type = ItemType(reward.reward_id)
if reward_type then
if player:addItem(reward.reward_id, reward.reward_count, false, 1, CONST_SLOT_WHEREEVER) then
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a " .. reward_type:getName():lower() .. ".")
player:setStorageValue(storage_id, 1)
else
local weight = reward_type:getWeight()
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found an item weighing ' .. weight / 100 .. ' oz it\'s too heavy or you do not have enough room.')
end
end
return true
end
Code:
19:00 You have found a dead orc.
19:00 You have found a dead goblin.
19:00 You have found a dead elf.
19:00 You have found a remains of a mummy.
Last edited: