Script Guide for Fusion.
Version 1.213a
First I would like to thank illogic for the original guide,
YoshiG3 for better descriptions and syntax comments. Next I would like to
thank KyuubiKitsune for giving me the list of all the script commands. And
last but not least, Yun`Qi, for the timer guide and the many, many corrections
to make this one of the most novice friendly and accurate guides
available. Any other credits will be listed in the changelog at the
end.
-Tsusai
Fusion Core Developer
Former Fusion Lead
Scriptor
Table of Contents
NPC
Configuration
Commands
Special
Commands
Timer Guide by
Yun`Qi
Shops
Warps
Hidden Warps
Monsters
Variables
Changelog
NPC Configuration
If you are making
your first NPC, you need to determine where it is, what it is called, and what
it looks
like
mapname.gat,x,y,face#[tab]script[tab]"name"[tab]NPCID,{
script
commands here (from the next section)
}
[tab] means hit the tab
button on your keyboard.
Facing numbers:
| 107 2X6 345 |
0 is north, 4 is south, 2 is west, 6 is east
In Fusion 1.213, a new feature was
added:
mapname.gat,x,y,face#[tab]script[tab]"name"[tab]NPCID,rx,ry,{
This
is what is called OnTouch system. OnTouch means that the script can
activate if a person steps in it's range, just like warps. rx is the x
radius i.e. if rx is 5, then anyone within 5 cells to the left or right will
trigger it. ry is the same, but on the y axis (north/south). These
are optional. Either use both, or do not use both. Just having rx is
invalid syntax. If you want it to trigger and load a certain section of
your NPC code, i.e. different dialog for proximity and another set for clicking,
then use the OnTouch: label. (see special labels);
For
the picture of the NPC, you need it's NPCID, which can be found by going here.
Commands
1:mes
mes "Your
message";
Displays a message when you click on the NPC or during a
script, where "Your message" is any message which the NPC is to say. Must be
enclosed in quotes(").
2:next
next;
Displays a 'Next' button
when talking to an NPC, not necessary after every mes command, but should be
included before using a different command after a mes command. The next command
is used for sorting long amounts of dialogue.
3:close
close;
Completely exits the scripts.
4:menu
menu "Opt1",LABEL1,"Opt2",LABEL2(on and on...);
Displays
a menu from which a player can select an option, where "Optx" is the label for
your options and the LABELx is any label name to which the program will look for
in order to carry out the procedure for that option.
5:goto
goto LABELx;
Jumps to a reference label in the script,
where LABELx is any label name used in the script, useful for repeated
procedures like informative discussions.
6:cutin
cutin "image",x;
Displays a picture, where "image" is
the image name, if x=2, it shows in the bottom right, if x=4, the image will
show in the center, and if x=255, then the image will be removed.
7:store
store;
Opens up the kafra storage window.
8:warp
warp mapname,x,y;
Warps the player to a specific
location, where mapname is the name of any map in your maps\ directory, x is the
x coordinate, and y is the y coordinate. Do not include the .gat
extension.
9:save
save mapname,x,y;
Saves the position of a character upon
where they will appear after they die.
10:heal
heal HP,SP;
Recovers a specific amount of HP and SP,
where HP and SP are natural numbers(integers).
Max is 30000.
11:set
set VAR = x;
Sets a variable to a specific value(or
variable).
Variable types will be discussed here.
12:additem
additem x,y;
Adds a specific number of the item to a
player, where x is the item ID and y is the number of those items to add.
y
can be a variable.
13:delitem
delitem x,y;
Removes a specific number of the
indicated item, where x is the item ID and y is the number of those items to
remove from a character.
y can be a variable.
14:checkitem
checkitem x,y,LABEL1,LABEL2;
Checks to see if the
player has a specific number of the indicated item, whereupon it will go to a
specific reference. x is the item ID, y is the number of items, LABEL1 is the
label where the code will go if the player meets the requirements, LABEL2 is the
label where the code will proceed if the player does not meet the
requirements.
y can be a variable.
15:check
Has many forms
check x (formula)
y,LABEL1,LABEL2;
LABEL1 is the label where the code will go if the player
meets the requirements, LABEL2 is the label where the code will proceed if the
player does not meet the requirements.
x and y can be
variables
Formulas:
| = | Equal to |
| <= | Less than or equal to |
| >= | Greater than or equal to |
| > | Greater than |
| < | Lesser than |
| != | Must not be equal to |
16:checkadditem
checkadditem x,y,LABEL1,LABEL2;
Checks to
see if adding the item will cause the character to be overweight. Where x is the
item ID number, y is the number of items, LABEL1 is the label reference to which
the code is pointed to if it is possible to receive and not be overweight, and
therefore, LABEL2 is the label reference to which the code is directed to if the
player would become overweight by adding the items.
17:jobchange
jobchange x;
Changes the job of the player
dependent on the value of x.
May not be a variable
18:viewpoint
viewpoint 1,x,y,1,0x00FF00;
Places a marker on the
players map, x & y are coordinates and 00FF00 is the
hex value of the color.
19:input
input VAR;
Allows the player to type in a numberical
value and stores it into a numerical variable.
20:random
random VAR
x;
Generates a random value from 0 to (x - 1) and stores it into the
variable.
21:option
option A,x;
A=0 is cart
A=1 is falcon
A=2 is
peco
x is to enable (1) and disable (0)
22:speed
speed x;
Changes the speed of the player's movement,
where x is any number from 50 to 200, 150 is the default.
The lower the
number, the faster you go.
23:die
die;
Kills the player using the script.
24:ccolor
ccolor x;
Changes the color of the character's
clothing (1 to 5). The maximum will vary depending on any added on
palletes.
Super Novice has none.
25:refine
Unknown: Removed in Fusion 1.213
26:getitemamount
getitemamount x,VAR;
Stores the number of
items(by ID) the player has and stores it into a variable.
27:getskilllevel
getskilllevel ID,VAR;
Stores the level of the
skill into a variable, where ID is the skill number from skill_db. If you
do not have the skill, it will set the variable to 0.
28:setskilllevel
setskilllevel 0xID,z;
Gives the character a
specific skill, where ID is the hex value of the skill and x is the level of the
value to be set.
The ID comes from database\skill_db.txt In the skill_db.txt,
it is referred to as N and z is the
MLV.
ex. I want to add a level 10
Lord of Vermillion to my character.
From
skill_db:
N,ID,JName,SType,MLV,SP1,SP2,SP3,SP4,SP5,SP6,SP7,SP8,SP9,SP10......
85,WZ_VERMILION,Lord_of_Vermilion,2,10,60,64,68,72,76,80,84,88,92,96....
85 is a decimal number, and converts to 55 resulting in the
code:
setskilllevel 0x55,10;
29:refinery
refinery @POSITION,x,@REFINELEVEL;
The variables can
be anything, but it is best if you use a @ variable type. This script
command will either refine your weapon, or destroy it. The first one is the
POSITION, i.e. left hand, right hand, head, etc. x con only be 0
or 1. If x=1, your item will break and fail, and you can kiss it goodbye.
if x=0, it will refine your weapon to the number that @REFINELEVEL is
equal to. Usually, the equipmenu comes first in the script, and it
sets the @REFINELEVEL. So if I were to want to increase it by 1,
somewhere inbetween equipmenu and refinery, there would be a
set @REFINELEVEL += 1;
The first @POSITION variable will be an integer between 1-10
Position numbers that @POSITION can be are:
| 1 | Head |
| 2 | Body |
| 3 | Left Hand |
| 4 | Right Hand |
| 5 | Robe |
| 6 | Foot |
| 7 | Accessory 1 |
| 8 | Accessory 2 |
| 9 | Head 2 |
| 10 | Head |
30:equipmenu
equipmenu @POSITION,@WEAPONLEVEL,@REFINELEVEL;
The
variables I used can be called anything, but it is best if you use the @ type of
variable. equipmenu must include 3 variables like in the
example. This command displays a menu of what is equipped for all
positions. i.e. this is the list shown by all refiners, and this is what it is
really used for. Upon selecting which equipment for refining, the
variables are set. The first one is the @POSITION, just like the
previous command The second is the @WEAPONLEVEL, because
different weapon levels have different refining requirements. Last is the
@REFINELEVEL, instead of changing the level, it stores the current
refined level the item is.
Any item that can not be refined, or anything that
is not equipped (like your dumb brain...), the @WEAPONLEVEL is
99.
Usually any item that ISN'T a weapon, like a Rosary or a Hat will return
@WEAPONLEVEL = 0.
31:lockitem
lockitem x;
Locks(x=1)/Unlocks(x=0) equipped items
on the player.
32:hcolor
hcolor x;
Changes the colour of the character's hair
(1~8). The maximum will vary depending on your palletes.
33:callmob
callmob "mapname",x,y,Monster,a,b,script;
Calls a mob
to the specific location, where "mapname" is the name of the map(located in
maps\ directory), x is the x coordinate, y is the y coordinate, "Monster" is the
name of the monster, a is the mob ID, and b is the time to spawn.
script is
optional, if you point to a script and upon the death of the mob, that script
will trigger.
If you choose not to use it, use callmob
"mapname",x,y,Monster,a,b;
34:broadcast
broadcast "message",x;
x is optional, see below for
broadcast codes.
Broadcast codes:
This is for broadcasting on the map the NPC is
on, add 200 to make it global.
Normal or 0: "NPCName :
message"
10: "message"
20: "CharacterName : message"
30: "CharacterName : message"
40: "NPCName : message"
100: "message"
35:NPCtimer
NPCtimer x;
Activates(x=1)/Disables(x=0) a timer on
an NPC.
36:addNPCtimer (not sure)
addNPCtimer "Name",x;
Adds a timer
where "Name" is the name of who's timing and x is the amount of time in
milliseconds. you can use + or - before x.
37:return
return;
Return a value or variable, required when
using certain functions such as the OnInit, OnMyMobDead, OnTimerx.
38:warpallpc
warpallpc mapname,x,y,0;
Warps all players to the
specific location, where mapname is the name of any map in your maps\ directory,
x is the x coordinate, and y is the y coordinate.
39:waitingroom
waitingroom "Title",x;
Creates a chatroom on the
player, where "Title" is the chatroom name and x is the maximum amount of people
allowed into the chat room.
40:enableNPC
enableNPC
"mapname","NPCname",x;
Enables(x=1)/Disables(x=0) an NPC, where "mapname"
is the name of the map in the maps\ folder and NPCname is the name of the NPC to
be disabled. Do not put in .gat or any other extensions in the "mapname"
part.
41:resetmymob
resetmymob mapname;
Kills all summoned mobs by
scripts in the specified map, where mapname is the name of any map located in
your maps\ directory.
42:getmapusers
getmapusers mapname,VAR;
Stores the number of
players in the specific map name to a variable.
43:setstr
setstr $@VAR = "string";
Allocates a string into a
variable.
To clear, set it equal to ""
44:checkstr
checkstr $@VAR = "string",YES,NO;
Checks a string
variable to see if it matches with the selected string. Where string is the
desired string to be compared to, YES is a label to which the code will point if
the comparison shows this as correct and NO is a label to which the code will be
directed to if the statement is not true. Not tested, but you may and probably
can compare 2 string variables or a string (filled with numbers) with a regular
variable.
45:resetstat
resetstat;
Resets the 6 basic attributes of the
character.
46:resetskill
resetskill;
Resets all skills of the
character(Level 0 to all).
47:hstyle
hstyle x;
Changes the style of the characters
head(hair) (1~20).
includes both female and male heads
48:guildreg
guildreg mapname;
Loads the data for the specific
guild, use to check if the map has been taken by a guild yet.
map must be in
\database\territory_db.txt
49:getgskilllevel
getgskilllevel x,VAR;
Checks the level of a
guild skill and stores the value into a variable, where x is the skill number
and VAR is a variable.
Skill ID's are in the skill_guild_db.txt
50:getguardstatus
getguardstatus x,VAR;
Checks if the guardian
has been recruited or not and stores it into a variable.
51:setguildkafra
setguildkafra x;
Recruits(x=1)/Disbands(x=0) a
kafra employee in regards to the guild.
52:setguardstatus
setguardstatus
x,y;
Recruits(y=1)/Disbands(y=0) a guardian, where x is the guardian
number(0~7) or variable representation.
53:callguard
callguard x;
Calls the specific guardian, where x
is the specific guardian number (0~7) or a variable representation.
54:callmymob
callmymob MONSTER,x,y,a,b;
Calls a mob to the
specific location, where MONSTER is the mob's name from the mob_db.txt and must
be capitalilzed, x and y are the coordinates to which the mob will be placed, a
and b are the spawn times, which are two points in which the program will take a
random value between.
55:resetguild
resetguild;
Used to leave the castle that you have
taken.
56:guilddinvest
guilddinvest;
Invests 10000 zeny towards guild
defense.
57:resetbonusstat
resetbonusstat;
Same thing as resetstat;, but
you get double the skill points back.
58:getagit
Unknown, underdevelopment
59:getguild
Unknown, underdevelopment
60:agitregist
Unknown, underdevelopment
61:moveNPC
Unknown, underdevelopment
63:Remove Equipment
removeequipment;
Takes off all your
equipment
64:BaseReset
basereset;
Resets your baselevel to 1 and EXP to
0
67:eventmob
eventmob MobID,Name,x,y,[Perfect Drop ID];
MobID is
the ID of the monster that will be summoned, x and y are coordinates. The
[Perfect Drop ID] is the ID of the item the monster will always drop,
from item_db.txt. If it is set to 0, it will act normal.
68:addskillpoints
addskillpoints x;
Adds skill points to the
character where the points = x.
69:addstatpoints
addstatpoints;
Adds stat points to the
character where the points = x.
1.212
70:emotion
emotion x;
Makes the NPC use an emotion; I'm still
making a picture to number chart.
71:doNPCevent NPCname,label;
Will activate another NPC at a certain
label.
DOES NOT WORK YET!
72:percentheal
percentheal x,y;
the percent of healing [HP(x)
and SP(y)] is based upon total HP/SP
1.213
73:percentdamage
percentdamage x,y;
Opposite of
percentheal. Will possibly kill the character depending on the rates.
74:checkpoint
checkpoint "map",x,y;
Something to do with PvP,
not really implemented.
75:inputstr
inputstr VAR;
Allows users to input a string (words)
into a string variable.
76:areawarp
areawarp "original map",x1,y1,x2,y2,"destination
map",dest_x,dest_y;
Warps users within a range to a specific
location.
77:cardremoval
Underconstruction
78:gstore;
gstore;
Opens guild storage, if your character is in
a guild.
79:getareausers
getareausers "map",x1,y1,x2,y2,VAR;
Gets the
total number of ACTIVE characters in a specific part of a map and stores it into
a numerical variable. Logged off characters do not count.
80:resetmyareamob
resetmyareamob "map",x1,y1,x2,y2;
Kills
summoned monsters on a specific part of a map
81:remoteNPCtimer
remoteNPCtimer "NPC Name",x;
Activates (x=1)
or deacivates (x=0) the timer events of another NPC.
82:areabroadcast
areabroadcast
"map",x1,y1,x2,y2,"blah",x;
Broadcasts a message to a certain
location. x is an optional tag and follows the same rules of
broadcast.
83:waitingroomcount
waitingroomcount VAR;
Stores current users
in the NPC chatroom into a var. Must be in the same NPC in which hosts the
chatroom.
84:reseteventmob
reseteventmob "map","event";
This is used in
conjunction with callmob. If the "event" tag matches the script portion
of the callmob command (callmob
"mapname",x,y,Monster,a,b,script;), then the mob will be
destroyed.
85:areaset
areaset VAR = #,"map",x1,y1,x2,y2;
Basic set command
in yet another area range.
Special
Commands
OnInit:
Tells the NPC to execute when it loads on
the client's screen. Not when the map loads, common misconception.
OnTimerX:
X is milliseconds, and runs a set of commands when that
time has reached. A NPCtimer 1; must have been activated in order
for this to work.
OnMyMobDead:
Runs a set off commands when a mob summoned by
callmymob has been killed.
OnTouch:
Used in conjunction with a modified NPC header (see
top). This allows for separate NPC commands to be used while leaveing
something unique for when the NPC is clicked.
scriptlabel blah;
This command placed at the top of a script, acts
like a macro, used by script to recall the script commands from this.
script blah;
This command recalls all the commands from another
script that uses scriptlabel. NOTE: can only be used on the same
map as the one with scriptlabel.
^######
Changes the color of the text. Uses html color
codes like viewpoint. ^000000 is the default text.
mes
"^00FF00 I like pie^000000 okay!"; shows: I like pie
okay!
-
The special label - is used in place of a label and will continue to the
next line. Used in checks or in menu.
ex. menu "say I like
pie",-,"cancel",c;
mes "I like pie";
close;
c:
close;
Timer Guide by Yun`Qi
-If you
want the NPC to stop counting, after it's done the command, put NPCtimer 0; at the bottom of the
script:
prontera.gat,100,100,2 script 800,{
OnInit:
NPCtimer
1;
OnTimer1000:
broadcast "Guild-Wars have Started!";
NPCtimer 0;
}
-If you want it to keep
counting, after it's done that command, put return; at the bottom of the script that you want to
continue from:
prontera.gat,100,100,2 script 800,{
OnInit:
NPCtimer
1;
OnTimer1000:
broadcast "Guild-Wars have started!";
return;
OnTimer4000:
broadcast "Guild-Wars have
ended!";
NPCtimer 0;
}
-If you want it to restart the timer, after
it's done it's thing, put a second NPCtimer 1;
at the bottom of the script:
prontera.gat,100,100,2 script
800,{
OnInit:
NPCtimer 1;
OnTimer1000:
broadcast "Guild-Wars have
started!";
return;
OnTimer4000:
broadcast "Guild-Wars have
ended!";
NPCtimer 1;
}
-If you
want the timer to start, when you click on the NPC, instead of when the NPC
loads (ie. a player walks onto the map), remove the OnInit: element and start
the scrip with NPCtimer 1;
:
prontera.gat,100,100,2 script 800,{
NPCtimer 1;
OnTimer1000:
broadcast "Guild-Wars
have started!";
return;
OnTimer4000:
broadcast "Guild-Wars have
ended!";
NPCtimer 0;
}
Shops are the NPC's that sell you things (I have been asked this)
-_-
Here is the synttax
mapname.gat,x,y,facing#[tab]shop[tab]"name"[tab]NPCID,ITEM1ID:ITEM1PRICE
I do not know if there is a limit for how many items you can have, but to add more items, just add a comma, and another section of items.
mapname.gat,x,y,facing#[tab]shop[tab]"name"[tab]NPCID,ITEM1ID:ITEM1PRICE,ITEM2ID:ITEM2PRICE
For the item IDs, look in the \database\item_db.txt
Theses are warp portals, duh
Syntax:
mapname.gat,x,y,0[tab]warp[tab]name[tab]a,b,destination.gat,x2,y2
a and b are the radius of how far it reaches I believe, if 2,2 you trigger it 2 cells away from the horizontal and vertical center all the way around.
Same thing as warp, but you use hiddenwarp instead of warp.
Monsters (Incomplete, do not take too seriously)
Monsters, also known as Mobs. This type of script sets up where they are located in the real game world, and what they are....
mapname.gat,x,y,0,0[tab]monster[tab]"name"[tab]monsterID,SpawnAmount,InitialSpawnDelay(in milliseconds),ReSpawnDelay(in milliseconds),Mode
In the mapname, if you set the x and y to 0,0 it will cause a random spawn point. This is used really with more than 1 spawn for all over the map, like porings in the fields.
Modes: (not finished)
| 0 | Normal |
| 1 | Unknown, used in Guild Wars |
| 2+ | ? |
One of the most difficult topics to cover. Anything that says VAR in the Commands area means a variable can be used. (VAR is the name of the variable) They are set in by the command set.
Here are the types:
Integers
Strings
Preset
Variables
How to display
variables
Integers
Permanent Character Variable
Is
stored into the character file. Think of it as the variable is "attached" to
that character. Can only be used for the character(s) that use the
NPC.
ex. set VAR = 2;
Global Variable
Is stored into the status.txt. The variable can be used in
all scripts, for any character.
ex. set \VAR = 2;
Temporary Variable
A temporary integer variable that can and will only be
used within that one script, until it is closed or the server is
restarted.
ex. set @VAR = 2;
Temporary Global
Just like the global, set by all and can be shared by
all, but is erased when the server is restarted.
ex. set \@VAR =
2;
Strings
I have not tested these, but the way
they work is the same as the others, so only examples will be given.
Permanent Character
ex. setstr $VAR = "test";
Global Variable
ex. setstr \$VAR = "test";
Temporary Variable
ex. setstr $@VAR = "test";
Temporary Global
ex. setstr \$@VAR = "test";
Preset Variables
Some you can
modify, others you can't. Any variable with a $ infront ($charaname) you
can display, others like Zeny, you can't.
ex. mes "Hi $charaname ! How you
hang'n?";
$charaname
Shows the characters name.
$joblevel
Shows the characters job level.
$ddegree
Shows the amount of zeny invested towards defense(guild script
only).
$dtrigger
Shows the number of times a guild invested in defense(guild
script only).
$edegree
Shows the amount of zeny invested towards economy (guild script
only).
$etrigger
Shows the number of times a guild invested in economy (guild
script only).
$guildname
Shows the name of a guild (guild script only).
$guildmaster
Shows the guild's guild master's name (guild script
only).
$mapname
Shows the name of the current map. Used with the $[]
function.
BaseLevel
The character's base level and EXP, separated by a comma ex. set
BaseLevel = 1,0; will force the character back to base level 1 with no base EXP.
Can be used with the check and set function. Requires relogin to see
effects.
JobLevel
The character's job level and EXP, separated by a comma ex. set
JobLevel = 1,0; will force the character back to job level 1 with no EXP. Can be
used with the check and set function.
StatusPoint
The character's status points. Used to modify the amount
of status points you have. Can be used with set and check
functions.
SkillPoint
Same as StatusPoint, but with skillpoints
Gender
Returns a 0 if the player is female or 1 if male. Can be used with
the check function.
Zeny
The amount of zeny currently on the character at that moment and
time. Can be used with the check and set function.
Job
Based on the job numbers. Can be used with the check and set
function.
GuildID
Returns the guild ID number, or 0 if the character is not in a
guild. Can be used with the check function.
IsMyGuild
Returns a 1 if the guild is that of the character, and 0 if not.
Can be used with the check function.
IsMyMaster
Returns a 1 if the guild master is the character, and 0 if not.
Can be used with the check function.
To Show Normal Variables
You can
display them in messages using the $[].
ex. mes "I am gonna sue you for
$[@temp_chara] because I have nothing else to do.";
mes "blah blah
$[chara_variable] blah blah;
mes "blah blah $[\global_variable] blah
blah;
mes "blah blah $[\@global_temp] blah blah;
Here are the strings.
ex. mes "blah blah $[$character] blah blah";
mes "blah blah
$[$@temp_character] blah blah";
mes "blah blah $[\$@temp_global] blah
blah";
mes "blah blah $[\$global] blah blah";
February 1, 2005 - Updated to 1.213a. Added Fusion 1.213's NPC
commands and abilities.
August 9, 2004 - Updated to version
1.212c. Corrected setskilllevel.
August 8, 2004 - Updated
to version 1.212b. Corrected Shops and
percentheal.
July 5, 2004 - Updated to version 1.212a. Added
new NPC commands and updated basereset.
June 20, 2004 - Updated to
version 1.211i. Updated setskilllevel.
June 5, 2004 - Updated
to version 1.211h. Updated random.
May 26, 2004 - Updated to
version 1.211g. Updated getskilllevel and added color
commands.
May 21, 2004 - Updated to version 1.211f. Updated hyperlink
problem. (thanks Yun`Qi)
May 16, 4004 - Updated to version 1.211e.
Updated enableNPC and NPC Configuration.
May 11, 2004 - Updated
to version 1.211d. Fixed a few tables to show light blue background and
centered their information. Top comment part realigned.
May 10, 2004 -
Updated to version 1.211c. Turned Special Labels to Special
Commands and added script and scriptlabel. Updated
Monsters section and added a Changelog.
May 7, 2004 - added
equipmenu and refinery by KyutaSyuko
May 6, 2004 - added Timer
Guide
May 6, 2004 - Created using the commands listed in the source and most
of YoshiG3's info from the script creator.