NPC Script Release - [Checked 06/04/2010]

ρяєα¢нєя

Unstookie Titled
VIP
Aug 19, 2008
444
23
105
NPC Script Release

Thought i'd release a few scripts that i've put together, some are ones that i've put together on my server, some are scripts i've created in the Help Section, thought i might as well release them and save other people the same problems.

Free 4 All NPC's
===========================================================
Battle Areana NPC (Starter/Mover):
Code:
[@main]
#IF
#ACT
;Var Integer Human FFA 0
;LoadVar Human FFA Integral.txt
#SAY
Welcome to the <$SERVERNAME> Battle Areana, please choose the event you would \
like to take part in: \ \
<FFA Tournement/@FFA> \ \
<Exit/@exit>

[@FFA]
Free for All torunements take place every Tuesday and Thursday at 8pm (GMT). The \
rules are simple, last man standing wins. Would you like to enter? \ \ 
<Enter tournement/@FFA1> || <Back/@main>

[@FFA1]
#IF
DAYOFWEEK TUE
#ACT
GOTO @FFA1_1
#ELSEACT
GOTO @FFATHUR

[@FFA1_1]
#IF
HOUR 19 20
#ACT
GOTO @FFA1_2
#ELSEACT
GOTO @FFATHUR

[@FFA1_2]
MIN 50 59
#ACT
GOTO @FFA2
#ELSEACT
GOTO @FFATHUR

[@FFATHUR]
#IF
DAYOFWEEK THU
#ACT
GOTO @FFA2_1
#ELSESAY
Free For All matches take place on Tuesday and Thursdays at 8pm (GMT). To sign \
up to the Free For All match visit me from 10mins before the contest begins. \ \
<Exit/@exit>

[@FFA2]
#IF
HOUR 19 20
#ACT
GOTO @FFA2_2
#ELSESAY
Free For All matches take place on Tuesday and Thursdays at 8pm (GMT). To sign \
up to the Free For All match visit me from 10mins before the contest begins. \ \
<Exit/@exit>

[@FFA2_2]
#IF
MIN 50 59
#ACT
GOTO @FFA2
#ELSESAY
Free For All matches take place on Tuesday and Thursdays at 8pm (GMT). To sign \
up to the Free For All match visit me from 10mins before the contest begins. \ \
<Exit/@exit>

[@FFA2]
#SAY
Welocme <$USERNAME>, you have decided to enter todays Free For All tournement. \
When you decied you are ready to enter the area you will be moved to a holding \
area where you will have to wait for up to 10mins for other players to join the \
match. You will then all be teleported into the contest room at roughly the same \
time and can begin the contest. Please make sure you are ready to enter the arena \
as once you are moved to the holding area there will be no way out until the end \
of the match. Are you ready? \ \
<Yes/@FFAmove> || <Not yet/@exit>


[@FFAmove]
;10min
#IF
MIN 50 51
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 540
ADDBATCH FFA2
BATCHMOVE
BREAK
;9min
#IF
MIN 51 52
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 480
ADDBATCH FFA2
BATCHMOVE
BREAK
;8min
#IF
MIN 52 53
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 420
ADDBATCH FFA2
BATCHMOVE
BREAK
;7min
#IF
MIN 53 54
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 360
ADDBATCH FFA2
BATCHMOVE
BREAK
;6min
#IF
MIN 54 55
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 300
ADDBATCH FFA2
BATCHMOVE
BREAK
;5min
#IF
MIN 55 56
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 240
ADDBATCH FFA2
BATCHMOVE
BREAK
;4min
#IF
MIN 56 57
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 180
ADDBATCH FFA2
BATCHMOVE
BREAK
;3min
#IF
MIN 57 58
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 120
ADDBATCH FFA2
BATCHMOVE
BREAK
;2min
#IF
MIN 58 59
#ACT
ADDBATCH FFA1
BATCHMOVE
BATCHDELAY 60
ADDBATCH FFA2
BATCHMOVE
BREAK
#ELSESAY
Sorry i'm afraid you have missed the entry time for todays Free For All contest \
please try again next time. \ \
<Exit/@exit>
Prize Giving NPC:
Code:
[@main]
#IF
HOUR 20 21
MIN 1 3
#SAY
You need to wait around 3mins before you can access this NPC. \ \
<Exit/@exit>
#ELSEACT
GOTO @check


[@check]
#IF
CHECKMAPHUMANCOUNT FFA2 = 1
#ACT
GOTO @prize
#ELSESAY
You need to aliminate all the other contestants before you can \
access this NPC. \ \
<Exit/@exit>

