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

NPC Collecting items missions

setPlayerStorageValue(cid, storage, -1) xstorage = getPlayerStorageValue(cid, storage)
The script you posted above this still had the comma, I've tested this script and it works fine for me, I can create the npc and start with the missions, if you get new errors, post them.
there isn't coma lol, and i can make the npc but the missions didn't restart on new day i gone send you meeting id to check it -.-
 
Last edited:
Solved on teamviewer.
For the missions to reset every day regardless if the missions are finished or not (for people who want the same thing), move the exhaustion.set line under the end and add the same line above "elseif x then".
Then change > 5 to > 0.
 
Last edited:
how is this line working??! You are not comparing this to anything
Code:
elseif x then
x = missions[getPlayerStorageValue(cid, storage)]
 
how is this line working??! You are not comparing this to anything
Code:
elseif x then
x = missions[getPlayerStorageValue(cid, storage)]
that check the storage to collect the items for the respective missions
 
that check the storage to collect the items for the respective missions

how can it check the storage to collect the item? there is no reference to the items..
under missions there is only: items, message, level, rewarditem, rewardemissions

or you mean? this line:
missions[getPlayerStorageValue(cid, storage)]
means this: (checks all the possibilites)
if items = {id = 5890, count = 12}, {id = 5878, count = 20}, {id = 5896, count = 15}, etc then
if message = "Great, I need alot of items, but you can start with" then
if level = 15 then
rewarditem = {id = 2160, count = 1} then
rewardemissions[getPlayerStorageValue(cid, 45550)]p = 15000 then


EDIT:
ok i get it now.

It compares the missions value, because mission has has integer values and his using it also inside the storage value.
 
Last edited:
It checks if missions[getPlayerStorageValue(cid, storage)] exists, so if it's not nil, it exists if the storage value is 1, 2, 3, 4 or 5 (if you use 5 missions), since that would be missions[1], missions[2], etc.
x gets the current mission based on the player storage value.
For example this.
Code:
if x then
      selfSay(x.message.." "..getItemsFromTable(x.items)..".", cid)
else
      selfSay("Thanks alot! I can finish my research now.", cid)
end
If x then checks if the storage value is used as number in the missions table. At the end the storage value will be 6 (with 5 missions) so then x will be missions[6], and since missions[6] doesn't exist in the missions table it will do the else part that lets the npc say the player completed the missions.
 
TiadRp9.png

thanks you! <3
 
Change rewarditem to a table with more tables like items.
Code:
rewarditem = {
   {id = 2160, count = 1},
   {id = 2112, count = 1}
}
Then to add the item, use a loop just like with items.
Code:
for r = 1, #x.rewarditem do
     doPlayerAddItem(cid, x.rewarditem[r].id, x.rewarditem[r].count)
end
For the textmessage you can use the function getItemsFromTable to get the items a player received in the textmessage.
Code:
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You received "..getItemsFromTable(x.rewarditem)..".")


i don't know how to use that lines

i try this
Code:
[2] = {items = {
     {id = 5898, count = 20},
     {id = 5921, count = 28},
     {id = 5899, count = 15},
     {id = 5905, count = 25}
     },
     message = "Thank you, the next items are",
     level = 120,
    {rewarditem =
   {id = 2160, count = 1},
   {id = 2112, count = 1}
},

but always get a error on the console, please tellme how to use that thx
 
i don't know how to use that lines

i try this
Code:
[2] = {items = {
     {id = 5898, count = 20},
     {id = 5921, count = 28},
     {id = 5899, count = 15},
     {id = 5905, count = 25}
     },
     message = "Thank you, the next items are",
     level = 120,
    {rewarditem =
   {id = 2160, count = 1},
   {id = 2112, count = 1}
},

but always get a error on the console, please tellme how to use that thx
Tell us the error you get, makes a world of a difference
 
2hnvtix.jpg


i get that error i don't know what wrong, i just want to give more than 1 item on the rewards
 
Hi guys. I seem to have an issue with this. I get the items requested and have them in my bp. The npc takes the items (as he should), I recieve item as reward, but no experience.

Any thoughts? The script is identical to the first script posted in this thread, except I changed items needed to 12 cheese.

Thanks :)

Without changing ANYTHING, it suddenly worked XD Great hehe
 
Last edited:
Back
Top