ID:228631
 
(See the best response by Robertbanks2.)
Alright I have a little quest system, it works like so; you start the game with a variable called talk, which is at 0. everytime you talk to an NPC, talk rises. if talk ==1 then you can do a quest, but once it rises you cannot do it again, which is good. but everytime you kill an enemy you get +1 to your quest, a variable. my first quest, if you get 10 quest(the variable), your quest is subtracted by 10 then the quest is completed. what worries me is that you get +1 quest EVERY NPC you kill, which doesn't work with the quest. any better systems?
I use a similar system. Different in many ways, too, however.

I can't think of any other way to have it other than to define different quest variables for your different quests.

So instead of just 'quest +1', you would have to define: quest1, quest2, quest3, etc.
For example: (This is very similar to what I use)
mob/var
onquest1
onquest2

quest1killed
quest2killed
//I would set the following two variables to be "Incomplete" for the brand new characters.
quest1="Incomplete"
quest2="Incomplete"

mob/QuestNPC
QuestNPC1
icon='icon.dmi'
name="name"
verb/Talk()
if(usr.quest1=="Complete")
usr<<"This quest is complete."
return
if(usr.quest1=="Incomplete")
if(usr.disabledquest1==0)
switch(alert("Do you want to be on this quest?","Quest","Yes","No"))
if("No")
return
if("Yes")
usr<<"You are now on this quest."
usr.disabledquest1=1
return
if(usr.disabledquest1==1)
if(usr.quest1killed>=10)
usr<<"Quest is now complete."
usr.disabledquest1=0
usr.quest1="Complete"
else
usr<<"You haven't completed this quest yet. You killed [usr.quest1killed]/10."
return


This is assuming you need 10 *particular* NPC (not just any NPC) kills for that quest.

Edit: For some reason, the word "on" in the variables in the code are being changed to "disabled".
Not exactly sure why, but the variables that say "disabledquestX" should say "onquestX".
thanks, ill try to put it in and test it out.
Code\Quest.dm:19:error: usr.quest1: undefined var
Code\Quest.dm:22:error: usr.quest1: undefined var
Code\Quest.dm:23:error: usr.onquest1: undefined var
Code\Quest.dm:29:error: usr.onquest1: undefined var
Code\Quest.dm:31:error: usr.onquest1: undefined var
Code\Quest.dm:32:error: usr.quest1killed: undefined var
Code\Quest.dm:34:error: usr.onquest1: undefined var
Code\Quest.dm:35:error: usr.quest1: undefined var
Code\Quest.dm:37:error: usr.quest1killed: undefined var

RPGStarter.dmb - 9 errors, 0 warnings (double-click on an error to jump to it)



that is what I get.
Best response
That's what you get for copy pasting. Don't copy paste, study what people give you so you actually learn how to do it.
fixed it, shouldve been mob/var. but when i right click the npc to talk, nothing happens
Use:

set src in oview(1) // Only people next to the NPC can talk to him.


I think it was like that.

I put it in under the talk verb, but then it has 85 errors.
Showcode.
mob/var

onquest1
onquest2

quest1killed
quest2killed
//I would set the following two variables to be "Incomplete" for the brand new characters.
quest1="Incomplete"
quest2="Incomplete"

mob/QuestNPC
QuestNPC
icon='Magician.dmi'
verb/Talk()
set src in oview(1) // Only people next to the NPC can talk to him.
if(usr.quest1=="Complete")
usr<<"This quest is complete."
return
if(usr.quest1=="Incomplete")
if(usr.disabledquest1==0)
switch(alert("Do you want to be on this quest?","Quest","Yes","No"))
if("No")
return
if("Yes")
usr<<"You are now on this quest."
usr.disabledquest1=1
return
if(usr.disabledquest1==1)
if(usr.quest1killed>=10)
usr<<"Quest is now complete."
usr.disabledquest1=0
usr.quest1="Complete"
else
usr<<"You haven't completed this quest yet. You killed [usr.quest1killed]/10."
return
then i get
 loading RPGStarter.dme