[@prize]
#IF
#ACT
GIVE Prize 1
mapmove 0 334 266
;CalcVar Human FFA + 1
;SaveVar Human FFA Integral.txt
#SAY
Congratulations! You have won today's FFA! \ \
<Exit/@exit>
I've left a Variable counter in the script incase you want to keep track of how many time certain players have won, however they are currently commented out. The Variables can be useful as you can then award better prizes the more times a player wins. If you want to use the Variables you will need uncomment them (Remove the ';' before the Variable lines) and add this:

Envir->MapQuest_def->QManage.txt

Code:
[@login]
#IF
#ACT
Var Integer Human FFA 0
LoadVar Human FFA Integral.txt
The Starter/Mover NPC can be positioned on what ever map you like. The Prize giving NPC needs to be placed somewhere on FFA2.map. The maps that accompany the FFA NPC's can be found attached to this post.


Kill Count Quest
===========================================================
Quest Starter NPC:
Code:
[@main]
#IF
CHECKNAMELIST DeerComplete1.txt
#SAY
Thanks you for you help <$USERNAME>. \ \
<Exit/@exit>
#ACT
BREAK
#IF
CHECKNAMELIST DeerComplete.txt
#SAY
Thanks you for you help <$USERNAME>. Please take this reward. \ \
<Exit/@exit>
#ACT
GIVE Prize 1
ADDNAMELIST DeerComplete1.txt
BREAK
#IF
CHECKNAMELIST DeerStart.txt
#SAY
You have killed <$Human(KillCount)>/5 Deer. Please come back \
when you have killed all five. \ \
<Exit/@exit>
#ACT
BREAK
#ELSESAY
Hi would you like to take the quest? \ \
<Yes/@accept> || <No/@exit>

[@accept]
#ACT
Var Integer Human KillCount 0
SaveVar Human KillCount Integral.txt
ADDNAMELIST DeerStart.txt
SET [101] 1
#SAY
Sweet. Come back when you've killed 5 deer. \ \
<Exit/@exit>
Then add the map quest in: Envir->MapQuest.txt
Code:
[COLOR=Red]0[/COLOR]    [101]    1    Deer    *    DeerQuest
Then create a new txt document: Envir->MapQuest->DeerQuest.txt
Code:
[@main]
#IF
CheckVar Human KillCount = 5
#ACT
BREAK
#IF
CheckVar Human KillCount = 4
#ACT
GOTO @finish
BREAK
#IF
CheckVar Human KillCount < 4
#ACT
CalcVar Human KillCount + 1
SaveVar Human KillCount Integral.txt
BREAK
#ELSEACT
BREAK

[@finish]
#ACT
SET [101] 0
CalcVar Human KillCount + 1
SaveVar Human KillCount Integral.txt
ADDNAMELIST DeerComplete.txt
#SAY
You have killed enough Deer to finish the quest. Return to the NPC for you \
prize. \ \
<Exit/@exit>
Then you need to add the below lines to: Envir->MapQuests->QManage
Code:
[@login]
#IF
#ACT
Var Integer Human KillCount 0
LoadVar Human KillCount Integral.txt
For this quest to work you will need to make sure you have your files setup to use Variables. Check that you have the following setup in your files: Envir->QuestDiary->Variables->Integral.txt. If not add the 'Variables' folder and then 'Integral.txt'.

This quest will currently only work when Deers are killed on map number 0 (Bichon Province). To change this to your desired map, edit the highlighted number in the MapQuest script. Alternativly you can add another line and change the map number, and then the script will be triggered when a deer is killed on either of the maps. Obviously you can also change which monster triggers the script by changing the monster name in the MapQuest Script, and then edditing the relivent bits in the main script.


Dice Game NPC
===========================================================
http://www.lomcn.co.uk/forum/showpost.php?p=631181&postcount=8

This NPC uses two dice, one is assigned to the player (Left dice) the other to the NPC (Right Dice). Highest number wins! A player will bet a set stake on the chance that they will win, if they win, they recive double there original stake back, if it's a draw they recive three quaters of their original stake back, if they loose they get nothing.

Auto Exchangeable GoldBar/Bundle/Chest's
============================================================
http://www.lomcn.co.uk/forum/showpost.php?p=631491&postcount=20

This script allows you to create GoldBars, Bundles and Chests that can be exchanged to gold without visiting an NPC. To exchange them for gold simply double click them. This script still runs checks on the player bag gold to make sure they don't go over their limit.

Evolving Boss Mob
================================================== ==========
http://www.lomcn.co.uk/forum/showpost.php?p=641543&postcount=32

