(Quest) Such a noobish question

Mu online season 21 - grand opening

DiabloVodkaShot

LOMCN VIP
VIP
Feb 20, 2009
2,285
204
245
Hey guys,

Been a long time since i last scripted and i have totally forgot how to do some things so was hoping you guys would give me some advice.

How do i do a quest where you have to kill say 30monsters before you come back?

How do i do a quest where you have to collect so many things in your bag but you don't actually need to pick anything up it just picks it up for you but you don't need to see the quest item, the game just sees it (if this makes sense)

Thanks in advance and sorry for the noobish question
 

Gezza

Golden Oldie
Golden Oldie
Sep 23, 2008
2,202
65
135
uk
By using variables. Little guide here http://www.lomcn.co.uk/forum/showthread.php?67356-Little-Mapquest-quest-guide&highlight=variables

Personally i've always followed this...

Code:
Variables Guide
What are variables?
Variables are a way of storing numbered information about a character, guild, group or globally. This means they can be added to as a character does things throughout the game.
How can variables be used?
There really is a huge amount of uses for variables. Here are some good examples :
1) Counting the number of mobs killed
2) Keep track of how many people a player has pked
3) Setting a required number of mobs to be killed before a door opens
4) Allowing for guild points systems to buy things for the guild
And tonnes more, imagination is the limit.
How to use them:
OK, before we start, variables can be very tricky to get right. There are rules you need to follow when using them otherwise things wont work. I would suggest taking your time here and taking note of what does what...
To begin:
Start by adding a folder name "Variables" in your questdiary folder. Next within that folder add a plain text file labelled "Integral". Now your ready to learn the variable commands...
Types of Variable
Use these in the spaces labelled "type" below.
HUMAN: Variable for the player.
GROUP: Variable for an entire group, will disappear if disbanded.
GUILD: Variable for entire guild.
GLOBAL: Variable that applies to every player ingame.
Creating / Making a Variable
Var Integer Type Name (Decide on a name for the variable)

This is the most important part of the variable and is used to not only first creat the variable, but must also be used before loading a variable. This function will load the variable into the game and not a text file and therefore the data will be lost if the player logs out.
To Modify a Variable
CalcVar Type Name + 1 (can be +, -, =, as well as any number)
Will change the variable to how you specify it.
To Load a Variable
LoadVar Type Name ..\QuestDiary\Variables\Integral.txt
This will be required whenever a player logs in and so is often useful to have in Qmanage. It will simply load the value in the Integral.txt into the current variable of the player.
(Important = In order to load a variable it must have been made first)
To Save a Variable
SaveVar Type Name ..\QuestDiary\Variables\Integral.txt
When a player logs out, the current variable will be lost unless it is saved. By saving the variable, the info is added to Integral.txt so that it can be loaded later on.
Viewing the Variable through an NPC
<$Type(Name)>
This is used to view the integral through an NPC in the same way that <$USERNAME> works, simply add it to a #SAY line.
Checking the Variable
CheckVar Type Name > 0 (can be >, =, <, as well as any number)
This will simply check a variables amount in the same way that you might check for an item using checkitem.

Example : Beginners Quest
Probably the best way to see how variables work is to follow this example to add the quest to your server. The quest uses variables to tell when a player has killed 20 Scarecrows.
Beginners Quest
Beginners Quest
Setup Difficulty = Hard
This quest uses variables to ask the player to kill 20 scarecrows. Once 20 scarecrows have been killed the player is given a reward.
To add this NPC to your server :
A) Variables must be used, therefore set up Integral.txt as in the variables guide:
"Start by adding a folder name "Variables" in your questdiary folder. Next within that folder add a plain text file labelled "Integral". Now your ready to learn the variable commands..."
B) Next we need to add the main NPC to the merchants list (If you can't do that yet, wait for the relevant guide). Where you add him, or what he is called doesn't matter. Here is the NPC code: (right click, save as)
BeginnerNPC.txt
[@main]
#IF
checknamelist CompleteSCQuest.txt
#SAY
You have already completed this quest
#ELSEACT
goto @main1

[@main1]
#IF
checknamelist SCquest.txt
#ACT
goto @quest1
#ELSESAY
Hello <$USERNAME> welcome to the beginners quest. \
To complete this quest you need to kill 20 scarecrows. \\
<Attempt the quest/@attempt> \
<Not now thanks/@exit>

[@attempt]
#IF
#ACT
addnamelist SCquest.txt
SET [300] 1
Var Integer Human SCKilled
#SAY
Good luck, come back to me to check \
how many scarecrows you have killed. \\
<Exit/@exit>

[@quest1]
#IF
CheckVar Human SCKilled > 19
#ACT
give ShortSword 1
addnamelist CompleteSCQuest.txt
#SAY
Well done, you have killed enough scarecrows! \
Take this reward. \\
<Exit/@exit> \
#ELSESAY
Number of scarecrows killed : <$HUMAN(SCKilled)> \\
<Exit/@exit>


C) Now, it is important that the variable is loaded every time that a player logs in. Therefore we need to add load variable to the Qmanage.txt found in your mapquest_def folder. Add the following text into the text file:
[@Login]
#IF
#ACT
Var Integer Human SCKilled
LoadVar Human SCKilled ..\QuestDiary\Variables\Integral.txt
D) Next, we must increase the variable every time a scarecrow is killed. Therefore we need to use either Qfunction or Mapquest depending on your M2 Server. Follow the relevent section for you.
For Diamond M2 Server:
This is very simple to do simple open your QFunction.txt found in your Merchant_def folder and add the lines:
[@KillMobScarecrow]
#IF
#ACT
CalcVar Human SCKilled + 1
SaveVar Human SCKilled ..\QuestDiary\Variables\Integral.txt
For Other M2 Servers:
We are required to set up mapquest.
1) Firstly open Mapquest.txt in your Envir folder. Add the line:
0 [300] 1 Scarecrow * QSC
2) Add the following file to your Mapquest_Def folder (right click, save as)
QSC.txt
[@main]
#IF
#ACT
CalcVar Human SCKilled + 1
SaveVar Human SCKilled ..\QuestDiary\Variables\Integral.txt

