Guides of RPGWO Part 6
Scripts for Events
-/eventcompile - compiles your script
- each script needs a BEGIN statement to tell the system where to begin
execution
- added Subroutines... define with SUB and use RETURN to exit the
sub, to
enter a sub use GOSUB
- plus all the other commands in the guide.es in the implemented area
work
- use /eventstart to start, /eventstop to stop,
/event to display
- in world.ini use EVENTSTART= to start scripts at world
startup... does not
work yet, heh, has some bugs I need to figure out, but just letting you
know
- as you can see in the "not implemented' section, I still have a lot
planned
- I would test ALL scripts on your home server first before using in the
live worlds
Scripts need to be located in your server folder.
A good understanding of VB or programming helps when making these scripts.
---Script KeyWord List
;;;;; Implemented commands...
;;; Notes on strings...
;;; - enclose variable names in % in string messages like the global to print variables out
;;; - example (assume tag1 is a variable): Global Hello World %tag1%
;;; - use 2 % to print a single %
;;; - example: MonsterChat Tag1, I have 100%% life.
; -- use a @ in front of label to denote a gosub instead of a goto
; Example: IfMonsterExist MonsterTag1, @sub1
; Hidden ; does not show up in /event command
; Log TRUE | FALSE ; each line is logged as it is executed
; Begin ; starting point of execution
; End ; stop script
; Goto
; Sub ; start of a subroutine
; Gosub
; Return ; returns from a sub
; EndSub ; same as Return but more explicit
; : ; label
; EventStart
; Arguments for scripts when started from other scripts
; - Arg0, Arg1, ... , Arg9
; Dim
; Let = | |
; => +
; => -
; => *
; => /
; => |
; GetFreeTag() ; returns an unused tag and marks it as used until script ends
; Example: Let Tag1 = GetFreeTag()
; GetChatUUID() ; returns the player uuid that met the last IfPlayerChat criteria
; Example: Let UUID1 = GetCHatUUID()
; RND() ; returns a random number from min to max (default 0 to 100), longs only
; example: Let R1 = RND()
; GetNearestPlayer() ; used to get the last player found with ifplayernear or not
; ; this includes tames
; Example: WarpPlayer GetNearestPlayer(), 100, 100, 0
; MaxRnd ; sets the max for RND() to return
; MinRnd ; sets the min for RND() to return
; Title ; shows up when player types /event
; Global ; sent out to all players
; LocalChat , , , ,
;***NEW SendMessage ,
; MailSend , ; admins names, remove @
; Wait <20 second interval(s)>
; MonsterAdd , , , , ,
; MonsterGoto , , ; sets all to goto x,y
; MonsterRemove ; remove monsters with
; IfNotMonsterExist , ; if monsters with the not exist then
; goto else fall through
; IfMonsterAT , , , ,
; IfNotMonsterAT , , , ,
; MonsterChat ,
; MonsterIgnoreAll , TRUE | FALSE
; MonsterAttackable , TRUE | FALSE ; players cannot attack the monster
; MonsterAcceptItem ,
;***MODIFIED IfMonsterHasItem , , ,
;***MODIFIED IfNotMonsterHasItem , , ,
; MonsterLocation , , , ; places x,y,z in the vars
; MonsterFollow , | | ,
; MonsterNewHome ; stops the monster and holds them at current spot
;***MODIFIED IfPlayerNear , , , , ; includes tames???
; fixed a bug... might have messed up tame detection
;***MODIFIED IfNotPlayerNear , , , , ; includes tames???
; fixed a bug... might have messed up tame detection
; ItemAdd , , , , ,
; ItemRemove
; ItemData , , , , , , , ,
;***NEW ItemLock , TRUE | FALSE
;***NEW ItemGive ,
; moves itemtag from ground into players inventory, so you make it on the ground first w/data, etc
; IfItemAt , , , , ,
; IfNotItemAt , , , , ,
; RecordChatOn , , , , ; saves player chat near a tagged monster
; RecordChatOff ; stops logging on this tag
; RecordChatReset ; clears all chat logged on this tag
; IfPlayerChat , ,
; Animation , , ,
; WarpPlayer , , ,
; IfEquals , , ; if 1 = 2 then goto label
; IfGreater , , ; if 1 > 2 then goto label
; IfLess , , ; if 1 < 2 then goto label
;***NEW GiveXp ,
;***NEW Distance , , , , ; puts distance into
;;;;; Normally push and pop are used internally for gosub and return
;;;;; but can be used as long as gosub or @ was not called
; Push
; Pop
;;;;;;;; not implemented yet
; LoadPlayer , ; loads a player onto another "player", ie boat
; UnloadPlayer , ; unloads a player from another "player", ie boat
; SpotItemClear , , ; remove any item there
; NPCTag , ; tagging existing NPC/Monsters
; MonsterGiveItem , - ,
; MonsterArmItem , -
; GlobalChat
; IfChance ,
; MonsterSpawnAdd , , , , , ,
; MonsterSpawnRemove , , | ; use for NPCs
; MapAdd , , , ,
; GivePlayerXp , , ,
; LandPlotClaim ,
; LandPlotUnClaim ,
; MonsterSetHome ; where ever they are, gets set as home
; MonsterCount() ; returns count
; ItemUse ,
; MonsterNPCIgnore , TRUE | FALSE ; npc gaurds ignore the monster
; TriggerPlayer() ; returns the player who triggered the event
; ChatPlayer ; returns uuid of player that said phrase
; MonsterStalk , | |
; MonsterGaurd
; MonsterHome
; MonsterSetFire , TRUE | FALSE
; ItemMovable , TRUE | FALSE
; ItemReset ,
; ItemWriting ,
An example script:
;; bandit rob haven
;; send in a scout to locate the bank
;; if scout comes back, send in small force
;; if scout dies send in larger force
;; Have bandits start off outside of town
;; Move them towards the bank
;; Have them wait at bank 5 minutes
;; move them out of town
;;;;;;;;;;;;;;;
BEGIN
Dim StartX
Dim StartY
Dim ShopX
Dim ShopY
Dim BanditTag
Dim ScoutTag
Dim BaronTag
Dim RogueTag
Let StartX = 1455
Let StartY = 1645
Let ShopX = 1465
Let ShopY = 1680
;Let StartX = 100
;Let StartY = 100
;Let ShopX = 120
;Let ShopY = 120
Let BanditTag = GetFreeTag()
Let ScoutTag = GetFreeTag()
Let BaronTag = GetFreeTag()
Let RogueTag = GetFreeTag()
Title Bandits Raid Haven
;;;;;;;;;;;;;;;
Global The town of Haven is a peaceful, safe place for the wandering adventurer... also the perfect place for bandits to raid!!!
MonsterAdd Bandit Scout, startx, starty, 0, 1, ScoutTag
MonsterGoto ScoutTag, ShopX, ShopY-5
MonsterIgnoreAll ScoutTag, True
;;;;;;;;;;;;;;;
:WaitForScout1
Wait 1
IfMonsterAt ScoutTag, ShopX, ShopY-5, 2, ScoutAtBank
IfNotMonsterExist ScoutTag, ScoutKilled
Goto WaitForScout1
;;;;;;;;;;;;;;;;;;
:ScoutAtBank
Wait 2
MonsterGoto ScoutTag, StartX, StartY
;;;;;;;;;;;;;;;;;;
:WaitForScout2
IfMonsterAt ScoutTag, StartX, StartY, 2, ScoutAtForest
IfNotMonsterExist ScoutTag, ScoutKilled
Goto WaitForScout2
;;;;;;;;;;;;;;;;;;
:ScoutKilled
Global A Bandit Scout has been spotted and killed near Haven!
Wait 4
MonsterAdd Bandit Baron, startx, starty, 0, 1, BaronTag
MonsterAdd Bandit Rogue, startx, starty, 0, 1, RogueTag
MonsterChat RogueTag, My Baron\, our scout has not returned and I fear he is dead.
Wait 1
MonsterChat BaronTag, I agree. We shall move forward but with greater forces and wariness.
MonsterAdd Bandit Mage, startx, starty, 0, 4, BanditTag
MonsterAdd Bandit Archer, startx, starty, 0, 4, BanditTag
MonsterAdd Bandit, startx, starty, 0, 4, BanditTag
MonsterAdd Bandit Rogue, startx, starty, 0, 4, BanditTag
MonsterAdd Bandit Spar, startx, starty, 0, 4, BanditTag
Wait 1
MonsterChat BaronTag, Let's go.
MonsterGoto BanditTag, Shopx, ShopY
MonsterGoto RogueTag, Shopx, ShopY
MonsterGoto BaronTag, Shopx, ShopY
Goto Attackhaven
;;;;;;;;;;;;;;;;;;
:ScoutAtForest
MonsterAdd Bandit Baron, startx, starty, 0, 1, BaronTag
MonsterChat BaronTag, Report what you have found out.
Wait 1
MonsterChat ScoutTag, The bank is not well guarded. A small force should suffice.
Wait 1
MonsterChat BaronTag, Good, we shall take them easily.
MonsterAdd Bandit Mage, startx, starty, 0, 4, BanditTag
MonsterAdd Bandit Archer, startx, starty, 0, 4, BanditTag
MonsterAdd Bandit, startx, starty, 0, 4, BanditTag
MonsterIgnoreAll ScoutTag, False
Wait 1
MonsterChat BaronTag, Let's go.
MonsterGoto BanditTag, Shopx, ShopY
MonsterGoto RogueTag, Shopx, ShopY
MonsterGoto BaronTag, Shopx, ShopY
MonsterGoto ScoutTag, Shopx, ShopY
Goto Attackhaven
;;;;;;;;;;;;;;;;;;
:AttackHaven
MonsterChat BaronTag, To the bank! Kill all who stand in the way!
Wait 4
IfMonsterAt BanditTag, Shopx, ShopY, 5, RobBank
IfNotMonsterExist BanditTag, Victory1
IfNotMonsterExist BaronTag, BaronDead1
Goto AttackHaven
;;;;;;;;;;;;;;;;;;
:RobBank
MonsterChat BaronTag, Take only the gold. Leave the notes, they are worthless.
Wait 8
IfNotMonsterExist BaronTag, BaronDead2
Goto FleeHaven
;;;;;;;;;;;;;;;;;;
:Victory1
Global The bandit raid has been thwarted!
MonsterChat BaronTag, I'll be back one day... I promise!!!
MonsterRemove RogueTag
MonsterRemove ScoutTag
MonsterRemove BaronTag
MonsterRemove BanditTag
End
;;;;;;;;;;;;;;;;;;
:BaronDead1
Global The bandit baron has been killed!
Goto AttackHaven
;;;;;;;;;;;;;;;;;;
:BaronDead2
Global The bandit baron has been killed!
Goto FleeHaven
;;;;;;;;;;;;;;;;;;
:FleeHaven
MonsterChat BaronTag, Let's get back to the forest and escape this mire!
MonsterGoto BanditTag, Startx, StartY
MonsterGoto RogueTag, Startx, StartY
MonsterGoto BaronTag, Startx, StartY
MonsterGoto ScoutTag, Startx, StartY
Wait 1
IfMonsterAt BanditTag, Startx, StartY, 8, Escape
IfNotMonsterExist BanditTag, Victory1
IfNotMonsterExist BaronTag, BaronDead2
Goto Fleehaven
;;;;;;;;;;;;;
:Escape
Global The bandits have robbed the Haven bank and have escaped!
End
Pages:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16