These scripts form an Evolving Boss Mob System. The player is teleported into the KR where they face the first evolution of the boss. When they've managed to kill that a second evolution of the boss spawns instantly. This goes on up until evolution five, each time the boss getting stronger and dropping better.


===========================================================
NOTE: When using Variables it is more than likley you will get errors displayed on your M2Server, don't worry though this happens to everyone, the scripts still work.

p
 

Attachments

  • FFAMap.rar
    2.3 KB · Views: 165
Last edited:
  • Like
Reactions: Mezoko and LilGod

Bon

Legend
Legendary
Jul 29, 2004
6,726
330
300
Kent, UK
Re: NPC Script Release

u really have done that totaly different to how i did mine lol, nice release tho
 

2dope

Golden Oldie
Golden Oldie
Mar 15, 2005
514
13
125
Re: NPC Script Release

Nice one Preacher mate you saved me a lot of time lol
 

TravisW

LOMCN Veteran
Veteran
Sep 4, 2007
737
17
125
Re: NPC Script Release

Yes, n1 preacher. Thanks for helping out.
 

ρяєα¢нєя

Unstookie Titled
VIP
Aug 19, 2008
444
23
105
Re: NPC Script Release

No worries guys. Heres another one:

Dice Game NPC

===========================================================
Dice Game NPC:
Code:
[@main]
Welcome <$USERNAME>! Would you like to win some money!? \
Come and play this simple game with me and you could be raking in the cash \
in seconds! \ \

Would you like to play? \ \
<Yes please/@preplay> || <Rules/@rules> || <No thanks/@exit>

[@rules]
The rules are simple, we both roll a dice the highest number wins! My dice \
will show up on the right of the box, yours on the left. We bet on the outcome,\
i offer one set stake of 100k. If you win you get double your stake back, if you \
loose you get nothing. In the case of a draw you get three quaters of your \
stake back. \ \
Would you like to play? \ \
<Yes please/@preplay> || <No thanks/@exit>


[@preplay]
Excelent first we need to sort out your stake though. Which would you like? \ \
<Low Stake/@low> - 100,000 Gold \
<Exit/@exit>
 

[@low]
#IF
Checkgold 100000
#ACT
TAKE GOLD 100000
movr d0 6
movr d1 6
inc d0 1
inc d1 1
playdice 2 @lowplay
#SAY
OK, bets placed! Lets play some dice!                                                                                               <./@lowplay> \
#ELSESAY 
You don't have enough gold to play. Please come back when you do. \ \
<Exit/@exit>

[@lowplay]
#IF
equal d0 1
equal d1 1
#ACT
GOTO @lowdraw 
BREAK
#IF
equal d0 2
equal d1 2
#ACT
GOTO @lowdraw 
BREAK
#IF
equal d0 3
equal d1 3
#ACT
GOTO @lowdraw 
BREAK
#IF
equal d0 4
equal d1 4
#ACT
GOTO @lowdraw 
BREAK
#IF
equal d0 5
equal d1 5
#ACT
GOTO @lowdraw 
BREAK
#IF
equal d0 6
equal d1 6
#ACT
GOTO @lowdraw 
BREAK


#IF
equal d0 1
equal d1 2
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 1
equal d1 3
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 1
equal d1 4
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 1
equal d1 5
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 1
equal d1 6
#ACT
GOTO @lowloose 
BREAK


#IF
equal d0 2
equal d1 1
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 2
equal d1 3
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 2
equal d1 4
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 2
equal d1 5
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 2
equal d1 6
#ACT
GOTO @lowloose 
BREAK


#IF
equal d0 3
equal d1 1
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 3
equal d1 2
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 3
equal d1 4
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 3
equal d1 5
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 3
equal d1 6
#ACT
GOTO @lowloose 
BREAK



#IF
equal d0 4
equal d1 1
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 4
equal d1 2
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 4
equal d1 3
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 4
equal d1 5
#ACT
GOTO @lowloose 
BREAK
#IF
equal d0 4
equal d1 6
#ACT
GOTO @lowloose 
BREAK



#IF
equal d0 5
equal d1 1
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 5
equal d1 2
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 5
equal d1 3
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 5
equal d1 4
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 5
equal d1 6
#ACT
GOTO @lowloose 
BREAK


#IF
equal d0 6
equal d1 1
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 6
equal d1 2
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 6
equal d1 3
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 6
equal d1 4
#ACT
GOTO @lowwin 
BREAK
#IF
equal d0 6
equal d1 5
#ACT
GOTO @lowwin 
BREAK
#ELSESAY
??????????????? \
<Exit>