E) The NPC is nearly compete, for tidyness, add the blank text files called "SCQuest" and "CompleteSCQuest" to your Merchant_def.
The NPC should now work for you ingame and allow easy modifying into any other quest
 
Last edited:
Upvote 0

DiabloVodkaShot

LOMCN VIP
VIP
Feb 20, 2009
2,285
204
245
ahh thanks found that anyways just reading it then saw this reply but cheers bud for help

---------- Post added at 03:38 PM ---------- Previous post was at 03:24 PM ----------

My question is can a variable have more than 1 quest on a npc for example if the first quest was kill 20 hens but the second quest was kill 20 hens and 20 deer is that possible? or will the variables get confused because of the @onkillhen
 
Last edited:
Upvote 0

Gezza

Golden Oldie
Golden Oldie
Sep 23, 2008
2,202
65
135
uk
Don't use the @onkillmob command in qfuntion, use the map quest way, and yes you can have it so you kill 20 deer and hen.
 
Upvote 0

Gezza

Golden Oldie
Golden Oldie
Sep 23, 2008
2,202
65
135
uk
Yeh its for flagging and use what ever you want, it just turns the quest on and off in a way.
 
Upvote 0

Gezza

Golden Oldie
Golden Oldie
Sep 23, 2008
2,202
65
135
uk
Also when testing your variable quests always test logging out and back in again as that's where a lot of people make mistakes and run in to errors. You could always do what mask done on nemesis and use them to unlock cave teleport, enjoyed that.
 
Upvote 0

DiabloVodkaShot

LOMCN VIP
VIP
Feb 20, 2009
2,285
204
245
by unlocking teleports completing quests? yerh i like that but i wanted to achieve it like three heroes where next to the it said locked untill all quests done for example:

OmaCave Locked / click here for more info

You clicked for more info it said buy your way out or complete the quest at blahblah

Then once you had completed the quest the tele npc auto updated saying Unlocked

---------- Post added at 06:01 PM ---------- Previous post was at 04:41 PM ----------

My variables arn't saving when i log out and back in any ideas what might be the reason

getting this in m2
04/08/2011 18:04:22 [½Å±¾´íÎó] ½Å±¾ÃüÁî:SAVEVAR NPCÃû³Æ:QSC µØÍ¼:0(0:0) ²ÎÊý1:Human ²ÎÊý2:nb1Killed ²ÎÊý3:..QuestDiary\Variables\Integral.txt ²ÎÊý4: ²ÎÊý5: ²ÎÊý6:
04/08/2011 18:04:31 [½Å±¾´íÎó] ½Å±¾ÃüÁî:SAVEVAR NPCÃû³Æ:QSC µØÍ¼:0(0:0) ²ÎÊý1:Human ²ÎÊý2:nb1Killed ²ÎÊý3:..QuestDiary\Variables\Integral.txt ²ÎÊý4: ²ÎÊý5: ²ÎÊý6:
 
Last edited:
Upvote 0

Gezza

Golden Oldie
Golden Oldie
Sep 23, 2008
2,202
65
135
uk
To hard to tell, post your scripts but i not worked with vars for long time so not sure i be much help. Did you load the vars in the qmanage @login ?
 
Upvote 0

DiabloVodkaShot

LOMCN VIP
VIP
Feb 20, 2009
2,285
204
245
yerh here are my scripts:

Qmanage:
[@Login]
#IF
#ACT
Var Integer Human nb1Killed
LoadVar Human nb1Killed ..\QuestDiary\Variables\Integral.txt

MapQuest:
NBA1 [300] 1 Skelebob * QSC

Mapquest folder QSC.TXT:
QSC.txt
[@main]
#IF
#ACT
CalcVar Human nb1Killed + 1
SaveVar Human nb1Killed ..QuestDiary\Variables\Integral.txt
 
Upvote 0

jet20

LOMCN Veteran
Veteran
Loyal Member
May 22, 2005
458
1
94
Timisoara.RO[mania]
i whos make all u say Gezza but something go rong me npc tell me u killed 0/20 scarecrow ... dno y ...


E) The NPC is nearly compete, for tidyness, add the blank text files called "SCQuest" and "CompleteSCQuest" to your Merchant_def.The NPC should now work for you ingame and allow easy modifying into any othe (this part i dnt undestend wath to to can explin me pls?)
 
Upvote 0