NPC Collecting items missions

imback1

Unknown member
Joined
Jul 11, 2013
Messages
776
Best answers
1
Reaction score
43
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:
OP
Limos

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
7
Reaction score
2,959
Location
Netherlands
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:

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,449
Best answers
1
Reaction score
602
Location
Estonia
how is this line working??! You are not comparing this to anything
Code:
elseif x then
x = missions[getPlayerStorageValue(cid, storage)]
 

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,352
Best answers
34
Reaction score
852
Location
Arica - Chile
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
 

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,449
Best answers
1
Reaction score
602
Location
Estonia
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:
OP
Limos

Limos

Premium User
Joined
Jun 7, 2010
Messages
10,018
Best answers
7
Reaction score
2,959
Location
Netherlands
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.
 

Simonp1512

DBhispano
Joined
Feb 22, 2009
Messages
59
Best answers
0
Reaction score
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
 

Himii

Premium User
Premium User
Joined
Jan 19, 2011
Messages
1,239
Best answers
5
Reaction score
158
Location
Sweden
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
 

Simonp1512

DBhispano
Joined
Feb 22, 2009
Messages
59
Best answers
0
Reaction score
3


i get that error i don't know what wrong, i just want to give more than 1 item on the rewards
 

erikbs

New Member
Joined
Jul 15, 2010
Messages
13
Best answers
0
Reaction score
0
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:
Top