[@lowdraw]
#ACT
GIVE GOLD 75000
#SAY
It's a Draw! \ \
<$USERNAME> rolled: <$STR(D0)> \
NPC rolled: <$STR(D1)> \ \
Here, take some money back. Play again?\ \
<Yes/@preplay> || <No/@exit>

[@lowwin]
#ACT
GIVE GOLD 200000
#SAY
You Win! \ \ 
<$USERNAME> rolled: <$STR(D0)> \
NPC rolled: <$STR(D1)> \ \
Here take your winnings. Play again? \ \
<Yes/@preplay> || <No/@exit>

[@lowloose]
#SAY
You loose! \ \
<$USERNAME> rolled: <$STR(D0)> \
NPC rolled: <$STR(D1)> \ \
No money for you i'm afraid. Play again? \ \
<Yes/@preplay> || <No/@exit>


;=================================================
This NPC uses two dice, one is assigned to the player (Left dice) the other to the NPC (Right Dice). Highest number wins! A player will bet a set stake on the chance that they will win, if they win, they recive double there original stake back, if it's a draw they recive three quaters of their original stake back, if they loose they get nothing.

The above NPC only has one set Stake, you can easily add others though by copying everything below the [@preplay] section and changing them to [@med],[@medplay],[@medloose],[@meddraw],[@medwin] and changing all the GOTO links (this can all be done using the Find->Replace function in NotePad (Copy to seperate file first)). Then all you have to do is set the desired stake in [@preplay] and the desired winnings in [@medwin] and [@meddraw].

p
 
Last edited:

2dope

Golden Oldie
Golden Oldie
Mar 15, 2005
514
13
125
Re: NPC Script Release

You really are a star Preacher lol
 

Liandrin2

Golden Oldie
Golden Oldie
Loyal Member
Jan 14, 2004
890
6
125
Re: NPC Script Release

Nice work, I like organised scripts :)

Might want to change this, just something I noticed

[@low]
#IF
Checkgold 100000
#ACT
TAKE GOLD 10000
 

Bon

Legend
Legendary
Jul 29, 2004
6,726
330
300
Kent, UK
Re: NPC Script Release

that dice script is very useful, nice script

took me ages figurin out them dice games lol
 

Trapped1

Dedicated Member
Dedicated Member
Jun 21, 2008
93
1
54
Re: NPC Script Release

Wow nice releases, will come in handy :) :) :)
 

ρяєα¢нєя

Unstookie Titled
VIP
Aug 19, 2008
444
23
105
Re: NPC Script Release

Auto Exchangeable GoldBar/Bundle/Chest's
============================================================
Someone asked for some help on this in help section. Thought i might as well add it here incase anyone else wants it.

Firstly you need to make a few changes in TBL_STDITEMS. Find your GoldBar, GoldBarBundle and GoldChest and change the following fields:

STD_ITEMS:
Code:
GoldBar:
FLD_STDMODE = 31
FLD_ANICOUNT = 27

GoldBarBundle:
FLD_STDMODE = 31
FLD_ANICOUNT = 28

GoldChest:
FLD_STDMODE = 31
FLD_ANICOUNT = 29

Then you need to add the below to Envir->Market_Def->QFunction-0.txt:
Code:
[@StdModeFunc27]
#IF
checkgold 49000001
#SAY
You cannot Exchange goldbar into money.\
your bankbalance would exceed its limit.\ \
<Cancel/@exit>
#ACT
GIVE GoldBar 1
BREAK
#ELSEACT
give gold 1000000
#ELSESAY
GoldBar was Exchanged into money.\
<Cancel/@exit>

[@StdModeFunc28]
#IF
checkgold 45000001
#SAY
You cannot Exchange goldbar into money.\
your bankbalance would exceed its limit.\ \
<Cancel/@exit>
#ACT
GIVE GoldBarBundle 1
BREAK
#ELSEACT
give gold 5000000
#ELSESAY
GoldBarBundle was Exchanged into money.\
<Cancel/@exit>

[@StdModeFunc29]
#IF
checkgold 40000001
#SAY
You cannot Exchange goldbar into money.\
your bankbalance would exceed its limit.\ \
<Cancel/@exit>
#ACT
GIVE GoldChest 1
BREAK
#ELSEACT
give gold 10000000
#ELSESAY
GoldChest was Exchanged into money.\
<Cancel/@exit>

This script is asuming your bag gold limit is 50m, if it's not all you'll have to do is change the calculations.

p
 
Last edited: