Flag Help

noisound

Golden Oldie
Golden Oldie
Jul 23, 2004
1,332
7
145
Hey, basicly i just want new players to stop spamming the welcome npc for kit. Been far to long since i even looked at a npc script lol. Fast reply please :), where am i goin wrong ><

; ===================================
; Npc Def NPC File : Welcome-0
; Welcome Notice npc in BichonProvince
; -----------------------------------
; Name: Welcome
; Job:
; Map No: 0
; Pos X
; Pos Y
; File name: *removed*
; Comment: Town Teleport npc in BichonProvince

;================================================= =
;

[@main]
#IF
CHECK [600] 1
#SAY
You have already had your start kit, stop being greedy!.
<Exit/@exit>
#ACT
BREAK
#IF
CHECK [600] 1
#SAY
Welcome To ???? Server\
Oh, your new, i take it you want your starter\
kit? \
<Yes please/@kit>\\

[@kit]
#Say
Here you go, you can not come back for a new kit\
use this set wisely.\\
#IF
#ACT
give GreatAxe
<Thanks/@exit>\\
#ELSEACT
SET [600] 1
 

Killmaster

Legend
Legendary
Golden Oldie
Loyal Member
Nov 13, 2003
3,967
27
294
You could auto give it to them upon login with a new char by using the QManage and the ISNEWHUMAN command... I think its that anyway lol.

[@main]
#IF
CHECK [600] 1
#SAY
You have already had your start kit, stop being greedy!.
<Exit/@exit>
#ELSESAY
Welcome To ???? Server\
Oh, your new, i take it you want your starter\
kit? \
<Yes please/@kit>\\

[@kit]
#Say
Here you go, you can not come back for a new kit\
use this set wisely.\\
#ACT
give GreatAxe
<Thanks/@exit>\\
#ELSEACT
SET [600] 1

should work. Simple way of doing it.
 
Upvote 0

Trinity2.3

Dedicated Member
Dedicated Member
Jun 15, 2010
154
0
42
[@main]
#IF
CHECKNAMELIST welcomekit
#ACT
GOTO @teleport
#ELSEACT
give GreatAxe
ADDNAMELIST welcomekit
#ELSESAY
Heres your free starter kit\
<Thanks/@exit>\\

[@teleport]
Teleport script goes here

This is assuming your using the teleport man, this should basically check if youve had starter kit, then redirect you to teleports if you have, otherwise the first time you click he will give your your kit.

Otherwise youll just need to add a little "#SAY" at the top, if its a separate npc your using, should work fine either way.
 
Upvote 0

boothy

LOMCN Veteran
Veteran
Mar 23, 2007
458
12
65
@kill - yeah but the set [600] 1 needs to go under #act not #elseact

#ACT
give GreatAxe
SET [600] 1
 
Upvote 0

Trinity2.3

Dedicated Member
Dedicated Member
Jun 15, 2010
154
0
42
You could auto give it to them upon login with a new char by using the QManage and the ISNEWHUMAN command... I think its that anyway lol.

Deffo advise this way tbh, does save making an npc etc plus they have it the moment they first log on, only downside is if the kit is worth cash people can make multiple chars and clog up your db....
 
Upvote 0

JealY

LOMCN VIP
VIP
Nov 28, 2004
5,354
52
305
England
[@main]
#IF
CHECK [600] 1
#SAY
You have already had your start kit, stop being greedy!\
<Exit/@exit>
#ELSESAY
Welcome To ???? Server\
Oh, you're new, i take it you want your starter kit?\
<Yes please/@kit>\\

[@kit]
#ACT
GIVE GreatAxe
SET [600] 1
#SAY
Here you go, you can not come back for a new kit,\
use this set wisely.\\
<Thanks/@exit>\\

But you should probably use a namelist instead, they are much easier to manage;

[@main]
#IF
CHECKNAMELIST StarterKitReceived.txt
#SAY
You have already had your start kit, stop being greedy!\
<Exit/@exit>
#ELSESAY
Welcome To ???? Server\
Oh, you're new, i take it you want your starter kit? \
<Yes please/@kit>\\

[@kit]
#ACT
GIVE GreatAxe
ADDNAMELIST StarterKitReceived.txt
#SAY
Here you go, you can not come back for a new kit,\
use this set wisely.\\
<Thanks/@exit>\\

Either that or do ISNEWHUMAN.

