Scripting..

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
i know there are many threads but i just dontget how to write scrips, the scripts on mstations website are allready written so doesnt give me much exp.

i was looking how to place an npc somewhere- and adding a tele to cave command..not sure how to do it but i want to learn how to script in general

thanks
 

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
telling me where to start and how would help, as i've said i dont know how to script =/
 
Upvote 0

Jeffking

Dedicated Member
Dedicated Member
Sep 29, 2008
36
0
33
InHeaven
U must to understand this scripts:#IF , #ACT, #Elseact, #say,#elsesay.....etc, & the rest are only IMAGINATION. IS VERY SIMPLE !!! :tongue1:;)
 
Upvote 0

NewHope

Golden Oldie
Golden Oldie
Nov 18, 2005
1,311
28
184
Take a look at existing scripts to get an idea of how they work.
The basic ones in the NPC folder.
Then look at that list that the guy posted above.

:agree:
 
Upvote 0

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
thanks for the 2 above posts, 1 more question. if i want to create a new npc how do i do that? i know how to set the x,y but in geneneral can ya show me how i wud make a notepad and create 1
 
Upvote 0

Shabalabalong

Golden Oldie
Golden Oldie
Jul 1, 2006
1,067
30
134
Brighton
Go on your SQL Database (2000/2005) and TBL_NPC.

Right Click > Return All Rows

ID = Obvious
FLD_NAME = Name of the NPC, so you add it into NPC_DEF (M2Server>Envir>NPC_DEF) then say for instance its called TeleStone-16.txt you add just TeleStone into the FLD_NAME.
FLD_TYPE = No idea, I just put 0.
FLD_MAPNAME = Name of the map, for instance BW is 0 so you put 0 for BW.
FLD_X = First Set of co-ords (when you check its XXX:YYY)
FLD_Y = Second set of co-ords
FLD_FLAG = No idea lol, not great at this but I just put 0
FLD_APPEARENCE = The look of NPC, to see ingame its something like @mobnpc I think.
FLD_ENABLED = Just put 1.

Hope I helped lol, pretty basic though maybe someone will explain in more detail :X

EDIT:
For ACTUAL scripting though, when I first started I found this good (http://www.senture-mir.com/mirfiles/mir2/NPCeditor.rar)
Also generally http://www.senture-mir.com/mirfiles/mir2/ is a good website.
 
Last edited:
Upvote 0

Dazz

LOMCN Veteran
Veteran
Apr 12, 2008
296
0
43
Once you know how to use

#IF
#ELSEIF
#ACT
#ELSEACT
#SAY
#ELSESAY

It's pretty easy, just look at commands and learn :)

/Daz
 
Upvote 0

Jambo

Mir 2 Moderator
Staff member
Moderator
Dec 9, 2006
1,660
411
170
West Midlands
tbh depends how you wanner start
heres 1 example i always use this

[@Main]
Welcome there how are you \
today? Feeling tired? \
well i can help you with that \
All you have to do is collect me 15 mirscrolls \
and i will grant u a couple of hours rest \


TBH carnt remeber last bit

but after that


[@next]
ECT
 
Upvote 0

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
; ===================================
; Npc Def NPC File : Fart
; Dungeon Teleport npc in BW
; -----------------------------------
; Name: Chief
; Job: Teleporter
; Map No: 0
; Pos X
; Pos Y
; File name: *removed*
; Comment: Quest
;================================================= =
;


[@main}
#SAY
So, i see you are interested in a quest aye?\
you came just to the right place...i need you to collect some\
stuff for me.
<more/@next2>
[@next2]
#SAY
you will need to bring me the following.\
100 DragonScale\
100 Large Bone\
100 Spider Web\
<more/@next3>
@next3
#SAY
You will be rewarded with some type of Special Scrolls! Go on my friend and get me them\
<more/@next4>
#SAY
Have you got my items?
#ELSESAY
Get out of here!


why wont this show up when i click npc in game? and what shud i name file plz? i have it at fart-0.txt
 
Upvote 0

mStation

Golden Oldie
Golden Oldie
Oct 29, 2003
2,042
69
235
♫♪♫ ♦♥♠♣ ♀♂♀
[@main}
#SAY
So, i see you are interested in a quest aye?\
you came just to the right place...i need you to collect some\
stuff for me.
<more/@next2>

[@next2]
#SAY
you will need to bring me the following.\
100 DragonScale\
100 Large Bone\
100 Spider Web\
<more/@next3>

@next3
#SAY
You will be rewarded with some type of Special Scrolls! Go on my friend and get me them\
<more/@next4>
missing
#SAY
Have you got my items?
#ELSESAY
Get out of here!

the [@main} has a } instead of a ]
@next3 is without []
and there is no [@next4]
 
Upvote 0

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
ill try that, keep checking this thread, is that the reason why the window doesnt show up when i click the npc ingame?
 
Upvote 0

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
it worked, your awesome, thanks so much man =)

1more thing...what do i have to add so it can check if i have the items then give me the "scroll"?
 
