say signindex; | displays signs - Signs have to be defined in the level editor, this will simply display it. |
if (playertouchsme){
say 0; } |
Displays the sign "0". |
lay itemname; | lays an item - Drops the item of the specified name (names are found in the item list). |
if (playertouchsme){
lay darts; } |
Will lay the item "darts" when touched. |
lay2 itemname,x,y; | lays an item to the specified position - Puts the specified item at the specified location. |
if (weaponfired){
lay2 fullheart,playerx+5,playery; } |
This weapon, when fired, will lay a full heart 5 spaces to the right of the player. |
take itemname; | takes an item if available - This will cause the NPC to take any item close to it that has the same name as specified with "itemname". |
if (playerlaysitem){
take greenrupee; } |
This will make the NPC take a green rupee if that's what the player laid. |
take2 index; | takes the item with the specified index - The NPC will only take the item with the specified index. |
for (i=0;i<itemscount;i++){
if (items[i].type==1){ take2 i; } } |
Of all the items currently on the level, whichever ones are of type 1 (a blue rupee) they will be taken. |
message text; | displays a text message over the npc - Same thing as when a player chats, its a text message displayed above the NPC. |
if (playertouchsme){
message Don't touch me!; } |
NPC will display the text "Don't touch me!" when it's touched. |
timershow; | lets the npc's timeout be shown - Shows the amount of time left until a timeout is reached (only displays it in whole number increments). |
if (playertouchsme){
timeout=20; timershow; } |
Displays the amount of time left for the NPC to reach 0 on its timeout. |
showcharacter; | displays a player character instead of the npc image - Instead of showing the gif file specified, this will cause the NPC to look like a player (it reads from sprites.gif). With this you can set it's sprites, clothes, head gif, sword, and shield. |
if (created){
showcharacter; } |
Displays a character when created. |
setcharprop messagecode,string; | sets string properties of the character - Allows you to change numerous string values for a showcharacter NPC. The "messagecode" can be found in section 13. |
if (created){
showcharacter; setcharprop #3,head173.gif; } |
This will set the character's headgif file to head173.gif. |
setcharani anifile,param1,param2...; | This sets the animation file of the character. "params" are passed by the NPC and read by the .gani |
if (timeout){
setcharani walk.gani; } |
When there is a timeout, the character's animation will be set to "walk.gani". |
putnpc imgname,scriptname,x,y; | creates a npc, scriptname is the name of a textfile containing the npc script - Puts a new NPC on the board with the specified script, and image at the specified location. The script has to be a .txt file with all the script the NPC is supposed to do written inside. |
if (washit){
putnpc bomb.gif,npcbomb.txt,x,y; } |
Puts a NPC with the gif of bomb.gif and the script of npcbomb.txt at the NPC's x,y when hit. |
callnpc index,flag; | calls the script of another npc (not immediatelly) - Makes the npc execute the script of another npc under the flag specified. May take up to .05 seconds for the script to execute. |
//Currently executing NPC
if (testnpc (x,y)>0){ callnpc testnpc(x,y),washit; } //NPC at (x,y) if (washit){ message OW!; } |
What this does is checks to see if there is an npc at (x,y); if so, it calls the 'washit' part of the script, thus causing the NPC at (x,y) to say 'OW!'. |
destroy; | deletes the npc - Completly removes the NPC from the board (I reccomend putting this in putnpcs). |
if (washit){
destroy; } |
Destroys the NPC when hit by a sword. |
carryobject objectname; | the character carries an object (only when 23<=sprite<=32) - This makes it so the NPC (must be a showchar NPC) carries the specified object. But you must set the sprites to anything from 23 to 32. |
if (peltwithbush){
sprite = 23; carryobject bush; } |
If the NPC is hit with a bush, the NPC will carry a bush (ought to look like he caught it.) |
throwcarry; | throws the carried object - This is used to make the NPC throw the object it is carrying. |
if (playertouchsme){
throwcarry; } |
This will will what the NPC is carrying when it's touched. |
followplayer; | lets the npc follow the player; the action script keeps running; set x/y to leave the player - This causes the NPC to follow the player. It is disabled in online mode. If you want it to stop following the player, then you just specify what x,y cordinate you want the NPC to be at, and it'll stop. |
if (playertouchsme){
followplayer; } if (followsplayer&&washit){ x=playerx+3; y=playery+3; } |
This will cause the NPC to follow the player when touched, but if it was hit while following the player, it'll stop following. |
toinventory flag; | puts the npc into the player's inventory until the flag is unset - Puts the NPC in the player's inventory, and that NPC will stay there until the flag specified is removed from the player's list. |
if (playertouchsme){
set gotkey; toinventory gotkey; } |
If the NPC is touched, it will set "gotkey" and the NPC will be put in the inventory. If "gotkey" is unset, the NPC will be removed. |
toweapons weaponname; | adds this npc to the players weapon list - Turns the NPC into a weapon, the player carries it with him/her in their weapon list. Putting a '*' in front of the name prevents the weapon from being deletable. |
if (playertouchsme){
toweapons Tech Bow; } |
Puts the NPC in the weapon list as "Tech Bow". |
showimg index,filename,x,y; | shows an image at the given position - The index can be any number the scripter wants, only use it as a reference to the gif. The filename is what gif to display, and x,y is where to display it. For non-weapons only the current player can see the image. |
if (weaponfired){
showimg 1,arrow.gif,playerx+3,playery; } |
Displays the gif "arrow.gif" at playerx+3.playery when the weapon is fired. |
hideimg index; | removes the image with the specified index - This will hide an image that was displayed using showimg. |
if (timeout){
hideimg 1; } |
Hides the image with index 1. |
changeimgpart index,x,y,width,height | changes the visible part of the showimg - Changes the viewable part of the image shown with the specified index. (Use with showimg, works similar to setgifpart). |
if (timeout){
showimg 88,arrowset.gif,playerx+3,playery; changeimgpart 88,10,5,32,32; } |
Changes the image with an index of 88 to show only the part of the image at 10,5 that is 32x32 pixels. |
changeimgvis index,drawheight; | changes the drawing height of the showimg - Changes the layer on which the specified image is drawn. 0 is drawunder, 1 is same as player, 2 is drawover, and 4 is like a stat. |
if (weaponfired) {
showimg 1,bomb.png,3,4; changeimgvis 1,4; } |
This will draw the image of index 1 (bomb.png) at a height of 4, so it is considered a stat at this point. |
changeimgcolors index,red,green,blue,alpha; | Alters the color of the image of the specified index. |
if (timeout){
showimg 1,orb.png,x,y; changeimgcolors 1,255,0,0,1; } |
This will display the image "orb.png" then change it's colors to a bright red. |
changeimgzoom index,zoomeffect; | This zooms in on the image with the specified index. |
if (timeout){
showimg 5,orb.png,x,y; changeimgzoom 5,8; } |
This will display orb.png, and then zoom in on the orb to 8x its normal size. |
shootarrow direction; | shoots an arrow - The NPC will shoot an arrow in the direction specified. Directions can be: up, left, down, or right; or they can be numerical: 0, 1, 2, or 3 (respectively). You can also use variables, such as playerdir. |
if (weaponfired){
shootarrow playerdir; } |
Shoots an arrow in the direction the player is facing. |
shootfireball direction; | shoots a fireball - This is the same as shootarrow, but instead its a fireball. |
if (weaponfired){
shootfireball 3; } |
Shoots a fireball to the right when the weapon is fired. |
shootfireblast direction; | shoots a fireblast - Same as above, but a fireblast instead. |
if (washit){
shootfireblast up; } |
When the NPC is hit, it'll shot a fireblast upward. |
shootnuke direction; | shoots an nukeshot - Same as above but for a nuke. |
if (washit){
for (dir=0;dir<3;dir++){ shootnuke dir; } } |
When this NPC is hit, it'll shoot a nuke in all four directions. |
shootball; | shoots a ball directly to the player - This shoots a ball that is always made to travel in the straightest path to the player. |
if (wasshot){
shootball; } |
If the NPC is shot, it'll shoot a ball. |
hitplayer index,halfhearts,fromx,fromy; | hurts a player - Hits the player with the specified index, and takes of the specified amount of half hearts from fromx,fromy. |
for (i=0;i<playerscount;i++){
if (abs(players[i].x-x)<=1&&abs(players[i].y-y)<=1){ hitplayer i,2,x,y; } } |
This will hit whatever player is less than or equal to one space away from the NPC's x,y cordinates, and will take off 1 whole heart (2 half hearts), and hit the player from the NPC's x,y. For information on how to use a for loop to read a player's index, check sections: 2Biii, 2Biii.1 and 14. |
hitnpc index,halfhearts,fromx,fromy; | hurts an npc (changes hearts, hurtdx, hurtdy) - Hurts the NPC with the specified index (automatically subtracts the appropriate amount of hearts from the NPC being hurt, as well as sets the hurtdx and hurtdy vars). |
n = testnpc(this.hitx,this.hity);
if (n>=0){ hitnpc n,2,this.hitx,this.hity; } |
If there is an NPC at (this.hitx,this.hity) then hit the NPC. |
hitobject power,x,y; | hurts players/npcs/computer opponents that are on the specified position - This is "hitplayer", "hitnpc", "hitcompu" all rolled into one. |
if (timeout){
hitobject 2,imagex,imagey; } |
Will hurt anything and everything for 2 hearts at (imagex,imagey) when there is a timeout. |
takehorse index; | takes the horse with the specified index (only works in combination with 'showcharacter' ) - This takes the horse that a showcharacter NPC is riding. |
if (strequals(#5,ride.gif)){
takehorse 0; } |
If the NPC is riding the horse "ride.gif" then it will be taken. |
triggeraction targetx,targety,action,params; | Invokes an event to the object on positon (targetx,targety) - Kind of like call NPC... I dunno what else to say. |
if (timeout){
triggeraction imagex,imagey,burn,2; } if (actionburn) hearts-=#p(0); |
Calls the action "burn" with a paramter of "2" to whatever NPC/Player is at location (imagex,imagey). When "burn" is called, the damage done is based on the parameter with an index of 0, in this case the value is "2". |
move dx,dy,time,options;
The value of "options" would be something like this:
|
This moves the npc without needing you to update
the
position of the npc 'manually' by changing x and y. - Moves the NPC the specified distance over the specified time, with some lame options. - cachingmode: - 0: previous movements will be finished immediatelly - 1: movements will be cached, the previous movements will only be finished when the cache is too large (distance to go >5); this caching can be used on server-side npcs to make the movement look like non-laggy even when there are little delays sometimes - 2: the movement will just be appended to the movement list; you can add up to 100 movements - blockcheck: add 4 to the options when you want the npc to stop when there is a wall blocking the npc - informmewhendone: if you add 8 to the options then the script will be called with a 'movementfinished' flag when the the npc has stopped walking; catch this event with if (movementfinished) {...} if you want to do something when the npc has stopped (e.g. walking in a different direction) - applydirection: add 16 to the options if you want the game to automatically set the direction of the npc depending on the movement direction (can be good when using movement caching) |
if (playertouchsme){
move 4,0,2,4+8+16; } if (movementfinished){ message Done; } |
When touched, this NPC will take 2 seconds to move 4 tiles to the right, but will stop if a wall is in the way (option 4), will face the direction it is walking (option 16), and when it is done (option 8), the flag "movementfinished" will be called to make the NPC display the message "Done". |