I'd suggest you check this thread out, it contains the tables I made with all the NPC commands in, with examples & explanations.
 
Last edited:
Upvote 0

noisound

Golden Oldie
Golden Oldie
Jul 23, 2004
1,332
7
145
Can you please just place step to step to explain as it would be a much bigger help, this whole thing is confusing me for these reasons:

- What makes CHECK [600] 1 harder to manage?
- Why is CHECKNAMELIST StarterKitReceived.txt easier to manage?
- What steps do i have to take to make sure it actually works?
- Where did StarterKitReceived.txt file come from?

This is why step to step instructions would solve the problem much faster and save confusion and could be recapped on for future reference.

If you could that would be greatly appreciated it, only simple code but enough to show what does what would be great.

Thanks.
 
Upvote 0

JealY

LOMCN VIP
VIP
Nov 28, 2004
5,354
52
305
England
No worries didn't realise you needed them;

What makes CHECK [600] 1 harder to manage?
Flags aren't specifically hard to manage on their own but can be hard to keep track of (When using flags it's a very good idea to make a nice list of which flags you have used, why you have used them & where)

Why is CHECKNAMELIST StarterKitReceived.txt easier to manage?
Now namelists are used instead of (or as well as) flags, basically they are the same thing, if a person has their name down on the namelist (ADDNAMELIST) then CHECKNAMELIST returns as true (Just as CHECK [xxx] 1 would) - unlike flags you can give namelists filenames, which make them a lot easier to keep on track & you can easily see who has done what (in terms of your npc) by opening up the namelists .txt file!

What steps do i have to take to make sure it actually works?
Put it in an NPC on your server & see what happens, if it does what you require it to do, then it works! (If this is what you mean) - you should have a couple of test npcs for this

Where did StarterKitReceived.txt file come from?
When you make a script that uses ADDNAMELIST *.txt (* being the name of the file) it automatically creates an empty .txt document and adds each user that has the script run's username to it, one on each line.

I hope this helps, any more questions just ask away!
 
Upvote 0

noisound

Golden Oldie
Golden Oldie
Jul 23, 2004
1,332
7
145
Where did StarterKitReceived.txt file come from?
When you make a script that uses ADDNAMELIST *.txt (* being the name of the file) it automatically creates an empty .txt document and adds each user that has the script run's username to it, one on each line.

Ok, I think I'm beginning to get the jist, so when someone finishes the quest and the file StarterKitReceived.txt is recieved:

- This will state everyones name whos ONLY used this quest?
- Will it only be specific to this NPC?
- Where will the file be placed when made?
 
Upvote 0

JealY

LOMCN VIP
VIP
Nov 28, 2004
5,354
52
305
England
Well the file is created whenever somebody uses an NPC that has something like;
#ACT
ADDNAMELIST StarterKitReceived.txt
GIVE {items}

And then everytime a new user uses that NPC their username will appear on the same list, below the last person who used it. The only way that their username will appear on the namelist is if they used the NPC.

Namelists can be used all over, like for example you could do this on an npc once a user completes a certain task;
#ACT
ADDNAMELIST CompletedHenQuest.txt
And then (just as a quick example) - you could always set an NPC like a teleporter to recognise people who have completed that quest & perhaps give them more features because they have, like so;
#IF
CHECKNAMELIST CompletedHenQuest.txt
#SAY
{Teleport script for people who have completed quest}
#ELSESAY
{Normal teleport NPC script}


Once an NPC creates a namelist it will appear in the same folder as the NPC script unless you tell it to put it elsewhere (not 100% sure but I think you can put it in seperate folders, but everytime you CHECKNAMELIST you must define which folder & filename)
 
Upvote 0

noisound

Golden Oldie
Golden Oldie
Jul 23, 2004
1,332
7
145
Ok, thanks a LOT for that, I've just tried and tested it and its working 100% so a big thank you.

There is just two more questions I'd like to ask, if there not to complicated:

1. How do I implement kill counts into a quest and will it only be on one sheet of code?

2. Is there a way I can make items needed for a quest only drop when the quest is accepted and stop them dropping when the quest is finished, and again will it only be on one sheet of code?
 
Upvote 0

JealY

LOMCN VIP
VIP
Nov 28, 2004
5,354
52
305
England
1. To be honest i'm not sure on how to do a kill count, I think they're done with variables, I think there's a few threads about it somewhere along with a couple examples though.

