diff options
author | gumi <mekolat@users.noreply.github.com> | 2016-11-30 12:51:27 -0500 |
---|---|---|
committer | gumi <mekolat@users.noreply.github.com> | 2016-12-03 11:51:48 -0500 |
commit | 1cc1e7e89337db24f6e8871a01604d01ee09047d (patch) | |
tree | 111bc815caf8131208cdcfda8e2018f8079b98e4 | |
parent | c8395166588b7a1118fae5f9b39679e591d07b03 (diff) | |
download | serverdata-1cc1e7e89337db24f6e8871a01604d01ee09047d.tar.gz serverdata-1cc1e7e89337db24f6e8871a01604d01ee09047d.tar.bz2 serverdata-1cc1e7e89337db24f6e8871a01604d01ee09047d.tar.xz serverdata-1cc1e7e89337db24f6e8871a01604d01ee09047d.zip |
add `cwarp` terminator function
-rw-r--r-- | npc/functions/goodbye.txt | 85 |
1 files changed, 72 insertions, 13 deletions
diff --git a/npc/functions/goodbye.txt b/npc/functions/goodbye.txt index c02f40ec..af9ab08f 100644 --- a/npc/functions/goodbye.txt +++ b/npc/functions/goodbye.txt @@ -1,29 +1,88 @@ // Evol functions. // Author: // Reid +// gumi // Description: +// script terminator functions + + + +// goodbye_msg // Tell a random goodbye sentence. // Variables: // .@rand = Random number between the number of "goodbye" choice. function script goodbye_msg { - setarray .byemsg$[0], l("See you!"), - l("See you later!"), - l("See you soon!"), - l("Bye!"), - l("Farewell."), - l("Bye then!"), - l("Goodbye."), - l("Bye for now."), - l("Talk to you soon!"), - l("Talk to you later!"), - l("Have a good day!"), - l("Cheers!"), - l("Take care!"); + setarray .byemsg$[0], + l("See you!"), + l("See you later!"), + l("See you soon!"), + l("Bye!"), + l("Farewell."), + l("Bye then!"), + l("Goodbye."), + l("Bye for now."), + l("Talk to you soon!"), + l("Talk to you later!"), + l("Have a good day!"), + l("Cheers!"), + l("Take care!"); return .byemsg$[rand(getarraysize(.byemsg$))]; } + + +// cwarp +// Closes the dialog, then warps the player. +// You almost always want to use this instead of `warp`. +// usage: +// cwarp; +// cwarp x, y; +// cwarp map, x, y; + +function script cwarp { + .@map$ = getarg(0, ""); + .@x = getarg(1, 0); + .@y = getarg(2, 0); + + if (getargcount() > 0 && getargcount() < 3) + { + .@npc$ = strnpcinfo(0); + .@map$ = getvariableofnpc(.map$, .@npc$); + .@x = getarg(0); + .@y = getarg(1); + } + + getmapxy .@pc_map$, .@pc_x, .@pc_y, UNITTYPE_PC; // get char location + + closedialog; // XXX: maybe send closeclientdialog in the future + + if (getargcount() < 1) + { + warp .@pc_map$, .@pc_x, .@pc_y; // no arguments, just refresh + close; + } + + if (.@map$ == .@pc_map$) + { + if (.@pc_x == .@x && .@pc_y == .@y) + { + close; // same location, don't move + } + + else + { + slide .@x, .@y; // same map, slide instead of full warp + close; + } + } + + warp .@map$, .@x, .@y; // different map, warp to given location + close; +} + + function script goodbye { closedialog; |