loading Interface.dmf
Code\Quest.dm:16:error: src: duplicate definition
Code\Quest.dm:16:error: 1: value not allowed here
Code\Quest.dm:16:error: oview: instruction not allowed here
Code\Quest.dm:16:error: : duplicate definition
Code\Quest.dm:16:error: in: instruction not allowed here
Code\Quest.dm:17:error: usr.quest1: duplicate definition
Code\Quest.dm:17:error: "Complete": duplicate definition
Code\Quest.dm:17:error: ==: instruction not allowed here
Code\Quest.dm:17:error: : duplicate definition
Code\Quest.dm:20:error: usr.quest1: duplicate definition
Code\Quest.dm:20:error: "Incomplete": duplicate definition
Code\Quest.dm:20:error: ==: instruction not allowed here
Code\Quest.dm:20:error: : duplicate definition
Code\Quest.dm:18:error: usr: duplicate definition
Code\Quest.dm:18:error: "This quest is complete.": duplicate definition
Code\Quest.dm:18:error: <<: instruction not allowed here
Code\Quest.dm:19:error: return: instruction not allowed here
Code\Quest.dm:18:error: : duplicate definition
Code\Quest.dm:21:error: usr.onquest1: duplicate definition
Code\Quest.dm:21:error: 0: duplicate definition
Code\Quest.dm:21:error: ==: instruction not allowed here
Code\Quest.dm:21:error: : duplicate definition
Code\Quest.dm:29:error: usr.onquest1: duplicate definition
Code\Quest.dm:29:error: 1: duplicate definition
Code\Quest.dm:29:error: ==: instruction not allowed here
Code\Quest.dm:29:error: : duplicate definition
Code\Quest.dm:22:error: "Do you want to be on this quest?": duplicate definition
Code\Quest.dm:22:error: "Quest": duplicate definition
Code\Quest.dm:22:error: "Yes": duplicate definition
Code\Quest.dm:22:error: "No": duplicate definition
Code\Quest.dm:22:error: : empty type name (indentation error?)
Code\Quest.dm:23:error: "No": duplicate definition
Code\Quest.dm:25:error: "Yes": duplicate definition
Code\Quest.dm:24:error: return: instruction not allowed here
Code\Quest.dm:24:error: : duplicate definition
Code\Quest.dm:26:error: usr: duplicate definition
Code\Quest.dm:26:error: "You are now on this quest.": duplicate definition
Code\Quest.dm:26:error: <<: instruction not allowed here
Code\Quest.dm:27:error: usr.onquest1: undefined var
Code\Quest.dm:28:error: return: instruction not allowed here
Code\Quest.dm:26:error: : duplicate definition
Code\Quest.dm:23:error: : empty type name (indentation error?)
Code\Quest.dm:22:error: : duplicate definition
Code\Quest.dm:30:error: usr.quest1killed: duplicate definition
Code\Quest.dm:30:error: 10: duplicate definition
Code\Quest.dm:30:error: >=: instruction not allowed here
Code\Quest.dm:30:error: : empty type name (indentation error?)
Code\Quest.dm:31:error: usr: duplicate definition
Code\Quest.dm:31:error: "Quest is now complete.": duplicate definition
Code\Quest.dm:31:error: <<: instruction not allowed here
Code\Quest.dm:32:error: usr.onquest1: undefined var
Code\Quest.dm:33:error: usr.quest1: undefined var
Code\Quest.dm:31:error: : empty type name (indentation error?)
Code\Quest.dm:35:error: usr: duplicate definition
Code\Quest.dm:35:error: usr.quest1killed: value not allowed here
Code\Quest.dm:35:error: : empty type name (indentation error?)
Code\Quest.dm:35:error: text"You haven't completed this quest yet. You killed []/10.": value not allowed here
Code\Quest.dm:35:error: : duplicate definition
Code\Quest.dm:35:error: <<: instruction not allowed here
RPGStarter.dme:31:error: return: instruction not allowed here
Code\Quest.dm:30:error: : duplicate definition
Code\Quest.dm:21:error: : duplicate definition
Code\Quest.dm:17:error: : empty type name (indentation error?)

RPGStarter.dmb - 63 errors, 0 warnings (double-click on an error to jump to it)
You're missing indentation in the set src in oview(1).
when I indent it,
 loading RPGStarter.dme
Code\Quest.dm:16:error: inconsistent indentation

RPGStarter.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
You're indenting it wrong. First delete the line, re-write it without ani indentation and then press tab to indent it.
didnt help
I'll fix it for you this time, but next time be sure to read the DM Guide.

mob/QuestNPC
QuestNPC
icon='Magician.dmi'
verb/Talk()
set src in oview(1) // Only people next to the NPC can talk to him.
if(usr.quest1=="Complete")
usr<<"This quest is complete."
return
if(usr.quest1=="Incomplete")
if(usr.disabledquest1==0)
switch(alert("Do you want to be on this quest?","Quest","Yes","No"))
if("No")
return
if("Yes")
usr<<"You are now on this quest."
usr.disabledquest1=1
return
if(usr.disabledquest1==1)
if(usr.quest1killed>=10)
usr<<"Quest is now complete."
usr.disabledquest1=0
usr.quest1="Complete"
else
usr<<"You haven't completed this quest yet. You killed [usr.quest1killed]/10."
return
thanks, but when i talk to it now the NPC wont say anything...
wait, he talks, i had to edit the variable to 0. Now, how do I assign a certain monster to kill?
Filthynate, I believe all of your programming issues can be solved here. Although, I suggest reading the whole thing.
My code suggestion was not for copy and pasting. You were supposed to implement it so it suits your game. I also left out a few parts (because they should be obvious). Such as the "set src in oview()".
If you are a beginner programmer, I recommend that you use and read the guides and references that B.Y.O.N.D. and the community gives you, like Kumorii said.
If you have any other problems, I'll be happy to try to assist you.
Good luck!
P.S. Why is "on" being changed to "disabled"?