2. The way I would go about doing that is to do something like this in QFunction (or whatever it's called);

First I would make an NPC set a namelist to say that the user is doing the quest like;
#ACT
SETNAMELIST DoingHenQuest

Then in QFunction do something like;
[Onkill(Hen)] - i'm not to sure if this is correct you're best off searching about QFunction
#IF
RANDOM 50
#ACT
GIVE HenGiblets

Then back on the NPC do something for when they have the "HenGiblets" in this case;
#IF
CHECKITEM HenGiblets
#SAY
Hurray!
#ELSESAY
You've not got HenGiblets, go get them!\

Now with all these new files and stuff my methods could be outdated so if somebody sees a better way to do it please contribute but to my knowledge this is how I would do it.
 
Last edited:
  • Like
Reactions: noisound
Upvote 0

noisound

Golden Oldie
Golden Oldie
Jul 23, 2004
1,332
7
145
One last thing with the QFunction what will i have to add to the QFunctions to say its on the DoingHenQuest?

If you know what i mean?
basically:
How will the game know when the quest has been accepted and how will QFunctions also pick up on the quest being accepted and then when the quest is completed what happens with the function?
 
Upvote 0

JealY

LOMCN VIP
VIP
Nov 28, 2004
5,354
52
305
England
Oh yeah sorry I forgot to add that bit;
[Onkill(Hen)] - i'm not to sure if this is correct you're best off searching about QFunction
#IF
RANDOM 50
CHECKNAMELIST IsOnGibletQuest.txt
#ACT
GIVE HenGiblets
DELNAMELIST IsOnGibletQuest.txt (You could also add this if you just have the npc check if the person has the item & so the person doesn't get multiple HenGiblets)

Also i'm not sure where the QFunction goes anymore, if it's Envir & not NPC_Def or wherever your NPC is then I think you'll have to tell the script where the namelist is like so;
CHECKNAMELIST NPC_Def/IsOnGibletQuest.txt
Same thing for DELNAMELIST.
 
Last edited:
Upvote 0

IceMan

Hero's Act Mir 2
Legendary
Apr 17, 2003
8,544
2
370
350
here is a quest setup i use to help learn them

thanks to P for helping me back then.
 
Upvote 0

noisound

Golden Oldie
Golden Oldie
Jul 23, 2004
1,332
7
145
Ok I think im understanding

As I'm working on 1 quest to test it all on the aim is to get

3 OmaHeads
3 YetiHeads
3 SpiderHeads

how would it be done so it would stop at 3 of each?

would it be a case of:
CHECKITEM OmaHead 3
DELNAMELIST NoobQuest.txt

??
 
Upvote 0

JealY

LOMCN VIP
VIP
Nov 28, 2004
5,354
52
305
England
In the QFunction I think it would be something like;

#IF
RANDOM 10
CHECKNAMELIST NoobQuest.txt
CHECKITEM OmaHead 3
#ACT
break
#ELSEIF
RANDOM 10
CHECKNAMELIST NoobQuest.txt
CHECKITEM OmaHead < 3
#ACT
GIVE OmaHead

Basically this tests if the person has 3 OmaHeads in their bag, if it's true then the script stops, meaning they don't get any more. If they do not have 3 in their bag it will give them an OmaHead at a 1/10 chance.


Edit - I think I might have got it wrong, i've changed it. I'm really rusty you may just need to test.
 
Last edited:
Upvote 0

Gezza

Golden Oldie
Golden Oldie
Sep 23, 2008
2,201
61
155
uk
You should really look into using the mapquest funtion rather than qfuntion, i give you a small example, not done scripts in while but there u go. Where you begin the quest on the npc make sure you set the flag [001] (example) .

In mapquest text add something like...
; Map Flag Cond Monster Wearing Triggers
0 [001] 1 Oma * Gezza01

then in the mapquest_def folder add a text file named Gezza01

and in there add something like...

[@main]
#IF
CHECKITEM OMAHEAD 3
#ACT
SENDMSG 6 " You have all 3 omaheads come back to blah to complete this quest"
SET [001] 0
#ELSEACT
GOTO @PART2

[@PART2]
#IF
RANDOM 10
#ACT
GIVE OMAHEAD 1

As i said not done any scripting in awhile so not to sure it will work or if this is what you wanted etc, but your better off doing all this in the map quest rather than the qfuntion as after adding to much stuff like this in there it will want to take a nap :P
 
  • Like
Reactions: noisound
Upvote 0