Upvote 0

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
[1/3/2009 5:30:42 PM] Quest problem: DragonScale 5 Row:24 Filename: .\Envir\Npc_def\Fart-0.txt
[1/3/2009 5:30:42 PM] Quest problem: LargeBone 5 Row:25 Filename: .\Envir\Npc_def\Fart-0.txt
[1/3/2009 5:30:42 PM] Quest problem: SpiderWeb 5 Row:26 Filename: .\Envir\Npc_def\Fart-0.txt
[1/3/2009 5:30:43 PM] LoginServer Connected(127.0.0.1:5600)
[1/3/2009 5:30:46 PM] Gate[0](127.0.0.1:2119) Opened...
[1/3/2009 5:30:46 PM] DBServer Connected(127.0.0.1:6000)


[@next2]
#IF
check
DragonScale 5
LargeBone 5
SpiderWeb 5
#ACT
give SwordOfWarGod 1
break
#ELSEACT
break

what is wrong here?
 
Upvote 0

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
hmm, worked...1more thing, i know im asking alot but here it goes


if i want to make an item called PetScroll, how do i do it and how do i add the command
to give u a certain pet? or a variaty of your choice? max 2 pets
 
Upvote 0

mStation

Golden Oldie
Golden Oldie
Oct 29, 2003
2,042
69
235
♫♪♫ ♦♥♠♣ ♀♂♀
to create an iteam:
OPEN the SQL SERVER Enterprise Manager.. enter in the mir2 database.. choose Tables and right click on TBL_STDITEMS and choose OPEN TABLE -> Return All Rows..

This will make you open the stditems list.. find the item u will like to use.. in the tbl_stditems add a new item called:
PetScroll with
FLD_STDMode = 31 and
FLD_SHAPE = 0
FLD_WEIGHT = 1 or whatever u prefer
FLD_Anicount = 30 or a number which we will have to remember
set all the other fields to 0 or something that you prefer if u want them to have a decent price or whatever..
FLD_IMGINDEX is what it looks like.. copy it from another items that you want to make it look like else use lomimageviewer and open the items.wil and put the number of the frame of the looks you prefer..

most important is keeping FLD_STDMode to 31 and SHAPE to 0 so that if you double click it, it will dissapear..

Now to complete it we need to go into C:\Mirserver\M2Server\Envir\Market_Def and open QFunction-0.txt
we will have to enter the following code to make it give pets:

[@StdModeFunc30] ; Put 30 if u chosen FLD_ANICOUNT = 30 for the item..
#say
Hi <$USERNAME>! \ \
<Pet2/@pet1>, <Pet2/@pet2>\
<Exit/@exit>

[@pet1]
#ACT
RECALLMOB MOBNAME 1
#say
Here is Pet1! \ \
BREAK

[@pet2]
#ACT
RECALLMOB MOBNAME 1
#say
Here is pet2! \ \
BREAK

this is more about what you should do.. i didnt test it so i don't know if its perfect or not
 
Upvote 0

Fire

Golden Oldie
Golden Oldie
Apr 15, 2003
1,302
1
175
you will also want to use checkslavecount, or something similar (cant remember the exact wording)... otherwise you potentially will have more than 2 pets for a player
 
Upvote 0

alibaydoun

Dedicated Member
Dedicated Member
Aug 30, 2008
54
0
32
to create an iteam:
OPEN the SQL SERVER Enterprise Manager.. enter in the mir2 database.. choose Tables and right click on TBL_STDITEMS and choose OPEN TABLE -> Return All Rows..

This will make you open the stditems list.. find the item u will like to use.. in the tbl_stditems add a new item called:
PetScroll with
FLD_STDMode = 31 and
FLD_SHAPE = 0
FLD_WEIGHT = 1 or whatever u prefer
FLD_Anicount = 30 or a number which we will have to remember
set all the other fields to 0 or something that you prefer if u want them to have a decent price or whatever..
FLD_IMGINDEX is what it looks like.. copy it from another items that you want to make it look like else use lomimageviewer and open the items.wil and put the number of the frame of the looks you prefer..

most important is keeping FLD_STDMode to 31 and SHAPE to 0 so that if you double click it, it will dissapear..

Now to complete it we need to go into C:\Mirserver\M2Server\Envir\Market_Def and open QFunction-0.txt
we will have to enter the following code to make it give pets:

[@StdModeFunc30] ; Put 30 if u chosen FLD_ANICOUNT = 30 for the item..
#say
Hi <$USERNAME>! \ \
<Pet2/@pet1>, <Pet2/@pet2>\
<Exit/@exit>

[@pet1]
#ACT
RECALLMOB MOBNAME 1
#say
Here is Pet1! \ \
BREAK

[@pet2]
#ACT
RECALLMOB MOBNAME 1
#say
Here is pet2! \ \
BREAK

this is more about what you should do.. i didnt test it so i don't know if its perfect or not


i did eactly wat u said, and i @make petscroll ingame, double click it, it dissapears but nothing else happens? i set the ANICOUNT to 0 because thats what i set it too... any ideas?
 
Upvote 0