The NoX map editor has the ability to edit all of the scripts used in single player, multiplayer, and quest maps. Scripts are what make the explosion of an NPC teleporting, the music in the area, the deadly arrow traps, almost anything possible!
To make use of the most recent function definitions, download the latest pack: http://www.mediafire.com/?0lyewaycg4r1qv5
- 1 Script Use
- 2 List of Commands
- 3 Tutorials
Learning how to use scripts in NoX maps is, by far, the most difficult aspect of the editor. The simple functions, like unlocking a door, aren't that complicated; contrary to a boss NPC with a load of variables required to fulfill its purpose; but both require knowledge of proper syntax, variable use, math and logic, and a little uncommon sense to keep the whole thing from collapsing and crashing the game (though that last one comes up a little less often unless you're trying to be a revolutionary in NoX scripting). It isn't actually very overwhelming to make good use of all of them once you get used to how they work.
Before anything else is said, one thing must be stated first, as it may very well be one of the most important parts of NoX scripting; what is a pointer?
A pointer is basically a string or value that is used to reference an object, waypoint, wall, or group, among other things. Without pointers, a function is practically internal, and won't have any effect on what happens in the game.
The method of creating a pointer varies depending on what the pointer is being made for. For objects, you must select the target and go to its Properties menu. Then, you click the Xtra Bytes checkbox until the field labeled "Script Name" is not greyed out. In that field is where you input the name of the pointer. For waypoints, all you must do is select the waypoint you want to allocate the pointer to, and rename it. (Waypoints created afterwards will share the name in the field.) For groups, all you need to do is create a group (though groups have been known to be unreliable). For all of those, you can add the phrase "nameofthemap:" on the front without changing the pointer. Walls can only be referenced either in groups or directly in the script; this will be explained next.
Once pointers have been allocated, you can use them in the script, using functions with the explicit purpose of representing them. Such functions include:
Object("Pointer") Waypoint("Pointer") Wall(50,50) ObjectGroup("Pointer") WaypointGroup("Pointer") WallGroup("Pointer")
For most of the functions, you only need to put the name of the pointer into the brackets (with quotations surrounding it). For individual walls, though, you must determine the wall coordinates of the wall you are trying to reference (more on that here) and place the x- and y-values in the blanks.
Using these functions in their entirety every time you want to mention a pointer can get cumbersome, and also bloat the script size. To prevent this from happening, and with many other uses, you can use variables to make a much quicker, much lighter reference. To use variables as pointers, you must allocate them as such:
Gvar4 = Object("Pointer") Gvar5 = Waypoint("Pointer") var0 = Wall(50,50) etc.
Once you have done this, you can use them much more accessibly just by using Gvar4 (or whatever variable the pointer was allocated to) in place of the whole function. For example, a function could change from this:
Now, the script is much smaller and more manageable. These values can be used over and over again, in different parts of the scripts.
Learning how to use proper syntax is crucial if you intend to create anything more than rudimentary functions. It's necessary to learn how scripts are supposed to be built, and doing so can help to avoid numerous conflicts.
Syntax is actually relatively easy to understand in the script editor. There are a few basic structures for commands to follow; the first of which is the command alone:
Now, let's examine the structure of this mockup command:
- The first part is, of course, the declaration of the command itself. This tells the script what to perform.
- Next, there is an open bracket. This bracket will need to close at the end of the command.
- Next up comes an argument. Arguments come in a variety of types; most commonly, in variables, values, strings, and certain commands. The type of argument each one is is dependent on the purpose of the function, and the amount of arguments required is dependent on the command. (More on arguments below.)
- Every argument is followed by a comma, with no space after the comma, unless it's the last argument.
- The above two repeat until they reach the end of the command. Then, a closed bracket is placed to complete the command.
Arguments are the part of each command that help to clarify exactly what that command is supposed to do. How they do this is specific on what the command desires. They may be specified as a value, a variable, a string, or even another command, depending on the function.
Values are the easiest to implement, since they don't rely on any other data or commands to act validly. However, a value can only consist of a number, and there are not many situations where a value will be useful by itself. Variables are similar to values, except that they represent specific data and must be declared beforehand. They aren't limited to numerical values like values; they can also be strings, objects, locations, and even other commands. Here is an example of a script making use of both types:
In this example, the first argument is a variable, and the second a value. The variable represents the entity that called the function the command is in, and the value represents how much gold that entity will receive.
Certain Commands are often used to designate variables within commands. They are similar to variables except that they will return a value in correspondence to their purpose, and only represent very specific data depending on what command is used. Some examples of commands suitable for use inside commands are:
GetHost() GetGold(Arg) GetObjectX(Arg) Waypoint(Arg) Object(Arg) GetCaller(Arg)
Commands can also be designated to variables, which is a good idea if you plan to use the same command several times in a script:
Gvar4 = Object("Bear1") var0 = Waypoint("Waypoint")
However, if the pointer being referred to is dynamic (such as an object's X coordinate), you must use the command itself to get an accurate value.
Finally, Strings are used to reference pointers and data using words and phrases. They are used very often to designate variables to pointers, such as in the example above. Strings must be surrounded by quotations ( "" ). Like commands, what they represent will differ from command to command; the most common uses for strings are for pointers, chat strings, objects, and spells or enchants. Following is an example for each of these uses:
var0 = Object("TheObject") Chat(Gvar1,"This is a string.") var1 = Create("RedPotion",Gvar4) CastSpellOn("SPELL_LIGHT",Gvar5,Gvar1) Enchant(Gvar1,"ENCHANT_BURNING",f40)
Learning proper syntax will give you limited access to what is possible in script modification; however, with a grasp on Logic, it is possible to create much more elaborate and impressive scripts than the simple, linear functions created with syntax alone. Much of this logic is fairly basic, but it isn't always easy to implement without knowing how it can be used. Following are some existing logical arguments:
= : Used to represent something == : Is equal to > : Is greater than < : Is less than >= : Is greater than or equal to <= : Is less than or equal to != : Is not equal to + : Add - : Subtract / : Divide * : Multiply += : Plus equals && : And || : Or % : Remainder ^ : ??? : : Represents a key NEG: Negative f : Added to many arguments to apply to floats Logical Syntax if: Creates a conditional statement not: Reverses the conditions for a conditional statement jump: Jumps to a given key if conditions are met call: Calls a function by name return: Terminate function
Some of these logical arguments can be used with or without being used in a conditional statement (explained later), while some can only be used in one of the two ways; others still are special cases, and are used differently.
A single equal sign ( = ) and the plus equal sign ( += ) are the only ones on the list which can't be used in a conditional statement. " = " is mainly used to designate variables to various values in a standalone statement, and "+=" is used to add a number to a variable:
Example: Gvar4 = Object("Object") var0 += 2
All of the equality arguments ( ==, >, <, >=, <=, != ) can only be used in a conditional statement. They are used to check if a certain value has a certain relation to another certain value:
Example: if CurrentHealth(GetHost()) == 50 jump 30 if var2 > 4 jump 12 if Gvar4 != Gvar5 jump 24
Plural reference arguments ( &&, || ) are also exclusive to conditional arguments; they detect whether or not the conditions apply to every -- or any, depending on which one is used -- reference specified:
Example: if not Gvar65 == Gvar2 && Gvar66 == Gvar2 jump 22 if IsCaller(Gvar4) || IsCaller(Gvar5) jump 46
The math arguments ( + - / * % ) can be used both in declaration of variables and in commands. In standalone statements, they are often used to modify the original value of a variable; in some commands, they can be used inside arguments to specify more complex values:
Example: var0 = var0 * var1 ChangeGold(Gvar1,CurrentHealth(Gvar1) + 1) Gvar4 = Gvar5 % 4
The colon ( : ) isn't used in any statements, but in keys. Keys are used to jump to certain sections of the script without executing anything inbetween. (NOTE: It is possible to create recursive loops that never end; these will lock up the game!) They are used with the logical syntax "jump". One such use of keys is to implement a "staircase" structure, shown in example:
---Gem Machine--- var0 += 1 if var0 == 1 jump 10 if var0 == 2 jump 20 if var0 == 3 jump 30 jump 40 :10 Create("Ruby",Gvar4) return :20 Create("Emerald",Gvar4) return :30 Create("Diamond",Gvar4) :40 var0 = 0 return
When the script is refreshed, all keys will fix themselves to their correct value.
A negative value (NEG) isn't really logic; it simply represents a negative integer, since you cannot use the minus sign to represent a negative value:
Float values (marked with an 'f' ) aren't logic either; float values can have decimals, unlike integers. All float values MUST be marked with an 'f', including numbers, variables, and math. For numbers and math, the 'f' is put at the beginning of said entity, while variables have an 'f' placed before the variable number. However, variables must first be declared normally, but it must be declared with an ' f= ' instead of just ' = '. Here are some examples to further clarify this process:
var0 f= f30 var1 f= varF0 f+ f0.5 if not varF1 f>= varF0 jump 20 :20 return
Logical syntax has been used many times throughout the examples, but has yet to have been discussed. There are five main arguments for logical syntax; if, not, jump, call, and return. The argument "if" begins a conditional statement; the contents that come afterwards is more or less arranged into an equality equation. If the equation is true, then the conditions are met, and the script will follow its rules. If it's false, then the script ignores the statement and moves on:
if Gvar4 == 1 jump 20 if GetCaller() != GetHost() jump 30
The argument "not" is placed, if necessary, right after "if", and the conditions to be met are the opposite of what is stated:
if not var0 >= 6 jump 13
The argument "jump" can be used either in a standalone statement or at the end of a conditional statement, and will jump to a specified key. If it is in a conditional statement, the conditions must first be met before "jump" is executed:
jump 56 if CurrentHealth(Gvar1) < 1 jump 37
The argument "call" may only be used alone; it calls another function by name. Make sure you do not use this argument on itself, for it is possible to create a recursive loop, which can lock up the game:
---Correct Use--- Function 3: Caller call Receiver return Function 4: Receiver Create("Gold",Gvar4) return ---Incorrect Use--- Function 3: Repeater call Repeater return
The argument "return" is used alone, and is one of the most important in script; when this command is hit, the script ends. All scripts must end with this.
<Script Start> Gvar4 += 1 return <Script End>
One more important thing to note is this: YOU MAY NOT CAPITALIZE ANY LOGICAL SYNTAX! The syntax is only counted if all of the letters are lower-case; capitalizing any of the syntax can crash the game!
The use of variables has already been lightly described throughout the rest of the sections; however, one of the most important parts of using script has yet to be clarified on fully.
There are two different kinds of variables: global and local variables. Global Variables can be applied to every function in a map's script, and are represented by "Gvar#". Local Variables are specific to each single function, and are represented by "var#".
Before you use a variable for anything, you must first create it. There is a box in the top left of the interface marked "Variables"; this is where the variables for each function will be listed. To add a local variable to a function, simply select that function and type in, "var#", where " # " is the number after the last variable's. If there are no variables, you should start with "var0".
Global variables are specially declared in the second "GLOBAL" function. When you select this function, there should already be 4 variables declared; you cannot use these as you would any other variables declared (see below). Aside from this, creating global variables is similar to creating local variables.
Special Global Variables
Upon creation of a map, there are four global variables that are automatically created; Gvar0, Gvar1, Gvar2, and Gvar3. These are variables with predefined purposes, and cannot be declared any other kind of pointer. However, they are still appropriate to use in your script, provided you know what their use is.
Gvar0 and Gvar1 are very similar to "GetTrigger()" and "GetCaller()" respectively. Sometimes, one or the other won't work within a script; I would recommend you try using the variables before trying the commands. Gvar0 has been used rather popularly with "SetProperty()" to command creatures created with the "Create()" command. The most recognized example of this is in the map "ktdefend.map":
Function 3: CreateABear var0 = Create("Bear",Gvar4) SetProperty(var0,5,4) return Function 4: ReviveBear MoveWaypoint(Gvar4,GetObjectX(Gvar0),GetObjectY(Gvar0)) FrameTimer(20,3) return
Gvar2 and Gvar3 are flags for "true" and "false" respectively. They are used very often in conditional arguments to check if something is true or false; however, they are also used in some regular commands, such as Frozen():
if IsCaller(GetHost()) == Gvar3 jump 49 Frozen(Gvar2)
The number after each variable specifies how many partitions that variable has. Little is known about this feature, so it is a good idea to keep the value at .
List of Commands
|AggressionLevel||obj,flt||Makes $arg1 agressive at $arg2 level. Mostly ppl use 0, 0.5 and 0.83|
|AreOwnedBy||obj_grp,obj||Checks if $arg1 are owned by $arg2.|
|Attack||obj,obj||Makes $arg1 attack $arg2|
|AudioEvent||str,wayp||Produces audio event $arg1 at $arg2|
|AutoSave||---||Forces the host to autosave. Solo only.|
|AwardSpell||obj,str||Raises $arg1's spell level of $arg2. $arg1 must be able to cast $arg2 in order for this work.|
|BecomeEnemy||obj||Makes $arg1 hostile|
|BecomePet||obj||Makes $arg1 friendly|
|Blind||---||Blinds the host|
|CancelTimer||timer||Stops $arg1 from launching its function, if it's a timer.|
|CastSpellAt||str,obj,flt,flt||Makes $arg2 cast $arg1 at coords. $arg3 & $arg4|
|CastSpellFrom||str,flt,flt,flt,flt||Casts $arg1 from coords $arg2 and $arg3 to coords $arg4 and $arg5.|
|CastSpellOn||str,obj,obj||Makes $arg2 cast $arg1 on $arg3|
|CastSpellTo||str,flt,flt,obj||Casts $arg1 from coords $arg2 and $arg3 on $arg4|
|ChangeGold||obj,int||Gives $arg1 "$arg2" gold - using NEG takes gold away|
|ChangeScore||obj,int||Gives $arg1 "$arg2" points - using NEG takes points away|
|Chat||obj,str||Makes $arg1 say $arg2|
|ChatTimer||obj,str,int||Makes $arg1 say $arg2 for $arg3 frames|
|CheckObjectType||obj,str||Checks if $arg1 is an $arg2 kind of object, returns boolean|
|ClearOwner||obj||Makes $arg1 ownerless|
|ClearPrint||obj||Removes all print messages currently on $arg1's screen|
|Create||str,wayp||Creates $arg1 at $arg2|
|CreatureGroupHunt||obj_grp||Makes everyone in $arg1 hunt|
|CreatureGroupIdle||obj_grp||Makes everyone in $arg1 "idle"|
|CreatureHunt||obj||Makes $arg1 hunt|
|CreatureIdle||obj||Makes $arg1 idle|
|CurrentHealth||obj||Specifies $arg1's current health - returns integer|
|Damage||obj,obj,int,int||Damages $arg1 by $arg2 for $arg3 damage with $arg4-type damage|
|DeleteObjectTimer||obj,flt||Deletes $arg1 after $arg2 frames.|
|DestroyChat||obj||Destroys $arg1's chat bubble, if talking|
|DestroyEveryChat||---||Destroys all chat bubbles|
|Distance||flt,flt,flt,flt||Checks the distance between coords. $arg1,$arg2 and $arg3,$arg4 - returns float|
|Drop||obj,obj||Forces $arg1 to drop $arg2 from inventory|
|Effect||str,flt,flt,flt,flt||Creates $arg1 effect using coords. $arg2,$arg3 and, if necessary, $arg4,$arg5; otherwise both are f0|
|Enchant||obj,str,flt||Enchants $arg1 with $arg2 for $arg3 seconds|
|EnchantOff||obj,str||Unenchants $arg1 of $arg2.|
|FloatToString||flt||Turns $arg1 into a string, then declares it.|
|Follow||obj,obj||Makes $arg1 follow $arg2*|
|FrameTimer||int,int||Calls $arg2 in $arg1 frames|
|Frozen||obj,bool||Freezes $arg1 in place if $arg2 is "true"|
|GetAnswer||obj||Checks the answer given to $arg1 in conversation; 0 = Goodbye, 1 = Yes, 2 = No - returns integer|
|GetCaller||---||Retrieves the caller of a function - returns pointer|
|GetDirection||obj||Checks direction $arg1 is facing - returns byte|
|GetElevatorStatus||obj||Checks the status of $arg1 - returns integer|
|GetGold||obj||Checks $arg1's gold - returns integer|
|GetHost||---||Retrieves the host - returns pointer|
|GetLastItem||obj||Retrieves the last item in $arg1's inventory - returns object|
|GetObjectX||obj||Checks $arg1's X coord. - returns float|
|GetObjectY||obj||Checks $arg1's Y coord. - returns float|
|GetPreviousItem||obj||Retrieves the item after $arg1 in an inventory - returns object*|
|GetQuestBoolStatus||str||Checks the state of $arg1 - returns boolean|
|GetQuestStatus||str||Checks the state of $arg1 - returns integer|
|GetScore||obj||Checks $arg1's score - returns integer|
|GetTrigger||---||Retrieves the trigger of a function - returns pointer|
|GetWaypointX||wayp||Checks $arg1's X coord. - returns float|
|GetWaypointY||wayp||Checks $arg1's Y coord. - returns float|
|GiveXp||obj,flt||Gives $arg1 "$arg2" experience points; affects gold outcomes spawned with Create()|
|GoBackHome||obj||Sends $arg1 back to its creation point|
|GroupAggressionLevel||obj_grp,flt||Changes aggression level of $arg1|
|GroupAttack||obj_grp,obj||Makes everyone in $arg1 attack $arg2|
|GroupDamage||obj_grp,obj,int,int||Damages everyone in $arg1 by $arg2 for $arg3 damage with $arg4-type damage|
|GroupDelete||grp||Deletes everything in $arg1|
|GroupEnchant||obj_grp,str,flt||Enchants everyone in $arg1 with $arg2 for $arg3 seconds|
|GroupFollow||obj_grp,obj||Makes everyone in $arg1 follow $arg2|
|GroupHitFarLocation||obj_grp,flt,flt||Makes everyone in $arg1 use a ranged attack at coords. $arg2,$arg3|
|GroupHitLocation||obj_grp,flt,flt||Makes everyone in $arg1 use a melee attack at coords. $arg2,$arg3|
|GroupIdleLevel||obj_grp,flt||Makes everyone in $arg1 become "idle" when their health goes below the ratio "$arg2"|
|GroupLookAtDirection||obj_grp,int||Makes everyone in $arg1 look in the $arg2 direction*|
|GroupMove||obj_grp,wayp||Makes everyone in $arg1 move to $arg2|
|GroupPauseObject||obj_grp,int||Stops everyone in $arg1 from moving for $arg2 frames|
|GroupRunAway||obj_grp,obj,int||Makes everyone in $arg1 run away from $arg2 for $arg3 frames|
|GroupWander||obj_grp||Makes everyone in $arg1 wander aimlessly|
|HasEnchant||obj,str||Checks if $arg1 is enchanted with $arg2 - returns boolean|
|HasItem||obj,obj||Checks if $arg1 has the item designated by $arg2 - returns boolean|
|HitFarLocation||obj,flt,flt||Makes $arg1 use a ranged attack at coords. $arg2,$arg3|
|HitLocation||obj,flt,flt||Makes $arg1 use a melee attack at coords. $arg2,$arg3|
|IdleLevel||obj,flt||Makes $arg1 become "idle" when their health goes below the ratio "$arg2"|
|ImmediateBlind||---||Blinds the host immediately|
|IntToString||int||Converts $arg1 into a string - returns string|
|IsCaller||pointer||Checks if $arg1 is the caller of the function - returns boolean|
|IsLocked||obj||Checks if $arg1 is locked - returns boolean|
|IsObjectOn||obj||Checks if $arg1 is "on" - returns boolean|
|IsOwnedBy||obj,obj||Checks if $arg1 is currently "owned" by $arg2 - returns boolean|
|IsSpotted||obj,obj||Checks if $arg1 is visible to $arg2 - returns boolean|
|IsTrigger||pointer||Checks if $arg1 is the trigger of the function - returns boolean|
|IsWaypointOn||wayp||Checks if $arg1 is "on" - returns boolean|
|JournalDelete||obj,str||Clears $arg1's journal of the entry "$arg2"*|
|JournalEdit||obj,str,byte||Modifies $arg1's journal entry "$arg2" to the state of $arg3*|
|JournalEntry||obj,str,byte||Adds to $arg1's journal the entry "$arg2" in the state of $arg3*|
|LockDoor||obj||Locks $arg1 with a mechanism|
|LookAtDirection||obj,int||Makes $arg1 look in the $arg2 direction*|
|LookAtObject||obj,obj||Makes $arg1 look at $arg2|
|LookWithAngle||obj,byte||Makes $arg1 look in the $arg2 direction*|
|MakeEnemy||obj||Makes $arg1 hostile to every player and their teams|
|MakeFriendly||obj||Makes $arg1 friendly to host and his team; if host changes team, unit will change team too|
|MaxHealth||obj||Specifies $arg1's max health - returns integer|
|Move||obj,wayp||Makes $arg1 move to $arg2|
|MoveObject||obj,flt,flt||Instantly moves $arg1 to coords. $arg2,$arg3|
|MoveWaypoint||wayp,flt,flt||Instantly moves $arg1 to coords. $arg2,$arg3|
|Music||byte,int||Plays music number $arg1 at the volume of $arg2|
|Object||str||Retrieves the object with script name "$arg1" - returns object|
|ObjectGroup||str||Retrieves the object group with the name "$arg1" - returns object group|
|ObjectGroupOff||obj_grp||Disables all objects in $arg1|
|ObjectGroupOn||obj_grp||Enables all objects in $arg1|
|ObjectGroupToggle||obj_grp||Toggles each object in $arg1 seperately|
|ObjectOff||obj||Turns $arg1 "off"|
|ObjectOn||obj||Turns $arg1 "on"|
|ObjectToggle||obj||Toggles $arg1 between "on" and "off"|
|PauseObject||obj,int||Stops $arg1 from moving for $arg2 frames|
|Pickup||obj,obj||Makes $arg1 pick up $arg2|
|str||Prints "$arg1" onto the caller of the function's screen|
|PrintToAll||str||Prints "$arg1" onto everyone's screens|
|PushObject||obj,flt,flt,flt||Pushes $arg1 with $arg2 amount of force from coords. $arg3,$arg4|
|Raise||obj,flt||Raises $arg1 $arg2 pixels from the ground|
|RaiseZombie||obj||Reanimates $arg1 if it is a zombie and lying on the ground|
|Random||int,int||Produces a number between $arg1 and $arg2 - returns integer|
|RandomFloat||flt,flt||Produces a number between $arg1 and $arg2 - returns float|
|RestoreHealth||obj,int||Restores $arg1's health for $arg2 damage|
|RunAway||obj,obj,int||Makes $arg1 run away from $arg2 for $arg3 frames|
|SecondTimer||int,int||Calls $arg2 in $arg1 seconds|
|SetDialog||obj,str,int,int||Makes $arg1 conversible; uses $arg2 conversation when using tell story; initiate script is $arg3, exit script is $arg4*|
|SetGroupOwner||obj,obj_grp||Makes $arg1 "own" $arg2|
|SetGuardSpot||obj,flt,flt,flt,flt,flt||Makes $arg1 guard at coords. $arg2,$arg3 while looking at coords. $arg4,$arg5; will attack any enemy in range of $arg6|
|SetOwner||obj,obj||Makes $arg1 "own" $arg2|
|SetPathFlag||obj,byte||Causes $arg1 to use path flag $arg2|
|SetProperty||obj,int,int||Calls $arg3 when $arg1 is in state $arg2*|
|SetQuestBoolStatus||bool,str||Sets $arg2 in the state of $arg1*|
|SetQuestStatus||int,str||Sets $arg2 in the state of $arg1*|
|StoryPic||obj,str||Sets $arg1's portrait to $arg2 when being talked to|
|TellStory||str,str||Tells the story $arg2 in conversation*|
|TrapSpells||obj,str,str,str||Sets $arg1 to use spells $arg2, $arg3, and $arg4, if it is a bomber; unused spaces are marked with "NULL"|
|UnBlind||---||Unblinds the host|
|Walk||obj,flt,flt||Makes $arg1 walk to coords. $arg2,$arg3|
|Wall||int,int||Retrieves the wall at wall coords. $arg1,$arg2 - returns wall|
|WallBreak||wall||Breaks $arg1; the wall must be breakable|
|WallGroup||wall_grp||Declares the wall group with the name "$arg1" - returns wall group|
|WallGroupBreak||wall_grp||Breaks $arg1, if walls are breakable|
|WallGroupClose||wall_grp||Closes all walls in $arg1|
|WallGroupOpen||wall_grp||Opens all walls in $arg1|
|WallGroupToggle||wall_grp||Toggles the walls in $arg1 between "open" and "closed"|
|WallToggle||wall||Toggles $arg1 between opened and closed|
|Wander||obj||Makes $arg1 wander aimlessly|
|Waypoint||str||Retrieves the waypoint with script name "$arg1" - returns waypoint|
|WaypointGroup||str||Retrieves the waypoint group with the name "$arg1" - returns waypoint group|
|WaypointGroupOff||wayp_grp||Turns all waypoints in $arg1 "off"|
|WaypointGroupOn||wayp_grp||Turns all waypoints in $arg1 "on"|
|WaypointGroupToggle||wayp_grp||Toggles all waypoints in $arg1 between "on" and "off"|
|WaypointOff||wayp||Turns $arg1 "off"|
|WaypointOn||wayp||Turns $arg1 "on"|
|WaypointToggle||wayp||Toggles $arg1 between "on" and "off"|
|ZombieStayDown||obj||Makes $arg1 never get up, if it is a zombie|
This is where all of the unknown commands will be listed.
|Command||Suspected Format||Suspected Use/Notes|
|Unknown2e||??,??,??||Is beside "Random"; Possibly similar function|
|Unknown38||??,??||Is beside "AwardSpell" and "Enchant"; may be AwardAbility?..|
|Unknown41||??||Surrounded by basic pointers|
|Unknown4c||??||Inbetween item-related commands|
|Unknown58||??,??||Unknown58 - Unknown5f are unclassified; likely related|
|Unknown67||??,??||Unknown67 + 68 are adjacent to SetGroupOwner and IsOwnedBy|
|Unknown6b||??,??||Unknown6b + 6c are adjacent to AreOwnedBy and ClearOwner|
|Unknown72||??,??,??||Is beside group pointers and "ChatTimer"|
|Unknown74||??,??||Is surrounded by chat commands|
|Unknowna2||??,??||a2 + a3 are beside "IdleLevel" and "RunAway"; possibly related|
|Unknownca||---||Commits current game music.|
|Unknowncb||---||Sets up a game music that previously commited using Unknownca().|
|Unknowncc||---||Apparent music function|
This is where step-by-step tutorials on how to accomplish a certain function will be listed.
Simple tasks go here.
- Tasks requiring and providing greater understanding go here.
Setting Dialogue for NPC's and Other Things
- Getting an NPC to talk is more complicated than it should be, since it requires multiple functions just to get one person to speak. It isn't difficult to do, but it can be intimidating if one doesn't understand how to use the commands properly.
- Now, assuming you want an NPC to be able to talk at the very moment your map starts, you should start by creating a function that will ready all dialogues when called, then calling the function from MapInitialize. You can also set the dialogues directly from MapInitialize, but that leads to a messier script.
Example: Function 2 - MapInitialize [Some stuff that's important] call SetAllDialogs return
- Before going on, I recommend creating two more functions. One will be for the conversation start, and the other will be the conversation end.
- Now, in the new function, put in the command "SetDialog(object,string,byte,byte)". This command makes talking to an object possible. The first field is the script name of the NPC who will be speaking. The second is the type of conversation they will have; it can be set to "NORMAL", "YESNO", or "NEXT". (If the NPC is just going to chat normally, pick "NORMAL".) The third is the script number that will be run when their conversation starts, and the fourth is that which is run when their conversation ends.
- Another command that fits in this script is "StoryPic(object,string)". Again, the first field is the NPC talking. The second one is the picture used when speaking to them. If this command is not put in, the speaker will always be a bartender. If the NPC is to chat normally, this command has no use.
- Keep in mind that you'll need to put these commands in for each NPC that will talk.
Example: Function 3 - StartTalking SetDialog(Gvar4,"NORMAL",4,5) StoryPic(Gvar4,"AirshipCaptain") return
- Next, in the conversation start function (that I assume you already created), you will put in one of two things: "TellStory(string,string)" or "Chat(object,string)".
- The Chat command is easy to use; it makes the NPC say something in a speech bubble. The first field represents the object talking, and the second is what they will say.
- The TellStory command is more complicated. The first field's use is unknown, but it's safe to just put in "SwordsmanHurt". The second field is what they will talk about. It's probably a good idea to use an existing conversation and not a custom one, as any custom string will be cut short at 32 characters. Existing conversations can be found by looking through the original maps.
Example: Function 4 - Dude1Start Chat(Gvar4,"So hau abaut them urchens, ehh?") OR TellStory("SwordsmanHurt","War01a.scr:CaptainTalkStart") return
- The conversation end script requires little substance most of the time. In fact, you may not need to put anything in except for "return". Well, unless SetDialog had a "YESNO" type conversation.
- To make "YESNO" conversations work, and to make different choices lead to different consequences, you will need to use "GetAnswer(object)", which designates a variable to a byte. The only field actually represents the NPC receiving your answer, not the player. The result depends on what your answer was to the "YESNO" question given to you; it is 0 if you pick "Goodbye", 1 if you pick "Yes", and 2 if you pick "No". This can be used to make different things happen for different answers.
Example: Function 5 - Dude1End [For a "NORMAL" conversation] return [For a "YESNO" conversation] var0 = GetAnswer(Gvar4) if var0 == 0 jump 10 if var0 == 1 jump 20 if var0 == 2 jump 40 :10 return :20 ChangeGold(GetCaller(),10000) return :40 Damage(GetCaller(),Gvar4,60000,13) return
- These are the basics for preparing dialogue for NPC's (and other things).
Very complicated tasks go here.
Tips and Tricks
Fixing the Waypoints
Since the latest version of the NoX Map Editor is missing the ability to turn waypoints on, in order to make them work, you must create a function that will enable them. So, here's a little bit of a walkthrough to get your map working like it should.
- The first step is to put every waypoint into a group. First, list every waypoint number on Notepad or a piece of paper or whatever.
- On the top, click Map, then Groups. A dialogue box will pop up.
- In the very top field, put in a name for this group. Then, click the bubble labeled Waypoints. (It must be done in this order.)
- Copy your list into the large box. Make sure you press Enter for every number. Make sure there are no ancillary characters (such as commas).
- Click Save. If done correctly, you will not get an error upon doing so. Click Close.
- Now that we have created a group containing every waypoint, it is time to conduct a script to activate it. Click Map, then Scripts. Another dialogue box will pop up.
- Under Functions, double-click on MapInitialize. There should be a command called return, but there may be other functions as well.
- Above the return command, put in the following function: WaypointGroupOn(WaypointGroup("TheWaypoints")) , though replace the string in quotations with what you called your waypoint group. (Don't get rid of the quotations!)
- If done correctly, double-clicking MapInitialize again will cause no change in the script at all. Click OK.
- Now, save your map and enjoy having working waypoints!
You can also download the old editor. See http://zoaedk.noxforum.net/NoxTools.msi